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

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

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


From: GNU bug Tracking System
Subject: bug#41222: closed (27.1; Auto-resizing of images in image-mode)
Date: Mon, 08 Jun 2020 00:32:02 +0000

Your message dated Mon, 08 Jun 2020 03:30:50 +0300
with message-id <87a71ez9dx.fsf@mail.linkov.net>
and subject line Re: bug#41222: 27.1; Auto-resizing of images in image-mode
has caused the debbugs.gnu.org bug report #41222,
regarding 27.1; Auto-resizing of images in image-mode
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
41222: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41222
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 27.1; Auto-resizing of images in image-mode Date: Wed, 13 May 2020 01:57:38 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
This is a followup to the emacs-devel thread
https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00777.html

I noticed that image-mode still lacks one needed command:
some image viewers have a menu item titled “Normal Size C-0” or
“Original Size C-0”.  Here's is the patch that implements it:

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 480b2e6b26..45007289c8 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,6 +522,8 @@ image-mode-map
         :help "Rotate the image"]
        ["Set Rotation..." image-transform-set-rotation
         :help "Set rotation angle of the image"]
+       ["Original Size" image-transform-original
+        :help "Reset image to original size"]
        ["Reset Transformations" image-transform-reset
         :help "Reset all image transformations"]
        "--"
@@ -1382,6 +1385,13 @@ 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 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."
   (interactive)


BTW, like ‘image-auto-resize-on-window-resize’ was added recently to
image-mode.el, is there a need to add a similar option to man.el
to allow customization of auto-resizing of Man buffers as well?
Maybe something like:

diff --git a/lisp/man.el b/lisp/man.el
index 5278a1a84d..a614cac536 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1579,7 +1579,8 @@ Man-mode
   (set (make-local-variable 'outline-level) (lambda () 1))
   (set (make-local-variable 'bookmark-make-record-function)
        'Man-bookmark-make-record)
-  (add-hook 'window-state-change-functions #'Man--window-state-change nil t))
+  (when Man-fit-to-window-on-window-resize
+    (add-hook 'window-state-change-functions #'Man--window-state-change nil 
t)))
 
 (defun Man-build-section-list ()
   "Build the list of manpage sections."



--- End Message ---
--- Begin Message --- Subject: Re: bug#41222: 27.1; Auto-resizing of images in image-mode Date: Mon, 08 Jun 2020 03:30:50 +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.

Now installed and closed.


--- End Message ---

reply via email to

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