From e1a18bdf272693ddf8319329989409684fddcb05 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 4 Jan 2010 17:48:47 +0100 Subject: [PATCH] Fix bug with #+BIND during LaTeX export Christopher Suckling writes: > Thank you, but not quite working yet: > > ,---- > | #+BIND: org-export-latex-title-command "" > `---- > > now appears to be having the *effect* of setting a global variable. > > I load Emacs then visit the below test org file. I then export the file. > > I get a \maketitle line. > > I then C-c C-c on the #+BIND: line and re-export. > > \maketitle is removed. > > I then export another org file without the #+BIND: line. > > There is no \maketitle, even though there should be. > > I add > > ,---- > | #+BIND: org-export-latex-title-command "\foobar" > `---- > > to the new org file, C-c C-c and export: > > \foobar is added to the exported file. > > Finally, I re-export the original test org file (without C-c C-c on the > #+BIND: line): > > \foobar is added to the exported file. > > However, > > ,---- > | C-h v org-export-latex-title-command > `---- > > always returns the value "\\maketitle", no matter what the value of the > #+BIND: line. > > Best, Christopher --- lisp/ChangeLog | 3 +++ lisp/org-exp.el | 7 ++++--- lisp/org-latex.el | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ee7cf4c1b..91fd4949e 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-01-04 Carsten Dominik + * org-latex.el (org-export-as-latex): Do the first letbind in the + right moment. + * org-agenda.el (org-get-entries-from-diary): Add the new face to these entries. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 20c6ce8fe..ba77a2eac 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -784,9 +784,10 @@ security risks." (defun org-install-letbind () "Install the values from #+BIND lines as local variables." - (let ((letbind (plist-get org-export-opt-plist :let-bind))) - (while letbind - (org-set-local (caar letbind) (nth 1 (pop letbind)))))) + (let ((letbind (plist-get org-export-opt-plist :let-bind)) + pair) + (while (setq pair (pop letbind)) + (org-set-local (car pair) (nth 1 pair))))) (defun org-export-add-options-to-plist (p options) "Parse an OPTIONS line and set values in the property list P." diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 86b6b04ad..26a38de3d 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -548,7 +548,6 @@ without even the \begin{document} and \end{document} commands. when PUB-DIR is set, use this as the publishing directory." (interactive "P") (run-hooks 'org-export-first-hook) - (org-install-letbind) ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) @@ -566,6 +565,8 @@ when PUB-DIR is set, use this as the publishing directory." '(:org-license-to-kill nil)))) (org-update-radio-target-regexp) (org-export-latex-set-initial-vars ext-plist arg) + (setq org-export-opt-plist org-export-latex-options-plist) + (org-install-letbind) (run-hooks 'org-export-latex-after-initial-vars-hook) (let* ((wcf (current-window-configuration)) (opt-plist org-export-latex-options-plist) @@ -585,7 +586,7 @@ when PUB-DIR is set, use this as the publishing directory." (org-export-add-subtree-options opt-plist rbeg) opt-plist))) ;; Make sure the variable contains the updated values. - (org-export-latex-options-plist opt-plist) + (org-export-latex-options-plist (setq org-export-opt-plist opt-plist)) (title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) (and (not