[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#2295: Viewing archives with arc-mode changes directory time
From: |
Juri Linkov |
Subject: |
bug#2295: Viewing archives with arc-mode changes directory time |
Date: |
Fri, 28 Sep 2012 19:59:19 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) |
>> 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)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#2295: Viewing archives with arc-mode changes directory time,
Juri Linkov <=