diff options
author | Rasmus <rasmus@gmx.us> | 2017-08-29 10:07:08 +0200 |
---|---|---|
committer | Rasmus <rasmus@gmx.us> | 2017-08-29 10:13:31 +0200 |
commit | 3ad8ca429bac5e1354881cf4411d6f41dab36b44 (patch) | |
tree | 41d8dc789a212dc3b1e09f402714b09dc1462fc5 /lisp/org/org-macs.el | |
parent | c1854b1d31e1b0a3a9e91ef41110a5fa77bedb31 (diff) | |
download | emacs-3ad8ca429bac5e1354881cf4411d6f41dab36b44.tar.gz |
Update Org to v9.0.10
Please see etc/ORG-NEWS for major changes. Note, this is a bugfix
release.
Diffstat (limited to 'lisp/org/org-macs.el')
-rw-r--r-- | lisp/org/org-macs.el | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index ca47e5a5a33..aae59d3c1f4 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -304,6 +304,43 @@ error when the user input is empty." (allow-empty? nil) (t (user-error "Empty input is not valid"))))) +(defconst org-unique-local-variables + '(org-element--cache + org-element--cache-objects + org-element--cache-sync-keys + org-element--cache-sync-requests + org-element--cache-sync-timer) + "List of local variables that cannot be transferred to another buffer.") + +(defun org-get-local-variables () + "Return a list of all local variables in an Org mode buffer." + (delq nil + (mapcar + (lambda (x) + (let* ((binding (if (symbolp x) (list x) (list (car x) (cdr x)))) + (name (car binding))) + (and (not (get name 'org-state)) + (not (memq name org-unique-local-variables)) + (string-match-p + "\\`\\(org-\\|orgtbl-\\|outline-\\|comment-\\|paragraph-\\|\ +auto-fill\\|normal-auto-fill\\|fill-paragraph\\|indent-\\)" + (symbol-name name)) + binding))) + (with-temp-buffer + (org-mode) + (buffer-local-variables))))) + +(defun org-clone-local-variables (from-buffer &optional regexp) + "Clone local variables from FROM-BUFFER. +Optional argument REGEXP selects variables to clone." + (dolist (pair (buffer-local-variables from-buffer)) + (pcase pair + (`(,name . ,value) ;ignore unbound variables + (when (and (not (memq name org-unique-local-variables)) + (or (null regexp) (string-match-p regexp (symbol-name name)))) + (ignore-errors (set (make-local-variable name) value))))))) + + (provide 'org-macs) ;;; org-macs.el ends here |