summaryrefslogtreecommitdiff
path: root/test/lisp/files-tests.el
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-07-23 15:51:11 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-07-23 15:51:11 +0200
commitad5faa424a5d2f0d67265906d21f7af98220df26 (patch)
tree87d76eb9e3ead110b7057ecdcfdc79ae85fcdc3e /test/lisp/files-tests.el
parent6a3b89f9df85d0718e55d460164ff65e7bdd823e (diff)
downloademacs-ad5faa424a5d2f0d67265906d21f7af98220df26.tar.gz
Add auto-mode-alist functionality to .dir-locals.el
* doc/emacs/custom.texi (Directory Variables): Document auto-mode-alist in .dir-locals.el (Bug#18721) * doc/emacs/modes.texi (Choosing Modes): Update. * lisp/files.el (set-auto-mode--apply-alist): New function, from set-auto-mode. (set-auto-mode): Check directory locals for auto-mode-alist. (dir-locals-collect-variables): Add "predicate" parameter. (hack-dir-local--get-variables): New function, from hack-dir-local-variables. (hack-dir-local-variables): Call hack-dir-local--get-variables. * test/lisp/files-resources/.dir-locals.el: New file. * test/lisp/files-resources/whatever.quux: New file. * test/lisp/files-tests.el (files-tests-data-dir): New variable. (files-test-dir-locals-auto-mode-alist): New test.
Diffstat (limited to 'test/lisp/files-tests.el')
-rw-r--r--test/lisp/files-tests.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index a6b0c900bec..fce7e3fd719 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1534,5 +1534,10 @@ The door of all subtleties!
(should-error (file-name-with-extension "Jack" "."))
(should-error (file-name-with-extension "/is/a/directory/" "css")))
+(ert-deftest files-test-dir-locals-auto-mode-alist ()
+ "Test an `auto-mode-alist' entry in `.dir-locals.el'"
+ (find-file (ert-resource-file "whatever.quux"))
+ (should (eq major-mode 'tcl-mode)))
+
(provide 'files-tests)
;;; files-tests.el ends here