GNU bug report logs - #2833
23.0.92; Bug in Directory Variables

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Tue, 31 Mar 2009 14:40:04 UTC

Severity: serious

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 2833 in the body.
You can then email your comments to 2833 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Tue, 31 Mar 2009 14:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 31 Mar 2009 14:40:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.92; Bug in Directory Variables
Date: Tue, 31 Mar 2009 15:32:02 +0100
I think there's a bug in direcotry variables code, that is, changing the
directory variables would require a restart of Emacs for them to take
effect.

A recipe to reproduce:

  1. Create a dir and write the following to file .dir-locals in the dir
     created:

((latex-mode . ((fill-column . 78)
                (coding . "latin-1"))))

  2. Open or create a .tex file in that dir

  3. C-h v fill-column RET to check the value 

  4. Change 78 to another value say 75

  5. Re-open the .tex file and you will see fill-column has a value 78
     NOT 75

In my view, this makes the `Directory Variables' feature much less
useful. Any fix?


In GNU Emacs 23.0.92.1 (i386-mingw-nt5.1.2600) of 2009-03-31 on BREPNB
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENG
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: LaTeX/P

Minor modes in effect:
  reftex-mode: t
  TeX-PDF-mode: t
  dired-omit-mode: t
  recentf-mode: t
  icomplete-mode: t
  savehist-mode: t
  display-time-mode: t
  xterm-mouse-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  minibuffer-depth-indicate-mode: t
  which-function-mode: t
  show-paren-mode: t
  rcirc-track-minor-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<left> <left> <left> C-x C-f . d i <return> <backspace> 
8 C-x C-s C-h i m e m a <tab> <return> m f i l e SPC 
v a r <tab> <tab> <return> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <up> 
<return> SPC SPC SPC l <down> <return> SPC l ^ <down> 
<return> <down> <down> <down> <down> <down> <down> 
q <right> <backspace> 8 C-x C-s C-x k <return> <down> 
<down> <down> <down> <down> <down> <down> M-x r e p 
o r <tab> <return>

Recent messages:
Applying style hooks... done
Type "q" to delete this window.
Applying style hooks... done
Type "q" to delete this window.
Composing main Info directory...done
Reverting buffer `.dir-locals.el'.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Wed, 01 Apr 2009 01:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 01 Apr 2009 01:20:04 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 2833 <at> debbugs.gnu.org, emacs-pretest-bug <at> gnu.org
Subject: Re: bug#2833: 23.0.92; Bug in Directory Variables
Date: Tue, 31 Mar 2009 21:14:37 -0400
>   1. Create a dir and write the following to file .dir-locals in the dir
>      created:

> ((latex-mode . ((fill-column . 78)
>                 (coding . "latin-1"))))

>   2. Open or create a .tex file in that dir
>   3. C-h v fill-column RET to check the value 
>   4. Change 78 to another value say 75

How do you change it?  with C-x f ?

>   5. Re-open the .tex file and you will see fill-column has a value 78
>      NOT 75

How do you "re-open" it?


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Wed, 01 Apr 2009 01:20:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 01 Apr 2009 01:20:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Wed, 01 Apr 2009 10:10:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 01 Apr 2009 10:10:05 GMT) Full text and rfc822 format available.

Message #20 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: bug#2833: 23.0.92; Bug in Directory Variables
Date: Wed, 01 Apr 2009 11:01:58 +0100
On 2009-04-01 02:14 +0100, Stefan Monnier wrote:
>>   1. Create a dir and write the following to file .dir-locals in the dir
>>      created:
>
>> ((latex-mode . ((fill-column . 78)
>>                 (coding . "latin-1"))))
>
>>   2. Open or create a .tex file in that dir
>>   3. C-h v fill-column RET to check the value 
>>   4. Change 78 to another value say 75
>
> How do you change it?  with C-x f ?

Sorry I wasn't clear. I mean change the value in .dir-locals and save
the file.

>>   5. Re-open the .tex file and you will see fill-column has a value 78
>>      NOT 75
>
> How do you "re-open" it?

Kill that buffer and open the file again using C-x C-f.

>         Stefan

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Thu, 02 Apr 2009 18:55:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 02 Apr 2009 18:55:05 GMT) Full text and rfc822 format available.

Message #25 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Tom Tromey  <tromey <at> redhat.com>
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: 23.0.92; Bug in Directory Variables
Date: Thu, 02 Apr 2009 14:50:42 -0400
> I think there's a bug in directory variables code, that is, changing
> the directory variables would require a restart of Emacs for them to
> take effect.

Tom, could you please take a shot at implementing this?  It may be too
late in the release to put this in 23.1 (depending on how complicated
the change turns out to be), but this problem definitely needs fixing at
some point.

I guess this is what the following comment in files.el is referring to:

(defun dir-locals-read-from-file (file)
  "Load a variables FILE and register a new class and instance.
FILE is the name of the file holding the variables to apply.
The new class name is the same as the directory in which FILE
is found.  Returns the new class name."
  (with-temp-buffer
    ;; We should probably store the modtime of FILE and then
    ;; reload it whenever it changes.
    (insert-file-contents file)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Tue, 07 Apr 2009 04:40:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 07 Apr 2009 04:40:05 GMT) Full text and rfc822 format available.

Message #30 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: emacs-devel <at> gnu.org
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: Re: 23.0.92; Bug in Directory Variables
Date: Tue, 07 Apr 2009 00:32:29 -0400
Could someone please take a stab at bug#2833?  This should not be
difficult, but I have no time for it at the moment.  Basically, one
needs to change dir-locals-read-from-file so that it records the modtime
of each directory variables file, and dir-locals-find-file so that it
checked if the cache is stale and refreshes it if necessary.  (Tom
Tromey, the author of the code, is not responding to email.)




Severity set to `serious' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 07 Apr 2009 04:40:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Thu, 09 Apr 2009 03:05:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 09 Apr 2009 03:05:06 GMT) Full text and rfc822 format available.

Message #37 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: emacs-devel <at> gnu.org
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: 23.0.92; Bug in Directory Variables
Date: Wed, 08 Apr 2009 22:59:44 -0400
The following patch changes the directory local variables code so that
the cache stores the file atime.  Before using each cache entry, we
check that against the file modtime.

This is not an ideal time to make changes of this sort, but I think this
problem (i.e., inability to detect changes in .dir-locals.el files) is
quite a serious one.  So please help me review this patch.

*** trunk/lisp/files.el.~1.1044.~	2009-04-08 10:42:40.000000000 -0400
--- trunk/lisp/files.el	2009-04-08 22:50:03.000000000 -0400
***************
*** 3187,3194 ****
  (defvar dir-locals-class-alist '()
    "Alist mapping class names (symbols) to variable lists.")
  
! (defvar dir-locals-directory-alist '()
!   "Alist mapping directory roots to variable classes.")
  
  (defsubst dir-locals-get-class-variables (class)
    "Return the variable list for CLASS."
--- 3187,3199 ----
  (defvar dir-locals-class-alist '()
    "Alist mapping class names (symbols) to variable lists.")
  
! (defvar dir-locals-directory-cache '()
!   "List of cached directory roots for directory-local variable files.
! Each element in this list has the form (DIR ATIME CLASS), where
! DIR is the name of the directory, ATIME is the time when this
! cache entry was created (as a floating point number, per
! `float-time'), and CLASS is the name of a project class (a
! symbol).")
  
  (defsubst dir-locals-get-class-variables (class)
    "Return the variable list for CLASS."
***************
*** 3241,3247 ****
    (setq directory (file-name-as-directory (expand-file-name directory)))
    (unless (assq class dir-locals-class-alist)
      (error "No such class `%s'" (symbol-name class)))
!   (push (cons directory class) dir-locals-directory-alist))
  
  (defun dir-locals-set-class-variables (class variables)
    "Map the type CLASS to a list of variable settings.
--- 3246,3252 ----
    (setq directory (file-name-as-directory (expand-file-name directory)))
    (unless (assq class dir-locals-class-alist)
      (error "No such class `%s'" (symbol-name class)))
!   (push (list directory (float-time) class) dir-locals-directory-cache))
  
  (defun dir-locals-set-class-variables (class variables)
    "Map the type CLASS to a list of variable settings.
***************
*** 3284,3295 ****
  across different environments and users.")
  
  (defun dir-locals-find-file (file)
!   "Find the directory-local variables FILE.
! This searches upward in the directory tree.
! If a local variables file is found, the file name is returned.
! If the file is already registered, a cons from
! `dir-locals-directory-alist' is returned.
! Otherwise this returns nil."
    (setq file (expand-file-name file))
    (let* ((dir-locals-file-name
  	  (if (eq system-type 'ms-dos)
--- 3289,3304 ----
  across different environments and users.")
  
  (defun dir-locals-find-file (file)
!   "Find the directory-local variables for FILE.
! This searches upward in the directory tree from FILE.
! 
! If the file is already registered and has not been modified since
!  we added it to `dir-locals-directory-cache', this returns a cons
!  cell of the form (DIRECTORY . CLASS), using the entry in
!  `dir-locals-directory-cache'.
! Otherwise, if a local variables file is found, the file name is
!  returned.
! Otherwise, this returns nil."
    (setq file (expand-file-name file))
    (let* ((dir-locals-file-name
  	  (if (eq system-type 'ms-dos)
***************
*** 3300,3318 ****
      ;; `locate-dominating-file' may have abbreviated the name.
      (when locals-file
        (setq locals-file (expand-file-name dir-locals-file-name locals-file)))
!     (dolist (elt dir-locals-directory-alist)
        (when (and (eq t (compare-strings file nil (length (car elt))
  					(car elt) nil nil
  					(memq system-type
  					      '(windows-nt cygwin ms-dos))))
  		 (> (length (car elt)) (length (car dir-elt))))
  	(setq dir-elt elt)))
!     (if (and locals-file dir-elt)
! 	(if (> (length (file-name-directory locals-file))
! 	       (length (car dir-elt)))
! 	    locals-file
! 	  dir-elt)
!       (or locals-file dir-elt))))
  
  (defun dir-locals-read-from-file (file)
    "Load a variables FILE and register a new class and instance.
--- 3309,3338 ----
      ;; `locate-dominating-file' may have abbreviated the name.
      (when locals-file
        (setq locals-file (expand-file-name dir-locals-file-name locals-file)))
!     ;; Find the best cached value in `dir-locals-directory-cache'.
!     (dolist (elt dir-locals-directory-cache)
        (when (and (eq t (compare-strings file nil (length (car elt))
  					(car elt) nil nil
  					(memq system-type
  					      '(windows-nt cygwin ms-dos))))
  		 (> (length (car elt)) (length (car dir-elt))))
  	(setq dir-elt elt)))
!     (let ((use-cache (and dir-elt
! 			  (or (null locals-file)
! 			      (<= (length (file-name-directory locals-file))
! 				  (length (car dir-elt)))))))
!       (if use-cache
! 	  ;; Check the validity of the cache.
! 	  (if (and (file-readable-p (car dir-elt))
! 		   (< (float-time (nth 5 (file-attributes (car dir-elt))))
! 		      (nth 1 dir-elt)))
! 	      ;; This cache entry is OK.
! 	      (cons (nth 0 dir-elt) (nth 2 dir-elt))
! 	    ;; This cache entry is invalid; clear it.
! 	    (setq dir-locals-directory-cache
! 		  (delq dir-elt dir-locals-directory-cache))
! 	    locals-file)
! 	locals-file))))
  
  (defun dir-locals-read-from-file (file)
    "Load a variables FILE and register a new class and instance.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Thu, 09 Apr 2009 11:10:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to David De La Harpe Golden <david <at> harpegolden.net>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 09 Apr 2009 11:10:06 GMT) Full text and rfc822 format available.

Message #42 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: David De La Harpe Golden <david <at> harpegolden.net>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: emacs-devel <at> gnu.org, 2833 <at> debbugs.gnu.org
Subject: Re: 23.0.92; Bug in Directory Variables
Date: Thu, 09 Apr 2009 12:03:00 +0100
Chong Yidong wrote:
> The following patch changes the directory local variables code so that
> the cache stores the file atime.  Before using each cache entry, we
> check that against the file modtime.
> 
> This is not an ideal time to make changes of this sort, but I think this
> problem (i.e., inability to detect changes in .dir-locals.el files) is
> quite a serious one.  So please help me review this patch.
>

I suspect the systems where a problem with the patch will be most 
noticeable will be windoze, since there's an extra file attributes call? 
 I have a suspicion you almost might as well abandon the caching given 
the scary timings we've seen for that in the past.  I could be wrong though.









Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Thu, 09 Apr 2009 11:35:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 09 Apr 2009 11:35:04 GMT) Full text and rfc822 format available.

Message #47 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#2833: 23.0.92; Bug in Directory Variables
Date: Thu, 09 Apr 2009 12:31:34 +0100
On 2009-04-09 03:59 +0100, Chong Yidong wrote:
> The following patch changes the directory local variables code so that
> the cache stores the file atime.  Before using each cache entry, we
> check that against the file modtime.
>
> This is not an ideal time to make changes of this sort, but I think this
> problem (i.e., inability to detect changes in .dir-locals.el files) is
> quite a serious one.  So please help me review this patch.

Hi Yidong,

Thank you for working on this.

Why not put the change in CVS so that anybody who uses it can test it?


Best wishes,
Leo

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Thu, 09 Apr 2009 14:35:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 09 Apr 2009 14:35:06 GMT) Full text and rfc822 format available.

Message #52 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: 23.0.92; Bug in Directory Variables
Date: Thu, 09 Apr 2009 10:27:22 -0400
> The following patch changes the directory local variables code so that
> the cache stores the file atime.  Before using each cache entry, we
> check that against the file modtime.

I'm not sure this is the right thing to do:
- We don't know that the (float-time) is in sync with the filesystem's
  time, so the check may not work right.  Better check the file's
  current mtime against the file's mtime when it was last read.
- the variable you changed could previously be setq in the .emacs,
  whereas you changed it into an internal var.

FWIW, here's the patch I was working on instead.


        Stefan


--- files.el.~1.1044.~	2009-04-08 20:09:55.000000000 -0400
+++ files.el	2009-04-09 10:24:53.000000000 -0400
@@ -3314,21 +3314,31 @@
 	  dir-elt)
       (or locals-file dir-elt))))
 
+(defvar dir-locals--file-cache nil
+  "Cache of dir-locals files's contents.")
+
 (defun dir-locals-read-from-file (file)
   "Load a variables FILE and register a new class and instance.
 FILE is the name of the file holding the variables to apply.
 The new class name is the same as the directory in which FILE
 is found.  Returns the new class name."
+  (let ((mtime (nth 5 (file-attributes file)))
+        (cache (assoc file dir-locals--file-cache)))
+    (unless (equal (nth 1 cache) mtime)
+      (setq dir-locals--file-cache (delq cache dir-locals--file-cache))
+      (setq cache nil))
+    (if cache
+        (nth 2 cache)
+      (let ((val
   (with-temp-buffer
-    ;; We should probably store the modtime of FILE and then
-    ;; reload it whenever it changes.
     (insert-file-contents file)
     (let* ((dir-name (file-name-directory file))
 	   (class-name (intern dir-name))
 	   (variables (read (current-buffer))))
       (dir-locals-set-class-variables class-name variables)
-      (dir-locals-set-directory-class dir-name class-name)
-      class-name)))
+                 class-name))))
+        (push (list file mtime val) dir-locals--file-cache)
+        val))))
 
 (declare-function c-postprocess-file-styles "cc-mode" ())
 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Thu, 09 Apr 2009 15:25:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 09 Apr 2009 15:25:07 GMT) Full text and rfc822 format available.

Message #57 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: 23.0.92; Bug in Directory Variables
Date: Thu, 09 Apr 2009 11:20:13 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> - We don't know that the (float-time) is in sync with the filesystem's
>   time, so the check may not work right.  Better check the file's
>   current mtime against the file's mtime when it was last read.

Yes, good point.

> - the variable you changed could previously be setq in the .emacs,
>   whereas you changed it into an internal var.

It was always a defvar instead of a defcustom.  I don't think it makes
sense for it to be user-customizable.

> FWIW, here's the patch I was working on instead.

Is this patch complete?  By the time dir-locals-read-from-file is
called, hack-dir-local-variables has already decided that there is no
cached value.  Conversely, if there is a cached value, it will be used
without calling dir-locals-read-from-file.  So we need to change
dir-locals-find-file as well (which is what my patch did).




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Sat, 11 Apr 2009 15:40:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 11 Apr 2009 15:40:08 GMT) Full text and rfc822 format available.

Message #62 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Leo <sdl.web <at> gmail.com>
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: bug#2833: 23.0.92; Bug in Directory Variables
Date: Sat, 11 Apr 2009 11:31:48 -0400
I've checked the patch into CVS, with the change suggested by Stefan
(comparing the file mtime directly instead of comparing it to the system
time).

Does it solve the problem for you?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2833; Package emacs. (Sun, 12 Apr 2009 13:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 12 Apr 2009 13:30:04 GMT) Full text and rfc822 format available.

Message #67 received at 2833 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 2833 <at> debbugs.gnu.org
Subject: Re: bug#2833: 23.0.92; Bug in Directory Variables
Date: Sun, 12 Apr 2009 14:22:22 +0100
On 2009-04-11 16:31 +0100, Chong Yidong wrote:
> I've checked the patch into CVS, with the change suggested by Stefan
> (comparing the file mtime directly instead of comparing it to the system
> time).
>
> Does it solve the problem for you?

It worked perfectly. Many thanks.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system




bug closed, send any further explanations to Leo <sdl.web <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 12 Apr 2009 15:30:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Mon, 11 May 2009 14:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.