emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small change in image-dired.el


From: Mathias Dahl
Subject: Small change in image-dired.el
Date: Sat, 29 Mar 2008 21:08:21 +0100

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]