unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Alan Third <alan@idiocy.org>
Cc: 41222@debbugs.gnu.org
Subject: bug#41222: 27.1; Auto-resizing of images in image-mode
Date: Thu, 21 May 2020 01:23:47 +0300	[thread overview]
Message-ID: <87sgfus0ss.fsf@mail.linkov.net> (raw)
In-Reply-To: <20200520201845.GA59177@breton.holly.idiocy.org> (Alan Third's message of "Wed, 20 May 2020 22:18:47 +0200 (CEST)")

>> 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	other threads:[~2020-05-20 22:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 22:57 bug#41222: 27.1; Auto-resizing of images in image-mode Juri Linkov
2020-05-14 20:46 ` Alan Third
2020-05-14 22:39   ` Juri Linkov
2020-05-15  6:28     ` Alan Third
2020-05-19 22:43       ` Juri Linkov
2020-05-20 20:18         ` Alan Third
2020-05-20 22:23           ` Juri Linkov [this message]
2020-06-08  0:30             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgfus0ss.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=41222@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).