]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix dir-locals handling for non-file buffers.
authorIvan Shmakov <ivan@siamics.net>
Sat, 17 Jan 2015 19:02:00 +0000 (19:02 +0000)
committerIvan Shmakov <ivan@siamics.net>
Sat, 17 Jan 2015 19:33:50 +0000 (19:33 +0000)
* 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
lisp/ChangeLog
lisp/files.el

index f5ad8de3f8c2d6008d7ae722998e29d5b905ab1e..55c7a366deb4b4afd769ddea4086886b5b36b954 100644 (file)
@@ -6,6 +6,10 @@
        * files.el (find-file-other-window, find-file-other-frame):
        Use mapc instead of mapcar.  (Bug#18175)
 
+       * 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.  (Bug#19140)
+
 2015-01-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/eieio-core.el (eieio--class-constructor): Rename from
index e6d80a9a4dc94454270477e26fd3950f41f525dd..e9632edacef4c08f4e59ce4b3bb03eaa43de0db4 100644 (file)
@@ -3602,7 +3602,9 @@ Returns the new list."
   "Collect entries from CLASS-VARIABLES into VARIABLES.
 ROOT is the root directory of the project.
 Return the new variables list."
-  (let* ((file-name (buffer-file-name))
+  (let* ((file-name (or (buffer-file-name)
+                       ;; Handle non-file buffers, too.
+                       (expand-file-name default-directory)))
         (sub-file-name (if file-name
                             ;; FIXME: Why not use file-relative-name?
                            (substring file-name (length root)))))