* bug#2295: Viewing images with image-mode changes directory time @ 2009-02-11 22:55 ` Juri Linkov 2009-02-12 2:40 ` Stefan Monnier 2009-02-12 22:00 ` bug#2295: marked as done (Viewing images with image-mode changes directory time) Emacs bug Tracking System 0 siblings, 2 replies; 4+ messages in thread From: Juri Linkov @ 2009-02-11 22:55 UTC (permalink / raw) To: emacs-pretest-bug 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/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#2295: Viewing images with image-mode changes directory time 2009-02-11 22:55 ` bug#2295: Viewing images with image-mode changes directory time Juri Linkov @ 2009-02-12 2:40 ` Stefan Monnier 2012-09-28 16:59 ` bug#2295: Viewing archives with arc-mode " Juri Linkov 2009-02-12 22:00 ` bug#2295: marked as done (Viewing images with image-mode changes directory time) Emacs bug Tracking System 1 sibling, 1 reply; 4+ messages in thread From: Stefan Monnier @ 2009-02-12 2:40 UTC (permalink / raw) To: Juri Linkov; +Cc: emacs-pretest-bug, 2295 > 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. BTW, while you're there, change set-buffer-modified-p to restore-buffer-modified-p. Stefan ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#2295: Viewing archives with arc-mode changes directory time 2009-02-12 2:40 ` Stefan Monnier @ 2012-09-28 16:59 ` Juri Linkov 0 siblings, 0 replies; 4+ messages in thread From: Juri Linkov @ 2012-09-28 16:59 UTC (permalink / raw) To: Stefan Monnier; +Cc: 2295 >> 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)))) \f (defvar tar-mode-map (let ((map (make-keymap))) ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#2295: marked as done (Viewing images with image-mode changes directory time) 2009-02-11 22:55 ` bug#2295: Viewing images with image-mode changes directory time Juri Linkov 2009-02-12 2:40 ` Stefan Monnier @ 2009-02-12 22:00 ` Emacs bug Tracking System 1 sibling, 0 replies; 4+ messages in thread From: Emacs bug Tracking System @ 2009-02-12 22:00 UTC (permalink / raw) To: Juri Linkov [-- Attachment #1: Type: text/plain, Size: 900 bytes --] Your message dated Thu, 12 Feb 2009 23:49:52 +0200 with message-id <878wob496n.fsf@jurta.org> and subject line Re: bug#2295: Viewing images with image-mode changes directory time has caused the Emacs bug report #2295, regarding Viewing images with image-mode changes directory time to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com immediately.) -- 2295: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2295 Emacs Bug Tracking System Contact owner@emacsbugs.donarmstrong.com with problems [-- Attachment #2: Type: message/rfc822, Size: 3788 bytes --] From: Juri Linkov <juri@jurta.org> To: emacs-pretest-bug@gnu.org Subject: Viewing images with image-mode changes directory time Date: Thu, 12 Feb 2009 00:55:48 +0200 Message-ID: <873aepkksk.fsf@jurta.org> 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/ [-- Attachment #3: Type: message/rfc822, Size: 2234 bytes --] From: Juri Linkov <juri@jurta.org> To: Stefan Monnier <monnier@iro.umontreal.ca> Cc: 2295-done@emacsbugs.donarmstrong.com Subject: Re: bug#2295: Viewing images with image-mode changes directory time Date: Thu, 12 Feb 2009 23:49:52 +0200 Message-ID: <878wob496n.fsf@jurta.org> >> 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/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-28 16:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <878wob496n.fsf@jurta.org> 2009-02-11 22:55 ` bug#2295: Viewing images with image-mode changes directory time Juri Linkov 2009-02-12 2:40 ` Stefan Monnier 2012-09-28 16:59 ` bug#2295: Viewing archives with arc-mode " Juri Linkov 2009-02-12 22:00 ` bug#2295: marked as done (Viewing images with image-mode changes directory time) Emacs bug Tracking System
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.