aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-04-18 10:36:32 +0200
committerLars Ingebrigtsen2022-04-18 10:36:43 +0200
commit713a1997059fb823f9fa26f92cee032fb6bfdc25 (patch)
treeddb2a6e53b5276cf8034bc139b2c16db8601ab73 /test
parent736fd8b258e5bbddf3e5260db1692d3e9ca4c81c (diff)
downloademacs-713a1997059fb823f9fa26f92cee032fb6bfdc25.tar.gz
emacs-713a1997059fb823f9fa26f92cee032fb6bfdc25.zip
Fix major-mode setting regression when there's a mode: cookie
* lisp/files.el (hack-local-variables): Fix regression in setting the major mode when there are mode: cookies in the file (bug#54993).
Diffstat (limited to 'test')
-rw-r--r--test/lisp/files-resources/file-mode3
-rw-r--r--test/lisp/files-tests.el7
2 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/files-resources/file-mode b/test/lisp/files-resources/file-mode
new file mode 100644
index 00000000000..92ac4c30ef5
--- /dev/null
+++ b/test/lisp/files-resources/file-mode
@@ -0,0 +1,3 @@
1Local variables:
2mode: text
3end:
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index e4424f3cbed..f76d047f302 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1814,5 +1814,12 @@ Prompt users for any modified buffer with `buffer-offer-save' non-nil."
1814 (should (equal (file-name-split "/foo/bar/") '("" "foo" "bar" ""))) 1814 (should (equal (file-name-split "/foo/bar/") '("" "foo" "bar" "")))
1815 (should (equal (file-name-split "foo/bar/") '("foo" "bar" "")))) 1815 (should (equal (file-name-split "foo/bar/") '("foo" "bar" ""))))
1816 1816
1817(ert-deftest files-test-set-mode ()
1818 (find-file (ert-resource-file "file-mode"))
1819 (should (eq major-mode 'text-mode))
1820 (emacs-lisp-mode)
1821 ;; Check that the mode cookie doesn't override the explicit setting.
1822 (should (eq major-mode 'emacs-lisp-mode)))
1823
1817(provide 'files-tests) 1824(provide 'files-tests)
1818;;; files-tests.el ends here 1825;;; files-tests.el ends here