]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix regression with multiple mode: entries in the prop line
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 19 Apr 2022 16:06:31 +0000 (18:06 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 19 Apr 2022 16:06:31 +0000 (18:06 +0200)
* 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.

lisp/files.el
test/lisp/files-resources/file-mode-prop-line [new file with mode: 0644]
test/lisp/files-tests.el

index a9d4b5aea817594b4950ff6b1e3221db06f4d2a8..2b0dc54db8f2646cbf85fefb00e9e493e09a073c 100644 (file)
@@ -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 (file)
index 0000000..e0e7ad2
--- /dev/null
@@ -0,0 +1 @@
+-*- mode: notexist; mode: text -*-
index c886bd7985133024cb113b6f2f1dc8c9f3ff26fb..c5b0fe0bbbc4fe06243c408291732477f279d47b 100644 (file)
@@ -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