Browse Source

Merge branch 'master' of orgmode.org:org-mode

Carsten Dominik 13 years ago
parent
commit
619da643a3
5 changed files with 56 additions and 35 deletions
  1. 5 6
      contrib/lisp/org-contacts.el
  2. 2 0
      contrib/lisp/org-mime.el
  3. 17 4
      contrib/lisp/org-odt.el
  4. 31 24
      lisp/ob-sql.el
  5. 1 1
      lisp/ob.el

+ 5 - 6
contrib/lisp/org-contacts.el

@@ -169,9 +169,10 @@ If both match values are nil, return all contacts."
 
 (when (not (fboundp 'completion-table-case-fold))
   ;; That function is new in Emacs 24...
-  (defun completion-table-case-fold (table string pred action)
-    (let ((completion-ignore-case t))
-      (complete-with-action action table string pred))))
+  (defun completion-table-case-fold (table &optional dont-fold)
+    (lambda (string pred action)
+      (let ((completion-ignore-case (not dont-fold)))
+	(complete-with-action action table string pred)))))
 
 (defun org-contacts-complete-name (&optional start)
   "Complete text at START with a user name and email."
@@ -226,9 +227,7 @@ If both match values are nil, return all contacts."
                                            ;; If the user has an email address, append USER <EMAIL>.
                                            if email collect (org-contacts-format-email contact-name email))
                                      ", ")))))
-    (list start end (if org-contacts-completion-ignore-case
-			(apply-partially #'completion-table-case-fold completion-list)
-		      completion-list))))
+    (list start end (completion-table-case-fold completion-list (not org-contacts-completion-ignore-case)))))
 
 (defun org-contacts-message-complete-function ()
   "Function used in `completion-at-point-functions' in `message-mode'."

+ 2 - 0
contrib/lisp/org-mime.el

@@ -205,6 +205,8 @@ export that region, otherwise export the entire body."
          (org-export-htmlize-output-type 'inline-css)
          ;; makes the replies with ">"s look nicer
          (org-export-preserve-breaks org-mime-preserve-breaks)
+	 ;; dvipng for inline latex because MathJax doesn't work in mail
+	 (org-export-with-LaTeX-fragments "dvipng")
          ;; to hold attachments for inline html images
          (html-and-images
           (org-mime-replace-images

+ 17 - 4
contrib/lisp/org-odt.el

@@ -184,7 +184,13 @@ FILE-MEMBERS.
 Use options 1, 2 or 3 only if styles.xml alone suffices for
 achieving the desired formatting.  Use option 4, if the styles.xml
 references additional files like header and footer images for
-achieving the desired formattting."
+achieving the desired formattting.
+
+Use \"#+ODT_STYLES_FILE: ...\" directive to set this variable on
+a per-file basis.  For example,
+
+#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or
+#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))."
   :group 'org-export-odt
   :type
   '(choice
@@ -197,6 +203,10 @@ achieving the desired formattting."
 		(file :tag "	Member" "styles.xml")
 		(repeat (file :tag "Member"))))))
 
+(eval-after-load 'org-exp
+  '(add-to-list 'org-export-inbuffer-options-extra
+		'("ODT_STYLES_FILE" :odt-styles-file)))
+
 (defconst org-export-odt-tmpdir-prefix "odt-")
 (defconst org-export-odt-bookmark-prefix "OrgXref.")
 (defcustom org-export-odt-use-bookmarks-for-internal-links t
@@ -1277,7 +1287,8 @@ value of `org-export-odt-use-htmlfontify."
     (org-export-odt-format-formula thefile href)))
 
 (defun org-odt-is-formula-link-p (file)
-  (member (downcase (file-name-extension file)) '("mathml")))
+  (let ((case-fold-search nil))
+    (string-match "\\.mathml\\'" file)))
 
 (defun org-odt-format-org-link (opt-plist type-1 path fragment desc attr
 					  descp)
@@ -1750,7 +1761,9 @@ visually."
   (org-odt-update-meta-file opt-plist)
 
   ;; write styles file
-  (org-odt-copy-styles-file)
+  (let ((styles-file (plist-get opt-plist :odt-styles-file)))
+    (org-odt-copy-styles-file (and styles-file
+				   (read (org-trim styles-file)))))
 
   ;; Update styles.xml - take care of outline numbering
   (with-current-buffer
@@ -2099,7 +2112,7 @@ visually."
 To disable outline numbering pass a LEVEL of 0."
   (goto-char (point-min))
   (let ((regex
-	 "<text:outline-level-style\\(.*\\)text:level=\"\\([^\"]*\\)\"\\(.*\\)>")
+	 "<text:outline-level-style\\([^>]*\\)text:level=\"\\([^\"]*\\)\"\\([^>]*\\)>")
 	(replacement
 	 "<text:outline-level-style\\1text:level=\"\\2\" style:num-format=\"\">"))
     (while (re-search-forward regex nil t)

+ 31 - 24
lisp/ob-sql.el

@@ -84,31 +84,38 @@ This function is called by `org-babel-execute-src-block'."
       (insert (org-babel-expand-body:sql body params)))
     (message command)
     (shell-command command)
-    (with-temp-buffer
-      ;; need to figure out what the delimiter is for the header row
+    (if (or (member "scalar" result-params)
+	    (member "verbatim" result-params)
+	    (member "html" result-params)
+	    (member "code" result-params)
+	    (equal (point-min) (point-max)))
+	(with-temp-buffer
+	  (progn (insert-file-contents-literally out-file) (buffer-string)))
       (with-temp-buffer
-        (insert-file-contents out-file)
-        (goto-char (point-min))
-        (when (re-search-forward "^\\(-+\\)[^-]" nil t)
-          (setq header-delim (match-string-no-properties 1)))
-        (goto-char (point-max))
-        (forward-char -1)
-        (while (looking-at "\n")
-          (delete-char 1)
-          (goto-char (point-max))
-          (forward-char -1))
-        (write-file out-file))
-      (org-table-import out-file '(16))
-      (org-babel-reassemble-table
-       (mapcar (lambda (x)
-                 (if (string= (car x) header-delim)
-                     'hline
-                   x))
-               (org-table-to-lisp))
-       (org-babel-pick-name (cdr (assoc :colname-names params))
-			    (cdr (assoc :colnames params)))
-       (org-babel-pick-name (cdr (assoc :rowname-names params))
-			    (cdr (assoc :rownames params)))))))
+	;; need to figure out what the delimiter is for the header row
+	(with-temp-buffer
+	  (insert-file-contents out-file)
+	  (goto-char (point-min))
+	  (when (re-search-forward "^\\(-+\\)[^-]" nil t)
+	    (setq header-delim (match-string-no-properties 1)))
+	  (goto-char (point-max))
+	  (forward-char -1)
+	  (while (looking-at "\n")
+	    (delete-char 1)
+	    (goto-char (point-max))
+	    (forward-char -1))
+	  (write-file out-file))
+	(org-table-import out-file '(16))
+	(org-babel-reassemble-table
+	 (mapcar (lambda (x)
+		   (if (string= (car x) header-delim)
+		       'hline
+		     x))
+		 (org-table-to-lisp))
+	 (org-babel-pick-name (cdr (assoc :colname-names params))
+			      (cdr (assoc :colnames params)))
+	 (org-babel-pick-name (cdr (assoc :rowname-names params))
+			      (cdr (assoc :rownames params))))))))
 
 (defun org-babel-sql-expand-vars (body vars)
   "Expand the variables held in VARS in BODY."

+ 1 - 1
lisp/ob.el

@@ -1272,7 +1272,7 @@ of the vars, cnames and rnames."
             (setq var (cons (car var) (org-babel-del-hlines (cdr var))))))
         var)
       vars)
-     cnames rnames)))
+     (reverse cnames) (reverse rnames))))
 
 (defun org-babel-reassemble-table (table colnames rownames)
   "Add column and row names to a table.