summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-03 22:43:35 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-03 22:43:35 +0200
commit355b0012d1d12d6de51fa800e886f7d1e60ab458 (patch)
tree0a28c8229be0a9c22647aa2365669acff896f6df
parent57d0a7453d0386f3f1425fc5319b2f42fca16e42 (diff)
downloadorg-mode-355b0012d1d12d6de51fa800e886f7d1e60ab458.tar.gz
Fix local variable handling
* lisp/org.el (org-clone-local-variables): * lisp/org-agenda.el (org-agenda-mode): Do not assume `buffer-local-variables' returns only cons cells. Reported-by: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de> <http://permalink.gmane.org/gmane.emacs.orgmode/113793>
-rw-r--r--lisp/org-agenda.el11
-rw-r--r--lisp/org.el10
2 files changed, 10 insertions, 11 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9c83914..1218d36 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2131,13 +2131,12 @@ The following commands are available:
;; while letting `kill-all-local-variables' kill the rest
(let ((save (buffer-local-variables)))
(kill-all-local-variables)
- (mapc 'make-local-variable org-agenda-local-vars)
+ (mapc #'make-local-variable org-agenda-local-vars)
(dolist (elem save)
- (let ((var (car elem))
- (val (cdr elem)))
- (when (and val
- (member var org-agenda-local-vars))
- (set var val)))))
+ (pcase elem
+ (`(,var ,val) ;ignore unbound variables
+ (when (and val (memq var org-agenda-local-vars))
+ (set var val))))))
(setq-local org-agenda-this-buffer-is-sticky t))
(org-agenda-sticky
;; Creating a sticky Agenda buffer for the first time
diff --git a/lisp/org.el b/lisp/org.el
index 8aa68b9..f508bf3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9619,11 +9619,11 @@ auto-fill\\|normal-auto-fill\\|fill-paragraph\\|indent-\\)"
"Clone local variables from FROM-BUFFER.
Optional argument REGEXP selects variables to clone."
(dolist (pair (buffer-local-variables from-buffer))
- (let ((name (car pair)))
- (when (and (symbolp name)
- (not (memq name org-unique-local-variables))
- (or (null regexp) (string-match regexp (symbol-name name))))
- (set (make-local-variable name) (cdr pair))))))
+ (pcase pair
+ (`(,name ,_) ;ignore unbound variables
+ (when (and (not (memq name org-unique-local-variables))
+ (or (null regexp) (string-match-p regexp (symbol-name name))))
+ (set (make-local-variable name) (cdr pair)))))))
;;;###autoload
(defun org-run-like-in-org-mode (cmd)