bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#41222: 27.1; Auto-resizing of images in image-mode


From: Juri Linkov
Subject: bug#41222: 27.1; Auto-resizing of images in image-mode
Date: Thu, 21 May 2020 01:23:47 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> One possible change is:
>> 
>>   "Original Size"
>>   "Reset to Default Size"
>> 
>> But when using "Actual Size" instead of "Original Size",
>> what would be a good title for the second menu item?
>
> I think "Default Size" size works in either case. I feel that Default
> strongly implies it will return to whatever size it would be when I
> first load the image, and that also clarifies what the other option
> will do.

I added both variants “Original/Actual” and “Default/Initial”
to menu title/help, and docstrings.  More tweaking is possible,
but it seems this is quite good now.

Eli, is it ok to install this finishing patch to emacs-27?

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 480b2e6b26..b82c066918 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -456,6 +456,7 @@ image-mode-map
     (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 @@ image-mode-map
         :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 @@ image-transform-set-rotation
   (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





reply via email to

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