From: Lars Ingebrigtsen Date: Tue, 19 Apr 2022 16:06:31 +0000 (+0200) Subject: Fix regression with multiple mode: entries in the prop line X-Git-Tag: emacs-29.0.90~1931^2~402 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e45abc832db7d1a64a0761dcb51565b7c282999a;p=emacs.git Fix regression with multiple mode: entries in the prop line * lisp/files.el (hack-local-variables--find-variables): Use the final mode: line (which is the same as having several mode: bits in the header line. --- diff --git a/lisp/files.el b/lisp/files.el index a9d4b5aea81..2b0dc54db8f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3900,7 +3900,7 @@ inhibited." ;; Note this is a no-op if enable-local-variables is nil. (hack-dir-local-variables)) (let ((result (append (hack-local-variables--find-variables handle-mode) - (hack-local-variables-prop-line)))) + (hack-local-variables-prop-line handle-mode)))) (if (and enable-local-variables (not (inhibit-local-variables-p))) (progn diff --git a/test/lisp/files-resources/file-mode-prop-line b/test/lisp/files-resources/file-mode-prop-line new file mode 100644 index 00000000000..e0e7ad24d71 --- /dev/null +++ b/test/lisp/files-resources/file-mode-prop-line @@ -0,0 +1 @@ +-*- mode: notexist; mode: text -*- diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index c886bd79851..c5b0fe0bbbc 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1825,5 +1825,9 @@ Prompt users for any modified buffer with `buffer-offer-save' non-nil." (find-file (ert-resource-file "file-mode-multiple")) (should (eq major-mode 'outline-mode))) +(ert-deftest files-test-set-mode-prop-line () + (find-file (ert-resource-file "file-mode-prop-line")) + (should (eq major-mode 'text-mode))) + (provide 'files-tests) ;;; files-tests.el ends here