* Small change in image-dired.el @ 2008-03-29 20:08 Mathias Dahl 2008-03-29 20:27 ` Stefan Monnier 0 siblings, 1 reply; 5+ messages in thread From: Mathias Dahl @ 2008-03-29 20:08 UTC (permalink / raw) To: emacs-devel When cleaning my mailbox I found an old request from Stefan Reichör asking if tumme (as it was called back then) could preserve the timestamp of rotated original files. He sent a patch which I implemented (although slightly changed) today. I made it customizable and by default it works as before, i.e. not preserving timestamp. If people are OK with the change, could someone check this in for me (it was a long time since I did any CVS commit and I don't want to mess up)? diff -c /home/mathias/image-dired.el /home/mathias/prj/emacs/lisp/image-dired.el *** /home/mathias/image-dired.el 2008-03-29 20:46:03.000000000 +0100 --- /home/mathias/prj/emacs/lisp/image-dired.el 2008-03-29 20:58:28.000000000 +0100 *************** *** 516,521 **** --- 516,528 ---- :type 'integer :group 'image-dired) + (defcustom image-dired-rotate-original-preserve-timestamp nil + "If non-nil, try to preserve the timestamp of the image file. + Used by `image-dired-rotate-original'. Requires the `touch' + program to work." + :type 'boolean + :group 'image-dired) + (defun image-dired-dir () "Return the current thumbnails directory (from variable `image-dired-dir'). Create the thumbnails directory if it does not exist." *************** *** 1923,1929 **** "Rotate to temp file OK. Overwrite original image? ")) (not image-dired-rotate-original-ask-before-overwrite)) (progn ! (copy-file image-dired-temp-rotate-image-file file t) (image-dired-refresh-thumb)) (image-dired-display-image file)))))) --- 1930,1942 ---- "Rotate to temp file OK. Overwrite original image? ")) (not image-dired-rotate-original-ask-before-overwrite)) (progn ! (let ((time-stamp (dired-touch-initial (list file))) ! touch-program) ! (copy-file image-dired-temp-rotate-image-file file t) ! (when (and image-dired-rotate-original-preserve-timestamp ! (setq touch-program (executable-find "touch"))) ! (call-process shell-file-name nil nil nil shell-command-switch ! (format "touch -t %s \"%s\"" time-stamp file)))) (image-dired-refresh-thumb)) (image-dired-display-image file)))))) Diff finished. Sat Mar 29 21:01:35 2008 /Mathias ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small change in image-dired.el 2008-03-29 20:08 Small change in image-dired.el Mathias Dahl @ 2008-03-29 20:27 ` Stefan Monnier 2008-03-29 21:27 ` Reiner Steib 2008-03-30 0:55 ` Mathias Dahl 0 siblings, 2 replies; 5+ messages in thread From: Stefan Monnier @ 2008-03-29 20:27 UTC (permalink / raw) To: Mathias Dahl; +Cc: emacs-devel > When cleaning my mailbox I found an old request from Stefan Reichör > asking if tumme (as it was called back then) could preserve the > timestamp of rotated original files. He sent a patch which I > implemented (although slightly changed) today. I made it customizable > and by default it works as before, i.e. not preserving timestamp. What is the rationale for such a "feature"? Generally, modifying a file and then changing its timestamp back to what it was is a good way to get in trouble (many programs assume that if the timestamp hasn't changed, then the file hasn't changed). Maybe some other feature can provide the same end result? E.g. maybe the file's content should hold the timestamp (in its metadata) instead? > If people are OK with the change, could someone check this in for me > (it was a long time since I did any CVS commit and I don't want to > mess up)? I'm not necessarily opposed to it, but I'd first like a compelling evidence that this is really the right way to solve the original problem. Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small change in image-dired.el 2008-03-29 20:27 ` Stefan Monnier @ 2008-03-29 21:27 ` Reiner Steib 2008-03-29 21:38 ` Stefan Monnier 2008-03-30 0:55 ` Mathias Dahl 1 sibling, 1 reply; 5+ messages in thread From: Reiner Steib @ 2008-03-29 21:27 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel, Mathias Dahl On Sat, Mar 29 2008, Stefan Monnier wrote: >> When cleaning my mailbox I found an old request from Stefan Reichör >> asking if tumme (as it was called back then) could preserve the >> timestamp of rotated original files. [...] > > What is the rationale for such a "feature"? When a picture from a digital camera has the wrong orientation, it might be useful to preserve the time stamp when fixing it. Not all programs honor the EXIF info or the camera might do it wrong (due to misconfiguration?). I don't know what the rationale was for Stefan R. Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small change in image-dired.el 2008-03-29 21:27 ` Reiner Steib @ 2008-03-29 21:38 ` Stefan Monnier 0 siblings, 0 replies; 5+ messages in thread From: Stefan Monnier @ 2008-03-29 21:38 UTC (permalink / raw) To: Mathias Dahl; +Cc: emacs-devel >>> When cleaning my mailbox I found an old request from Stefan Reichör >>> asking if tumme (as it was called back then) could preserve the >>> timestamp of rotated original files. [...] >> What is the rationale for such a "feature"? > When a picture from a digital camera has the wrong orientation, it > might be useful to preserve the time stamp when fixing it. Not all > programs honor the EXIF info or the camera might do it wrong (due to > misconfiguration?). If the program doesn't honor the EXIF info and uses the file's timestamp as "the time the photo was taken", then there's not much we can do and the time will often be wrong for whatever reason (e.g. you copied the files). So what we should do is check the EXIF info: if the photo's date is missing, we should take the file's timestamp and put it as the photo's date. Then we can go on and change the file's time stamp all we want. Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small change in image-dired.el 2008-03-29 20:27 ` Stefan Monnier 2008-03-29 21:27 ` Reiner Steib @ 2008-03-30 0:55 ` Mathias Dahl 1 sibling, 0 replies; 5+ messages in thread From: Mathias Dahl @ 2008-03-30 0:55 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel > What is the rationale for such a "feature"? See below. > Generally, modifying a file > and then changing its timestamp back to what it was is a good way to get > in trouble (many programs assume that if the timestamp hasn't changed, > then the file hasn't changed). Yes, I agree, mostly. > I'm not necessarily opposed to it, but I'd first like a compelling > evidence that this is really the right way to solve the > original problem. I think the only "problem" was that Stefan R was used to work in a certain way with his photos, and the rotation messed up with his scheme. I suspect for him that a rotation is an operation that can be neglected from a change viewpoint. Here is our original conversation: ---- from Stefan Reichör to Mathias Dahl date Sat, Jun 17, 2006 at 10:31 PM subject Improvement for tumme-rotate-original mailed-by utanet.at Hi Mathias! I try to use tumme to organize/view my photo collection. My photos all keep the timestamp when they were shot. I modified tumme-rotate-original in a way that the time stamp is preserved. It would be nice, if you could add this functionality! Stefan. [patch removed] from Mathias Dahl to Stefan Reichör date Sun, Jun 18, 2006 at 8:53 AM subject Re: Improvement for tumme-rotate-original mailed-by gmail.com Thanks for the patch, I'll think about it. Personally I never trust the timestamp of a file because I have found out too many times that it has been modified in transit, when copying, moving, FTPing, zipping, whatever... What I do instead is trust the EXIF data in it, make sure that it is always preserved (tumme does that by default). I also rename all the photos I take with my camera using the internal timestamp so that the names will be unique and sorted in the correct order in dired etc. Tumme has a command for this, `tumme-copy-with-exif-file-name'. Maybe that is something you would like to try? Also, the touch command is not available on w32 so this would have to be an option or we would have to find a suitable replacement command that works there. I suggest you keep your fix in your .emacs and I *might* try merge it into tumme.el when I have the time. Again, thanks for the suggestion! from Stefan Reichör to Mathias Dahl date Mon, Jun 19, 2006 at 6:23 AM subject Re: Improvement for tumme-rotate-original Hi Mathias! > Thanks for the patch, I'll think about it. Personally I never trust > the timestamp of a file because I have found out too many times that > it has been modified in transit, when copying, moving, FTPing, > zipping, whatever... What I do instead is trust the EXIF data in it, > make sure that it is always preserved (tumme does that by default). I > also rename all the photos I take with my camera using the internal > timestamp so that the names will be unique and sorted in the correct > order in dired etc. Tumme has a command for this, > `tumme-copy-with-exif-file-name'. Maybe that is something you would > like to try? Thanks for your ideas. I try to keep the date correct for my pictures. And that works for me. Thanks for the hint about the EXIF data. I also have a small python script to rename my pictures, using the date. It is nice to see that date on the back of the pictures when I order them from a photo shop. > Also, the touch command is not available on w32 so this would have to > be an option or we would have to find a suitable replacement command > that works there. You could try, if touch is available and use it only then. Something like tumme-has-touch-command. > I suggest you keep your fix in your .emacs and I *might* try merge it > into tumme.el when I have the time. That is fine with me. I think most users will prefer this behaviour. ---- As you can see, I too think EXIF should be trusted rather than the timestamp. Still, I thought the feature sounded OK to have and should not hurt anything, especially with the new variable introduced. Granted, even if the change is quite small, it increases complexity, so I won't argue about it being included. /Mathias ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-03-30 0:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-03-29 20:08 Small change in image-dired.el Mathias Dahl 2008-03-29 20:27 ` Stefan Monnier 2008-03-29 21:27 ` Reiner Steib 2008-03-29 21:38 ` Stefan Monnier 2008-03-30 0:55 ` Mathias Dahl
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).