From: Juri Linkov Date: Tue, 10 Nov 2020 19:27:37 +0000 (+0200) Subject: Don't set file name variable in org-element-parse-secondary-string (bug#44524) X-Git-Tag: emacs-28.0.90~5192 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=79d04ae13ff33a93f631061d912168e9703251dd;p=emacs.git Don't set file name variable in org-element-parse-secondary-string (bug#44524) * lisp/org/org-element.el (org-element-parse-secondary-string): Don't set buffer-local variables buffer-file-name and buffer-file-truename in temporary buffer. --- diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index be74dfdbeff..ef64f58f81b 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -4144,7 +4144,9 @@ If STRING is the empty string or nil, return nil." (dolist (v local-variables) (ignore-errors (if (symbolp v) (makunbound v) - (set (make-local-variable (car v)) (cdr v))))) + ;; Don't set file name to avoid mishandling hooks (bug#44524) + (unless (memq (car v) '(buffer-file-name buffer-file-truename)) + (set (make-local-variable (car v)) (cdr v)))))) ;; Transferring local variables may put the temporary buffer ;; into a read-only state. Make sure we can insert STRING. (let ((inhibit-read-only t)) (insert string))