diff options
author | Tom Tromey <tom@tromey.com> | 2021-07-23 15:51:11 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-07-23 15:51:11 +0200 |
commit | ad5faa424a5d2f0d67265906d21f7af98220df26 (patch) | |
tree | 87d76eb9e3ead110b7057ecdcfdc79ae85fcdc3e /test/lisp/files-tests.el | |
parent | 6a3b89f9df85d0718e55d460164ff65e7bdd823e (diff) | |
download | emacs-ad5faa424a5d2f0d67265906d21f7af98220df26.tar.gz emacs-ad5faa424a5d2f0d67265906d21f7af98220df26.tar.bz2 emacs-ad5faa424a5d2f0d67265906d21f7af98220df26.zip |
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.el | 5 |
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 |