[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bc49375: image-dired: Make thumbnail rotation commands obsolete
From: |
Stefan Kangas |
Subject: |
master bc49375: image-dired: Make thumbnail rotation commands obsolete |
Date: |
Wed, 27 Oct 2021 20:05:27 -0400 (EDT) |
branch: master
commit bc4937539e48e5c9bdf17383744c5e0b560699ad
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
image-dired: Make thumbnail rotation commands obsolete
* lisp/image-dired.el (image-dired-cmd-rotate-thumbnail-program)
(image-dired-cmd-rotate-thumbnail-options)
(image-dired-rotate-thumbnail)
(image-dired-rotate-thumbnail-left)
(image-dired-rotate-thumbnail-right): Make obsolete in favor of
'image-dired-refresh-thumb' and 'image-rotate'. It makes no sense to
have destructive thumbnail rotation commands now that Emacs can rotate
thumbnails in memory, and it is very fast to just generate a new one
reflecting the rotation of the original.
(image-dired-thumbnail-mode-map): Remove menu entries and key bindings
for above obsolete commands. The rotate right keybinding had already
been made ineffective by the local keymap added by 'insert-image'.
---
etc/NEWS | 8 ++++-
lisp/image-dired.el | 97 +++++++++++++++++++++++++++--------------------------
2 files changed, 57 insertions(+), 48 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index e475a49..4f48cfb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -201,7 +201,7 @@ To improve security, if an sql product has
':password-in-comint' set
to t, a password supplied via the minibuffer will be sent in-process,
as opposed to via the command-line.
-** Image Dired
+** Image-Dired
---
*** Reduce dependency on external "exiftool" command.
@@ -242,6 +242,12 @@ as it used to be, back when entering a large directory
could lock up
Emacs for tens of seconds. In addition, you can now customize this
option to nil to disable this confirmation completely.
+---
+*** Make 'image-dired-rotate-thumbnail-(left|right)' obsolete.
+Instead, use 'M-x image-dired-refresh-thumb' to generate a new
+thumbnail, or 'M-x image-rotate' to rotate the thumbnail without
+updating the thumbnail file.
+
** Dired
---
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 122d8a5..fd3507a 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -376,25 +376,6 @@ Available format specifiers are the same as in
:version "26.1"
:type '(repeat (string :tag "Argument")))
-(defcustom image-dired-cmd-rotate-thumbnail-program
- (if (executable-find "gm") "gm" "mogrify")
- "Executable used to rotate thumbnail.
-Used together with `image-dired-cmd-rotate-thumbnail-options'."
- :type 'file
- :version "29.1")
-
-(defcustom image-dired-cmd-rotate-thumbnail-options
- (let ((opts '("-rotate" "%d" "%t")))
- (if (executable-find "gm") (cons "mogrify" opts) opts))
- "Arguments of command used to rotate thumbnail image.
-Used with `image-dired-cmd-rotate-thumbnail-program'.
-Available format specifiers are: %d which is replaced by the
-number of (positive) degrees to rotate the image, normally 90 or 270
-\(for 90 degrees right and left), %t which is replaced by the file name
-of the thumbnail file."
- :version "29.1"
- :type '(repeat (string :tag "Argument")))
-
(defcustom image-dired-cmd-rotate-original-program
"jpegtran"
"Executable used to rotate original image.
@@ -1651,8 +1632,6 @@ You probably want to use this together with
(define-key map "\C-m" 'image-dired-display-thumbnail-original-image)
(define-key map [C-return] 'image-dired-thumbnail-display-external)
- (define-key map "l" 'image-dired-rotate-thumbnail-left)
- (define-key map "r" 'image-dired-rotate-thumbnail-right)
(define-key map "L" 'image-dired-rotate-original-left)
(define-key map "R" 'image-dired-rotate-original-right)
@@ -1698,8 +1677,6 @@ You probably want to use this together with
["Dynamic line up" image-dired-line-up-dynamic]
["Line up thumbnails" image-dired-line-up]
- ["Rotate thumbnail left" image-dired-rotate-thumbnail-left]
- ["Rotate thumbnail right" image-dired-rotate-thumbnail-right]
["Rotate original left" image-dired-rotate-original-left]
["Rotate original right" image-dired-rotate-original-right]
@@ -2122,30 +2099,6 @@ With prefix argument ARG, display image in its original
size."
"Return non-nil if there is an `image-dired' thumbnail at point."
(get-text-property (point) 'image-dired-thumbnail))
-(defun image-dired-rotate-thumbnail (degrees)
- "Rotate thumbnail DEGREES degrees."
- (image-dired--check-executable-exists
- 'image-dired-cmd-rotate-thumbnail-program)
- (if (not (image-dired-image-at-point-p))
- (message "No thumbnail at point")
- (let* ((file (image-dired-thumb-name (image-dired-original-file-name)))
- (thumb (expand-file-name file))
- (spec (list (cons ?d degrees) (cons ?t thumb))))
- (apply #'call-process image-dired-cmd-rotate-thumbnail-program nil nil
nil
- (mapcar (lambda (arg) (format-spec arg spec))
- image-dired-cmd-rotate-thumbnail-options))
- (clear-image-cache thumb))))
-
-(defun image-dired-rotate-thumbnail-left ()
- "Rotate thumbnail left (counter clockwise) 90 degrees."
- (interactive)
- (image-dired-rotate-thumbnail "270"))
-
-(defun image-dired-rotate-thumbnail-right ()
- "Rotate thumbnail counter right (clockwise) 90 degrees."
- (interactive)
- (image-dired-rotate-thumbnail "90"))
-
(defun image-dired-refresh-thumb ()
"Force creation of new image for current thumbnail."
(interactive)
@@ -2912,6 +2865,56 @@ by the image file name and %t which is replaced by the
tag name."
(setq tag-value (buffer-substring (point-min) (point-max)))))
tag-value))
+(defcustom image-dired-cmd-rotate-thumbnail-program
+ (if (executable-find "gm") "gm" "mogrify")
+ "Executable used to rotate thumbnail.
+Used together with `image-dired-cmd-rotate-thumbnail-options'."
+ :type 'file
+ :version "29.1")
+(make-obsolete-variable 'image-dired-cmd-rotate-thumbnail-program nil "29.1")
+
+(defcustom image-dired-cmd-rotate-thumbnail-options
+ (let ((opts '("-rotate" "%d" "%t")))
+ (if (executable-find "gm") (cons "mogrify" opts) opts))
+ "Arguments of command used to rotate thumbnail image.
+Used with `image-dired-cmd-rotate-thumbnail-program'.
+Available format specifiers are: %d which is replaced by the
+number of (positive) degrees to rotate the image, normally 90 or 270
+\(for 90 degrees right and left), %t which is replaced by the file name
+of the thumbnail file."
+ :version "29.1"
+ :type '(repeat (string :tag "Argument")))
+(make-obsolete-variable 'image-dired-cmd-rotate-thumbnail-options nil "29.1")
+
+(defun image-dired-rotate-thumbnail (degrees)
+ "Rotate thumbnail DEGREES degrees."
+ (declare (obsolete image-dired-refresh-thumb "29.1"))
+ (image-dired--check-executable-exists
+ 'image-dired-cmd-rotate-thumbnail-program)
+ (if (not (image-dired-image-at-point-p))
+ (message "No thumbnail at point")
+ (let* ((file (image-dired-thumb-name (image-dired-original-file-name)))
+ (thumb (expand-file-name file))
+ (spec (list (cons ?d degrees) (cons ?t thumb))))
+ (apply #'call-process image-dired-cmd-rotate-thumbnail-program nil nil
nil
+ (mapcar (lambda (arg) (format-spec arg spec))
+ image-dired-cmd-rotate-thumbnail-options))
+ (clear-image-cache thumb))))
+
+(defun image-dired-rotate-thumbnail-left ()
+ "Rotate thumbnail left (counter clockwise) 90 degrees."
+ (declare (obsolete image-dired-refresh-thumb "29.1"))
+ (interactive)
+ (with-suppressed-warnings ((obsolete image-dired-rotate-thumbnail))
+ (image-dired-rotate-thumbnail "270")))
+
+(defun image-dired-rotate-thumbnail-right ()
+ "Rotate thumbnail counter right (clockwise) 90 degrees."
+ (declare (obsolete image-dired-refresh-thumb "29.1"))
+ (interactive)
+ (with-suppressed-warnings ((obsolete image-dired-rotate-thumbnail))
+ (image-dired-rotate-thumbnail "90")))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; TEST-SECTION ;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master bc49375: image-dired: Make thumbnail rotation commands obsolete,
Stefan Kangas <=