GNU bug report logs -
#41222
27.1; Auto-resizing of images in image-mode
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 12 May 2020 23:00:02 UTC
Severity: minor
Tags: patch
Found in version 27.1
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41222 in the body.
You can then email your comments to 41222 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Tue, 12 May 2020 23:00:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 12 May 2020 23:00:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Thu, 14 May 2020 20:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 41222 <at> debbugs.gnu.org (full text, mbox):
On Wed, May 13, 2020 at 01:57:38AM +0300, Juri Linkov wrote:
> 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:
<snip>
> + ["Original Size" image-transform-original
> + :help "Reset image to original size"]
Hi Juri, this looks good to me, but I’m not sure about saying
"original size", as that may be mistaken for meaning the size it was
when it was loaded the first time.
Perhaps "actual size"? It’s not great, but I think less open to
interpretation than "original".
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Thu, 14 May 2020 22:44:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 41222 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> 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:
> <snip>
>> + ["Original Size" image-transform-original
>> + :help "Reset image to original size"]
>
> Hi Juri, this looks good to me, but I’m not sure about saying
> "original size", as that may be mistaken for meaning the size it was
> when it was loaded the first time.
It seems the correct term for the size of the image loaded the first
time would be "initial size"? Hmm, actually, the docstring of
'image-transform-reset' says the correct term for the initial size is
"default size".
> Perhaps "actual size"? It’s not great, but I think less open to
> interpretation than "original".
I don't know, some programs use "original size", some "normal size":
Xreader:
[xreader.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
Xviewer:
[xviewer.png (image/png, inline)]
[Message part 5 (text/plain, inline)]
And I found one program, namely Pix, that uses "actual size".
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Fri, 15 May 2020 06:29:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 41222 <at> debbugs.gnu.org (full text, mbox):
On Fri, May 15, 2020 at 01:39:55AM +0300, Juri Linkov wrote:
> >> 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:
> > <snip>
> >> + ["Original Size" image-transform-original
> >> + :help "Reset image to original size"]
> >
> > Hi Juri, this looks good to me, but I’m not sure about saying
> > "original size", as that may be mistaken for meaning the size it was
> > when it was loaded the first time.
>
> It seems the correct term for the size of the image loaded the first
> time would be "initial size"? Hmm, actually, the docstring of
> 'image-transform-reset' says the correct term for the initial size is
> "default size".
>
> > Perhaps "actual size"? It’s not great, but I think less open to
> > interpretation than "original".
>
> I don't know, some programs use "original size", some "normal size":
If you're happy enough it won't be a problem I won't argue. :)
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Tue, 19 May 2020 22:47:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 41222 <at> debbugs.gnu.org (full text, mbox):
>> >> 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:
>> > <snip>
>> >> + ["Original Size" image-transform-original
>> >> + :help "Reset image to original size"]
>> >
>> > Hi Juri, this looks good to me, but I’m not sure about saying
>> > "original size", as that may be mistaken for meaning the size it was
>> > when it was loaded the first time.
>>
>> It seems the correct term for the size of the image loaded the first
>> time would be "initial size"? Hmm, actually, the docstring of
>> 'image-transform-reset' says the correct term for the initial size is
>> "default size".
>>
>> > Perhaps "actual size"? It’s not great, but I think less open to
>> > interpretation than "original".
>>
>> I don't know, some programs use "original size", some "normal size":
>
> If you're happy enough it won't be a problem I won't argue. :)
Actually the problem is in consistency of these two menu items:
["Original Size" image-transform-original
:help "Reset image to original size"]
["Reset Transformations" image-transform-reset
:help "Reset all image transformations"]
image-transform-original resets to the actual/original/normal size.
image-transform-reset resets to the default size defined by image-auto-resize.
So they both should be fixed to be mutually consistent.
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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Wed, 20 May 2020 20:19:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 41222 <at> debbugs.gnu.org (full text, mbox):
On Wed, May 20, 2020 at 01:43:00AM +0300, Juri Linkov wrote:
> Actually the problem is in consistency of these two menu items:
>
> ["Original Size" image-transform-original
> :help "Reset image to original size"]
> ["Reset Transformations" image-transform-reset
> :help "Reset all image transformations"]
>
> image-transform-original resets to the actual/original/normal size.
> image-transform-reset resets to the default size defined by image-auto-resize.
>
> So they both should be fixed to be mutually consistent.
Hmm, yes, I can't tell which is which just from the menu name or even
the description.
> 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.
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41222
; Package
emacs
.
(Wed, 20 May 2020 22:41:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 41222 <at> debbugs.gnu.org (full text, mbox):
>> 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
Added tag(s) patch.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 25 May 2020 14:40:01 GMT)
Full text and
rfc822 format available.
Severity set to 'minor' from 'normal'
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 25 May 2020 14:40:01 GMT)
Full text and
rfc822 format available.
Reply sent
to
Juri Linkov <juri <at> linkov.net>
:
You have taken responsibility.
(Mon, 08 Jun 2020 00:32:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Juri Linkov <juri <at> linkov.net>
:
bug acknowledged by developer.
(Mon, 08 Jun 2020 00:32:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 41222-done <at> debbugs.gnu.org (full text, mbox):
>>> 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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 06 Jul 2020 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 352 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.