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: help-debbugs <at> gnu.org (Emacs bug Tracking System)
To: Juri Linkov <juri <at> jurta.org>
Subject: bug#2295 closed by Juri Linkov <juri <at> jurta.org> (Re: bug#2295: 
 Viewing images with image-mode changes directory time)
Date: Thu, 12 Feb 2009 22:00:04 +0000
[Message part 1 (text/plain, inline)]
This is an automatic notification regarding your bug report
which was filed against the emacs package:

#2295: Viewing images with image-mode changes directory time

It has been closed by Juri Linkov <juri <at> jurta.org>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Juri Linkov <juri <at> jurta.org> by
replying to this email.


-- 
2295: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=2295
Emacs Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 2295-done <at> debbugs.gnu.org
Subject: Re: bug#2295: Viewing images with image-mode changes directory time
Date: Thu, 12 Feb 2009 23:49:52 +0200
>> 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.

Maybe it would be better (after the release) to improve
`add-text-properties' to not modify the current buffer
(with a new flag to keep the default behavior unchanged).
This is an old problem with buffers that don't save text properties,
so modifying them is meaningless and sometimes harmful.

> BTW, while you're there, change set-buffer-modified-p to
> restore-buffer-modified-p.

Done.

-- 
Juri Linkov
http://www.jurta.org/emacs/

[Message part 3 (message/rfc822, inline)]
From: Juri Linkov <juri <at> jurta.org>
To: emacs-pretest-bug <at> gnu.org
Subject: Viewing images with image-mode changes directory time
Date: Thu, 12 Feb 2009 00:55:48 +0200
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:

Index: lisp/image-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/image-mode.el,v
retrieving revision 1.55
diff -c -r1.55 image-mode.el
*** lisp/image-mode.el	7 Feb 2009 15:29:14 -0000	1.55
--- lisp/image-mode.el	11 Feb 2009 22:52:35 -0000
***************
*** 457,464 ****
  	   (buffer-undo-list t)
  	   (modified (buffer-modified-p)))
        (image-refresh image)
!       (add-text-properties (point-min) (point-max) props)
!       (set-buffer-modified-p modified)
        ;; Inhibit the cursor when the buffer contains only an image,
        ;; because cursors look very strange on top of images.
        (setq cursor-type nil)
--- 457,465 ----
  	   (buffer-undo-list t)
  	   (modified (buffer-modified-p)))
        (image-refresh image)
!       (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file
!         (add-text-properties (point-min) (point-max) props)
!         (set-buffer-modified-p modified))
        ;; Inhibit the cursor when the buffer contains only an image,
        ;; because cursors look very strange on top of images.
        (setq cursor-type nil)

-- 
Juri Linkov
http://www.jurta.org/emacs/



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.