aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Shmakov2015-01-17 19:02:00 +0000
committerIvan Shmakov2015-01-17 19:33:50 +0000
commite000ff30b4354064ca7f9ed07e58903d7c44033f (patch)
tree308c76d255709592d170d95f056961debca24382
parent3e824b05af3a75768a61001fad68e2340af810eb (diff)
downloademacs-e000ff30b4354064ca7f9ed07e58903d7c44033f.tar.gz
emacs-e000ff30b4354064ca7f9ed07e58903d7c44033f.zip
Fix dir-locals handling for non-file buffers.
* lisp/files.el (dir-locals-collect-variables): Use default-directory in place of the file name while working on non-file buffers, just like hack-dir-local-variables already does. Fixes: debbugs:19140
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el4
2 files changed, 7 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f5ad8de3f8c..55c7a366deb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -6,6 +6,10 @@
6 * files.el (find-file-other-window, find-file-other-frame): 6 * files.el (find-file-other-window, find-file-other-frame):
7 Use mapc instead of mapcar. (Bug#18175) 7 Use mapc instead of mapcar. (Bug#18175)
8 8
9 * files.el (dir-locals-collect-variables): Use default-directory
10 in place of the file name while working on non-file buffers, just
11 like hack-dir-local-variables already does. (Bug#19140)
12
92015-01-17 Stefan Monnier <monnier@iro.umontreal.ca> 132015-01-17 Stefan Monnier <monnier@iro.umontreal.ca>
10 14
11 * emacs-lisp/eieio-core.el (eieio--class-constructor): Rename from 15 * emacs-lisp/eieio-core.el (eieio--class-constructor): Rename from
diff --git a/lisp/files.el b/lisp/files.el
index e6d80a9a4dc..e9632edacef 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3602,7 +3602,9 @@ Returns the new list."
3602 "Collect entries from CLASS-VARIABLES into VARIABLES. 3602 "Collect entries from CLASS-VARIABLES into VARIABLES.
3603ROOT is the root directory of the project. 3603ROOT is the root directory of the project.
3604Return the new variables list." 3604Return the new variables list."
3605 (let* ((file-name (buffer-file-name)) 3605 (let* ((file-name (or (buffer-file-name)
3606 ;; Handle non-file buffers, too.
3607 (expand-file-name default-directory)))
3606 (sub-file-name (if file-name 3608 (sub-file-name (if file-name
3607 ;; FIXME: Why not use file-relative-name? 3609 ;; FIXME: Why not use file-relative-name?
3608 (substring file-name (length root))))) 3610 (substring file-name (length root)))))