* lisp/image-mode.el (image-transform-original): New command (bug#41222).
authorJuri Linkov <juri@linkov.net>
Mon, 8 Jun 2020 00:30:27 +0000 (03:30 +0300)
committerJuri Linkov <juri@linkov.net>
Mon, 8 Jun 2020 00:30:27 +0000 (03:30 +0300)
(image-mode-map): Bind it to "so" and add to menu.

lisp/image-mode.el

index 480b2e6b26e2f07b7a7d3a3b86943a2c8cc67771..b82c06691873688536b246d2a14030cacef5b9dc 100644 (file)
@@ -456,6 +456,7 @@ call."
     (define-key map "sb" 'image-transform-fit-both)
     (define-key map "ss" 'image-transform-set-scale)
     (define-key map "sr" 'image-transform-set-rotation)
+    (define-key map "so" 'image-transform-original)
     (define-key map "s0" 'image-transform-reset)
 
     ;; Multi-frame keys
@@ -521,8 +522,10 @@ call."
         :help "Rotate the image"]
        ["Set Rotation..." image-transform-set-rotation
         :help "Set rotation angle of the image"]
-       ["Reset Transformations" image-transform-reset
-        :help "Reset all image transformations"]
+       ["Original Size" image-transform-original
+        :help "Reset image to actual size"]
+       ["Reset to Default Size" image-transform-reset
+        :help "Reset all image transformations to initial size"]
        "--"
        ["Show Thumbnails"
         (lambda ()
@@ -1382,8 +1385,15 @@ ROTATION should be in degrees."
   (setq image-transform-rotation (float (mod rotation 360)))
   (image-toggle-display-image))
 
+(defun image-transform-original ()
+  "Display the current image with the original (actual) size and rotation."
+  (interactive)
+  (setq image-transform-resize nil
+       image-transform-scale 1)
+  (image-toggle-display-image))
+
 (defun image-transform-reset ()
-  "Display the current image with the default size and rotation."
+  "Display the current image with the default (initial) size and rotation."
   (interactive)
   (setq image-transform-resize image-auto-resize
        image-transform-rotation 0.0