* 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.
(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))