From 79d04ae13ff33a93f631061d912168e9703251dd Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 10 Nov 2020 21:27:37 +0200 Subject: [PATCH] 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. --- lisp/org/org-element.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)) -- 2.39.2