GNU bug report logs - #2295
Viewing images with image-mode changes directory time

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Wed, 11 Feb 2009 23:25:04 UTC

Severity: normal

Tags: patch, pending

Merged with 10602

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2295 <at> debbugs.gnu.org
Subject: bug#2295: Viewing archives with arc-mode changes directory time
Date: Fri, 28 Sep 2012 19:59:19 +0300
>> Using image-mode to visit image files touches directory modification
>> dates.  This is especially annoying when image files are in an old
>> archive.  The problem is in the function `add-text-properties' that
>> temporarily modifies the image buffer causing lock-file to create a lock
>> file in the current directory that modifies the directory timestamp.
>>
>> As a solution I propose to let-bind `buffer-file-truename' to nil
>> around the call to `add-text-properties' to prevent directory time
>> modification:
>
> That sounds OK.  We should provide at least a macro for that.

I don't know how this macro could look, but there is exactly the same
problem in arc-mode and tar-mode.el.  Visiting an archive file modifies
the mtime of its directory.  This can be fixed with the same method
as used to fix image-mode (by binding buffer-file-truename to nil):

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2012-05-04 06:13:18 +0000
+++ lisp/arc-mode.el	2012-09-28 16:51:56 +0000
@@ -787,7 +789,8 @@ (defun archive-summarize (&optional shut
 Optional argument SHUT-UP, if non-nil, means don't print messages
 when parsing the archive."
   (widen)
-  (let ((inhibit-read-only t))
+  (let ((buffer-file-truename nil) ; avoid changing dir mtime by lock_file
+	(inhibit-read-only t))
     (setq archive-proper-file-start (copy-marker (point-min) t))
     (set (make-local-variable 'change-major-mode-hook) 'archive-desummarize)
     (or shut-up

=== modified file 'lisp/tar-mode.el'
--- lisp/tar-mode.el	2012-08-13 10:34:25 +0000
+++ lisp/tar-mode.el	2012-08-20 01:25:16 +0000
@@ -518,12 +518,13 @@ (defun tar-summarize-buffer ()
         (progress-reporter-done progress-reporter)
       (message "Warning: premature EOF parsing tar file"))
     (goto-char (point-min))
-    (let ((inhibit-read-only t)
+    (let ((buffer-file-truename nil) ; avoid changing dir mtime by lock_file
+	  (inhibit-read-only t)
           (total-summaries
            (mapconcat 'tar-header-block-summarize tar-parse-info "\n")))
-      (insert total-summaries "\n"))
+      (insert total-summaries "\n")
     (goto-char (point-min))
-    (restore-buffer-modified-p modified)))
+      (restore-buffer-modified-p modified))))
 
 (defvar tar-mode-map
   (let ((map (make-keymap)))





This bug report was last modified 10 years and 173 days ago.

Previous Next


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