Browse Source

New function `org-clone-local-variables'.

* org-exp.el (org-export-preprocess-string): Set the source
buffer and use `org-clone-local-variables' to get local
variables from it.

* org.el (org-clone-local-variables): New function.
Dan Davison 14 years ago
parent
commit
fda90a9aad
2 changed files with 14 additions and 0 deletions
  1. 2 0
      lisp/org-exp.el
  2. 12 0
      lisp/org.el

+ 2 - 0
lisp/org-exp.el

@@ -1038,6 +1038,7 @@ on this string to produce the exported version."
 	 (inhibit-read-only t)
 	 (drawers org-drawers)
 	 (outline-regexp "\\*+ ")
+	 (source-buffer (current-buffer))
 	 target-alist rtn)
 
     (setq org-export-target-aliases nil
@@ -1061,6 +1062,7 @@ on this string to produce the exported version."
 
       (let ((org-inhibit-startup t)) (org-mode))
       (setq case-fold-search t)
+      (org-clone-local-variables source-buffer "^\\(org-\\|orgtbl-\\)")
       (org-install-letbind)
 
       ;; Call the hook

+ 12 - 0
lisp/org.el

@@ -8145,6 +8145,18 @@ Possible values in the list of contexts are `table', `headline', and `item'."
 		 x nil))
 	   varlist))))
 
+(defun org-clone-local-variables (from-buffer &optional regexp)
+  "Clone local variables from FROM-BUFFER.
+Optional argument REGEXP selects variables to clone."
+  (mapc
+   (lambda (pair)
+     (and (symbolp (car pair))
+	  (or (null regexp)
+	      (string-match regexp (symbol-name (car pair))))
+	  (set (make-local-variable (car pair))
+	       (cdr pair))))
+   (buffer-local-variables from-buffer)))
+
 ;;;###autoload
 (defun org-run-like-in-org-mode (cmd)
   "Run a command, pretending that the current buffer is in Org-mode.