emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#19140: closed (dir-locals-collect-variables discre


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19140: closed (dir-locals-collect-variables discrepancy in handling non-file buffers)
Date: Sat, 14 Feb 2015 21:10:02 +0000

Your message dated Sat, 14 Feb 2015 21:09:39 +0000
with message-id <address@hidden>
and subject line Re: bug#19140: dir-locals-collect-variables discrepancy in 
handling non-file buffers 
has caused the debbugs.gnu.org bug report #19140,
regarding dir-locals-collect-variables discrepancy in handling non-file buffers
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19140: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19140
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: dir-locals-collect-variables discrepancy in handling non-file buffers Date: Fri, 21 Nov 2014 16:12:52 +0000 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Package:  emacs
Severity: minor

        Please consider the patch MIMEd.

        * lisp/files.el (dir-locals-collect-variables): Use
        default-directory in place of the file name while working on
        non-file buffers (as hack-dir-local-variables already does.)

        The issue I observe is as follows.  First, I create ~/foo and
        ~/foo/ru directories, and a ~/foo/.dir-locals.el file like:

((nil
  (ispell-local-dictionary  . "esperanto"))
 ("ru"
  (nil
   (ispell-local-dictionary . "russian"))))

        Then:

(with-temp-buffer
  (cd "~/foo/ru/")
  (hack-dir-local-variables-non-file-buffer)
  ;; .
  dir-local-variables-alist)

        The result is '((ispell-local-dictionary . "esperanto")),
        contrary to the expected '((… . "russian")).

        This does not happen for buffers associated with files:

(with-current-buffer (find-file-noselect "~/foo/ru/bar")
  (hack-dir-local-variables)
  ;; .
  dir-local-variables-alist)

        Reading the code suggests that dir-locals-collect-variables
        fails to handle the (stringp key) case properly when ‘file-name’
        is nil, which is what my patch is intended to fix.

-- 
FSF associate member #7257  np. Conclusion — Apocalyptica    … B6A0 230E 334A
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3567,8 +3569,10 @@
 (defun dir-locals-collect-variables (class-variables root variables)
   "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
+                       default-directory))
         (sub-file-name (if file-name
                             ;; FIXME: Why not use file-relative-name?
                            (substring file-name (length root)))))

--- End Message ---
--- Begin Message --- Subject: Re: bug#19140: dir-locals-collect-variables discrepancy in handling non-file buffers Date: Sat, 14 Feb 2015 21:09:39 +0000 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Version: 25.1

>>>>> Ivan Shmakov <address@hidden> writes:
>>>>> Katsumi Yamaoka <address@hidden> writes:
>>>>> On Mon, 19 Jan 2015 08:55:43 +0000, Ivan Shmakov wrote:

 >>> Could you please check if both indeed resolve the issue at hand?

 >> Both work.  Thanks.

 > ACK; I’ve just pushed the change to custom-make-dependencies.

 > commit 2e8d209f258c9bb6a6626d4a101995965b040024

 > Fix the value default-directory gets in custom-make-dependencies.

 > * lisp/cus-dep.el (custom-make-dependencies): Ensure that
 > default-directory is interpreted as a directory (see bug#19140.)

        No further issues reported; closing.

commit e000ff30b4354064ca7f9ed07e58903d7c44033f
CommitDate: 2015-01-17 19:33:50 +0000

    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

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]