From 8caad532c32900f585456624598734cf11bf2d58 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Thu, 13 Oct 2011 20:05:43 +0000 Subject: [PATCH 1/8] Fix Emacs 24 compatibility issue with Emacs 24 * contrib/lisp/org-contacts.el (completion-table-case-fold): Make completion compatible with Emacs 24Fix org-contacts completion at point (was: org-contacts completion stopped working) julien Barnier writes: Hi Julien, >> I use a very recent emacs 24 bzr checkout and org master from git. >> Not sure who's the culprit. > > Same problem here. After a quick look it seems that there has been a > recent change in the arguments taken by the completion-table-case-fold > function in minibuffer.el : > > http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/105991 Thanks for the pointer! > But I don't think I could be able to find a fix by myself. But I was able, so good teamwork, mate. :-) --8<---------------cut here---------------start------------->8--- >From d89ca3ce39cd7436e5205744adcf468d9619180f Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Thu, 13 Oct 2011 17:02:07 +0200 Subject: [PATCH 2/2] Fix org-contacts completion at point. --- contrib/lisp/org-contacts.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index f4d9cd7a9..4b21d2637 100644 --- a/contrib/lisp/org-contacts.el +++ b/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 . 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'." From 9e90239a70da0d97d1e0a171c4c8a9f191dfa8be Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Tue, 18 Oct 2011 16:55:27 +0530 Subject: [PATCH 2/8] org-odt.el: Don't corrupt styles.xml while applying outline numbering * contrib/lisp/org-odt.el (org-odt-configure-outline-numbering): Tighten the regular expression that matches "" element. Fixes bug reported here http://lists.gnu.org/archive/html/emacs-orgmode/2011-10/msg00594.html --- contrib/lisp/org-odt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index f088b0519..9bf158a3d 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -2099,7 +2099,7 @@ visually." To disable outline numbering pass a LEVEL of 0." (goto-char (point-min)) (let ((regex - "") + "]*\\)text:level=\"\\([^\"]*\\)\"\\([^>]*\\)>") (replacement "")) (while (re-search-forward regex nil t) From c1ac64094479cb24b94cc53b9f59726ce9767240 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 18 Oct 2011 10:08:39 -0600 Subject: [PATCH 3/8] fix multi-table bug in code block colname and rowname handling Thanks to Nick Dokos for suggesting this fix * lisp/ob.el (org-babel-disassemble-tables): Fix multi-table bug in code block colname and rowname handling. --- lisp/ob.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob.el b/lisp/ob.el index 487dcb0f3..0778fe0f0 100644 --- a/lisp/ob.el +++ b/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. From faaa881c50ae58be301de7afbd5ef8438fe4523e Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 18 Oct 2011 10:15:04 -0600 Subject: [PATCH 4/8] ob-sql returns literal results when requested * lisp/ob-sql.el (org-babel-execute:sql): Respect literal-results options. --- lisp/ob-sql.el | 54 ++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index c52614815..fb0d7d615 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -84,31 +84,37 @@ 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))) + (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." From ce6f67c1ef62d77358059403587677fc6314705f Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Wed, 19 Oct 2011 22:16:59 +0530 Subject: [PATCH 5/8] Fix a crash in org-odt-is-formula-link-p * contrib/lisp/org-odt.el (org-odt-is-formula-link-p): Trivial change to avoid a crash. --- contrib/lisp/org-odt.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index 9bf158a3d..a14c827d9 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -1277,7 +1277,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) From 757453b98e942fc13c4d80d9c7ab4948591cccba Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Wed, 19 Oct 2011 23:12:43 +0530 Subject: [PATCH 6/8] Add a new option #+ODT_STYLES_FILE:... * contrib/lisp/org-odt.el: Introduce a new option "#+ODT_STYLES_FILE: ..." for per-file setting of `org-export-odt-styles-file'. (org-export-odt-styles-file): Mention above option in docstring. (org-odt-save-as-outfile): Honor above option. --- contrib/lisp/org-odt.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index a14c827d9..9ec99c345 100644 --- a/contrib/lisp/org-odt.el +++ b/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 @@ -1751,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 From 0da82db2526c47efa501faea94f5a8415f5b164e Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 19 Oct 2011 08:29:03 -0600 Subject: [PATCH 7/8] org-mime: use dvipng for inline images when export to html mail * contrib/lisp/org-mime.el (org-mime-htmlize): Use dvipng for inline images when export to html mail. --- contrib/lisp/org-mime.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/lisp/org-mime.el b/contrib/lisp/org-mime.el index 8d06faab6..ec638c166 100644 --- a/contrib/lisp/org-mime.el +++ b/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 From 92a01caa6deab2199cd16165f1cc685bbd95ba60 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 19 Oct 2011 12:07:39 -0600 Subject: [PATCH 8/8] ob-sql: insert into a temporary buffer * lisp/ob-sql.el (org-babel-execute:sql): Insert into a temporary buffer. --- lisp/ob-sql.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index fb0d7d615..8d343562c 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -89,7 +89,8 @@ This function is called by `org-babel-execute-src-block'." (member "html" result-params) (member "code" result-params) (equal (point-min) (point-max))) - (progn (insert-file-contents-literally out-file) (buffer-string)) + (with-temp-buffer + (progn (insert-file-contents-literally out-file) (buffer-string))) (with-temp-buffer ;; need to figure out what the delimiter is for the header row (with-temp-buffer