* bug#28182: maybe implement CTRL++ to zoom text
@ 2017-08-22 3:05 積丹尼 Dan Jacobson
2017-08-22 12:30 ` Nathan Moreau
` (5 more replies)
0 siblings, 6 replies; 57+ messages in thread
From: 積丹尼 Dan Jacobson @ 2017-08-22 3:05 UTC (permalink / raw)
To: 28182
In most browsers, CTRL++ zooms text,
making it progressively bigger.
In emacs, one just gets
"C-= is undefined".
(CTRL+-, the reverse action, is bound to
negative-argument.)
Anyway, no matter what binding or not, there is apparently not command
yet to simply zoom text like in a browser. The best one can do is the
methods mentioned in (info "(emacs) Fonts").
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 3:05 積丹尼 Dan Jacobson
@ 2017-08-22 12:30 ` Nathan Moreau
2017-08-22 14:30 ` Eli Zaretskii
` (4 subsequent siblings)
5 siblings, 0 replies; 57+ messages in thread
From: Nathan Moreau @ 2017-08-22 12:30 UTC (permalink / raw)
To: 積丹尼 Dan Jacobson; +Cc: 28182
What about text-scale-adjust (C-x C-+ or C-x C-=) ?
On 22 August 2017 at 05:05, 積丹尼 Dan Jacobson <jidanni@jidanni.org> wrote:
> In most browsers, CTRL++ zooms text,
> making it progressively bigger.
> In emacs, one just gets
> "C-= is undefined".
>
> (CTRL+-, the reverse action, is bound to
> negative-argument.)
>
> Anyway, no matter what binding or not, there is apparently not command
> yet to simply zoom text like in a browser. The best one can do is the
> methods mentioned in (info "(emacs) Fonts").
>
>
>
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 3:05 積丹尼 Dan Jacobson
2017-08-22 12:30 ` Nathan Moreau
@ 2017-08-22 14:30 ` Eli Zaretskii
2017-08-23 14:16 ` Richard Stallman
2017-08-23 14:57 ` 積丹尼 Dan Jacobson
` (3 subsequent siblings)
5 siblings, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2017-08-22 14:30 UTC (permalink / raw)
To: 積丹尼 Dan Jacobson; +Cc: 28182
> From: 積丹尼 Dan Jacobson
> <jidanni@jidanni.org>
> Date: Tue, 22 Aug 2017 11:05:40 +0800
>
> In most browsers, CTRL++ zooms text,
> making it progressively bigger.
> In emacs, one just gets
> "C-= is undefined".
>
> (CTRL+-, the reverse action, is bound to
> negative-argument.)
>
> Anyway, no matter what binding or not, there is apparently not command
> yet to simply zoom text like in a browser. The best one can do is the
> methods mentioned in (info "(emacs) Fonts").
Did you try "C-x C-+"?
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 14:30 ` Eli Zaretskii
@ 2017-08-23 14:16 ` Richard Stallman
2017-08-23 17:55 ` Eli Zaretskii
2017-08-23 23:05 ` Tak Kunihiro
0 siblings, 2 replies; 57+ messages in thread
From: Richard Stallman @ 2017-08-23 14:16 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> Did you try "C-x C-+"?
I don't think it would occur to people to try that key sequence.
It's not what other programs use.
How about if we make C-+ and C-- do this, as they do in many
other programs?
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
[not found] ` <<E1dkWS3-0005Wd-6g@fencepost.gnu.org>
@ 2017-08-23 14:29 ` Drew Adams
0 siblings, 0 replies; 57+ messages in thread
From: Drew Adams @ 2017-08-23 14:29 UTC (permalink / raw)
To: rms, Eli Zaretskii; +Cc: 28182, jidanni
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > Did you try "C-x C-+"?
>
> I don't think it would occur to people to try that key sequence.
> It's not what other programs use.
>
> How about if we make C-+ and C-- do this, as they do in many
> other programs?
FWIW -
1. C-- (where it is supported) is the same as M-- and C-M--
(`negative-argument').
2. Lots of users no doubt bind C-+ (and C-=, because = is the
unshifted + key on many keyboards) for something else.
For example, I use C-= as a prefix key for comparison operations
(e.g. C-= b is ediff-buffers, C-= d is diff, C-= e is ediff-files,
and C-= w is compare-windows). I've suggested that Emacs do the
same out of the box, = being a good mnemonic for comparison.
(Yes, I know that existing user bindings don't count for much.
Just mentioning this.)
3. If we were to bind C-- and C-+ to as you suggest then we should
at least keep the C-x C-- and C-x C-+ (and C-x C-=) bindings as well.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 3:05 積丹尼 Dan Jacobson
2017-08-22 12:30 ` Nathan Moreau
2017-08-22 14:30 ` Eli Zaretskii
@ 2017-08-23 14:57 ` 積丹尼 Dan Jacobson
2017-08-23 15:55 ` Drew Adams
2017-08-23 16:05 ` 積丹尼 Dan Jacobson
` (2 subsequent siblings)
5 siblings, 1 reply; 57+ messages in thread
From: 積丹尼 Dan Jacobson @ 2017-08-23 14:57 UTC (permalink / raw)
To: Nathan Moreau, Richard Stallman, Eli Zaretskii; +Cc: 28182
All I know is we were taught to use "C-u -" for negative arguments,
therefore maybe C-- can be used to unzoom. And C-+ (C-=) is unbound at
the moment.
By the way currently on (info "(emacs) Text Scale") it says
The final key of these commands may be repeated without the leading
‘C-x’. For instance, ‘C-x C-= C-= C-=’ increases the face height by
three steps.
Perhaps it should also note C-x C-= = = does the same thing.
I also notice if text-scale-mode-step is exactly 1 and one trys C-x C-=
etc. text becomes very tiny. I suppose it was never expected that anyone
try that and maybe an error should be raised.
Anyway all these multiplication factors still leave no way for the user
to go from 12 to 13 to 14 to 15 ... point sizes.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-23 14:57 ` 積丹尼 Dan Jacobson
@ 2017-08-23 15:55 ` Drew Adams
0 siblings, 0 replies; 57+ messages in thread
From: Drew Adams @ 2017-08-23 15:55 UTC (permalink / raw)
To: 積丹尼 Dan Jacobson, Nathan Moreau,
Richard Stallman, Eli Zaretskii
Cc: 28182
> All I know is we were taught to use "C-u -" for negative arguments,
Don't follow everything you are taught. ;-)
> therefore maybe C-- can be used to unzoom. And C-+ (C-=) is unbound at
> the moment.
They are free, but there is no reason to waste them.
Leaving these commands on the C-x prefix makes sense. When the
last key is repeated the action is repeated, which is very quick.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 3:05 積丹尼 Dan Jacobson
` (2 preceding siblings ...)
2017-08-23 14:57 ` 積丹尼 Dan Jacobson
@ 2017-08-23 16:05 ` 積丹尼 Dan Jacobson
2017-08-23 16:19 ` Drew Adams
2017-08-23 23:11 ` 積丹尼 Dan Jacobson
2019-08-21 1:51 ` Stefan Kangas
5 siblings, 1 reply; 57+ messages in thread
From: 積丹尼 Dan Jacobson @ 2017-08-23 16:05 UTC (permalink / raw)
To: Drew Adams; +Cc: Nathan Moreau, Richard Stallman, 28182
>>>>> "DA" == Drew Adams <drew.adams@oracle.com> writes:
DA> They are free, but there is no reason to waste them.
Saving them for some future better commands despite many programs having
already reached a consensus on what they should do?
DA> Leaving these commands on the C-x prefix makes sense. When the
DA> last key is repeated the action is repeated, which is very quick.
All I know is please keep
C-x C-= runs the command text-scale-adjust
and add
C-= also runs the command text-scale-adjust...
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-23 16:05 ` 積丹尼 Dan Jacobson
@ 2017-08-23 16:19 ` Drew Adams
0 siblings, 0 replies; 57+ messages in thread
From: Drew Adams @ 2017-08-23 16:19 UTC (permalink / raw)
To: 積丹尼 Dan Jacobson
Cc: Nathan Moreau, Richard Stallman, 28182
> DA> They are free, but there is no reason to waste them.
>
> Saving them for some future better commands despite many programs
> having already reached a consensus on what they should do?
"Many programs" are not Emacs. Most programs do not use anywhere
near the number of key bindings Emacs uses (out of the box).
Binding keys by default is not something to do lightly.
"Many programs" use CUA keys too. Emacs does not, except by user
opt-in (`cua-mode'). That's the right approach, IMO.
> DA> Leaving these commands on the C-x prefix makes sense. When the
> DA> last key is repeated the action is repeated, which is very quick.
>
> All I know is please keep C-x C-= runs the command text-scale-adjust
> and add C-= also runs the command text-scale-adjust...
Yes to keeping C-x C-= as text-scale-adjust.
No, C-= does not current run text-scale-adjust; it is unbound.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-23 14:16 ` Richard Stallman
@ 2017-08-23 17:55 ` Eli Zaretskii
2017-08-23 23:05 ` Tak Kunihiro
1 sibling, 0 replies; 57+ messages in thread
From: Eli Zaretskii @ 2017-08-23 17:55 UTC (permalink / raw)
To: rms; +Cc: 28182, jidanni
> From: Richard Stallman <rms@gnu.org>
> CC: jidanni@jidanni.org, 28182@debbugs.gnu.org
> Date: Wed, 23 Aug 2017 10:16:11 -0400
>
> How about if we make C-+ and C-- do this, as they do in many
> other programs?
These keys are already taken for typing numerical argument. So I
don't think we should make such incompatible changes.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-23 14:16 ` Richard Stallman
2017-08-23 17:55 ` Eli Zaretskii
@ 2017-08-23 23:05 ` Tak Kunihiro
2017-08-23 23:23 ` Drew Adams
1 sibling, 1 reply; 57+ messages in thread
From: Tak Kunihiro @ 2017-08-23 23:05 UTC (permalink / raw)
To: Richard Stallman; +Cc: 28182, jidanni
Richard Stallman <rms@gnu.org> writes:
> > Did you try "C-x C-+"?
>
> I don't think it would occur to people to try that key sequence.
> It's not what other programs use.
>
> How about if we make C-+ and C-- do this, as they do in many
> other programs?
I think that people want to increase size of font when they are in an
environment with mouse. Thus I suggest <C-wheel-up> and <C-wheel-down>.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 3:05 積丹尼 Dan Jacobson
` (3 preceding siblings ...)
2017-08-23 16:05 ` 積丹尼 Dan Jacobson
@ 2017-08-23 23:11 ` 積丹尼 Dan Jacobson
2017-08-23 23:28 ` Drew Adams
2019-08-21 1:51 ` Stefan Kangas
5 siblings, 1 reply; 57+ messages in thread
From: 積丹尼 Dan Jacobson @ 2017-08-23 23:11 UTC (permalink / raw)
To: Drew Adams; +Cc: Nathan Moreau, Richard Stallman, 28182
This morning I finally switched from
$ xrandr --output DP-1 --mode 1920x1080 #to
$ xrandr --output DP-1 --mode 1680x1050
and now can read things comfortably again.
About that text zooming key binding stuff,
maybe make them part (info "(emacs) CUA Bindings").
That seems where the CTRL++ and CTRL+- overrides belong.
If the user is rebinding C-c and C-x etc. then he probably also wants
the zoom overrides for CTRL++ and CTRL+- he is familiar with.
(I'm not exactly sure how close all this is to
https://en.wikipedia.org/wiki/IBM_Common_User_Access etc.)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-23 23:05 ` Tak Kunihiro
@ 2017-08-23 23:23 ` Drew Adams
0 siblings, 0 replies; 57+ messages in thread
From: Drew Adams @ 2017-08-23 23:23 UTC (permalink / raw)
To: Tak Kunihiro, Richard Stallman; +Cc: 28182, jidanni
> I think that people want to increase size of font when they are in an
> environment with mouse. Thus I suggest <C-wheel-up> and <C-wheel-down>.
+1.
FWIW, I do that in zoom-frm.el.
Commands `zoom-in' and `zoom-out' can do text-scaling or frame-zooming,
depending on the value of variable `zoom-frame/buffer' (which you can
toggle with a prefix arg for the command).
(global-set-key [S-mouse-1] 'zoom-in)
(global-set-key [C-S-mouse-1] 'zoom-out)
(global-set-key (vector (list 'control mouse-wheel-down-event)) 'zoom-in)
(global-set-key (vector (list 'control mouse-wheel-up-event)) 'zoom-out)
And in/out command `zoom-in/out':
(define-key ctl-x-map [(control ?+)] 'zoom-in/out)
(define-key ctl-x-map [(control ?-)] 'zoom-in/out)
(define-key ctl-x-map [(control ?=)] 'zoom-in/out)
(define-key ctl-x-map [(control ?0)] 'zoom-in/out)
https://www.emacswiki.org/emacs/download/zoom-frm.el
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-23 23:11 ` 積丹尼 Dan Jacobson
@ 2017-08-23 23:28 ` Drew Adams
0 siblings, 0 replies; 57+ messages in thread
From: Drew Adams @ 2017-08-23 23:28 UTC (permalink / raw)
To: 積丹尼 Dan Jacobson
Cc: Nathan Moreau, Richard Stallman, 28182
> About that text zooming key binding stuff,
> maybe make them part (info "(emacs) CUA Bindings").
> That seems where the CTRL++ and CTRL+- overrides belong.
> If the user is rebinding C-c and C-x etc. then he probably also wants
> the zoom overrides for CTRL++ and CTRL+- he is familiar with.
>
> (I'm not exactly sure how close all this is to
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__en.wikipedia.org_wiki_IBM-5FCommon-5FUser-
> 5FAccess&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=qZLZosY6GB
> AaJtOG9v8QX7nD4BS9t9s5otgxC3d4IFU&m=7BofVf_jmEndxuMwgszZM4WqfVkdKiqE6m48YHoX
> OHw&s=C6n8ANAX45ayIUggDjIsrtZrB9LnLneshTs6eBpF59o&e= etc.)
As you hint in your last paragraph, I don't think this has
anything to do with CUA.
Just as I argue that Emacs's cl.el should not have extraneous
stuff that has nothing to do with Common Lisp (which it has
gotten, little by little), so I'd argue that text-scaling
should not be added to `cua-mode'. If you want to create
another minor mode that uses those keys for text-scaling,
that's OK by me.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2017-08-22 3:05 積丹尼 Dan Jacobson
` (4 preceding siblings ...)
2017-08-23 23:11 ` 積丹尼 Dan Jacobson
@ 2019-08-21 1:51 ` Stefan Kangas
2019-08-21 2:12 ` Drew Adams
5 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-08-21 1:51 UTC (permalink / raw)
To: Tak Kunihiro
Cc: Richard Stallman, 28182, 積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
tags 28182 + patch
quit
Tak Kunihiro <homeros.misasa@gmail.com> writes:
> Richard Stallman <rms@gnu.org> writes:
>
>> > Did you try "C-x C-+"?
>>
>> I don't think it would occur to people to try that key sequence.
>> It's not what other programs use.
>>
>> How about if we make C-+ and C-- do this, as they do in many
>> other programs?
>
> I think that people want to increase size of font when they are in an
> environment with mouse. Thus I suggest <C-wheel-up> and <C-wheel-down>.
I think this is a good idea, which has the usability benefit to mirror
what happens in many common browsers, and other common text editors.
I remember myself that I was struggling to find the binding to change
the font size when I was an Emacs beginner.
I have implemented this suggestion in the attached patch.
However, this will be an incompatible change, since this was
previously bound to scrolling up and down by close to a full screen.
I therefore moved that binding to the meta modifier and wrote a NEWS
item that explains how to get the old functionality back.
How does it look?
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Bind-changing-font-size-to-C-mouse-4-and-C-mouse-5.patch --]
[-- Type: text/x-patch, Size: 2594 bytes --]
From 698a00393dbb119a56e70ee6da71993a6b2901f3 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 21 Aug 2019 03:38:49 +0200
Subject: [PATCH] Bind changing font size to C-mouse-4 and C-mouse-5
* lisp/mouse.el ([C-mouse-4], [C-mouse-5]): Bind to
text-scale-increase and text-scale-decrease. (Bug#28182)
* lisp/mwheel.el (mouse-wheel-scroll-amount): Use the meta modifier
for scrolling by near full screen instead of control.
* etc/NEWS: Announce it.
---
etc/NEWS | 14 ++++++++++++++
lisp/mouse.el | 3 +++
lisp/mwheel.el | 2 +-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index 56e5fd2f83..f15fc81314 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2021,6 +2021,20 @@ valid event type.
---
** The obsolete package xesam.el (since Emacs 24) has been removed.
+---
+** 'C-mouse-4' and 'C-mouse-5' will now decrease or increase the font size.
+This commonly corresponds to holding the control key and using the
+scroll wheel available on many mice.
+
+Previously, the control key modifier was used to scroll up or down by
+an amount which was close to near a full screen. This functionality
+is now instead available by holding down the meta modifier key. You
+can get the old functionality back by adding the following to your
+Emacs init file:
+
+(customize-set-variable 'mouse-wheel-scroll-amount
+ '(5 ((shift) . 1) ((control) . nil)))
+
\f
* Lisp Changes in Emacs 27.1
diff --git a/lisp/mouse.el b/lisp/mouse.el
index e947e16d47..4b1afe261d 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -2728,6 +2728,9 @@ function-key-map
(mouse-menu-bar-map)
(mouse-menu-major-mode-map)))))
+(global-set-key [C-mouse-4] 'text-scale-increase)
+(global-set-key [C-mouse-5] 'text-scale-decrease)
+
;; Binding mouse-1 to mouse-select-window when on mode-, header-, or
;; vertical-line prevents Emacs from signaling an error when the mouse
;; button is released after dragging these lines, on non-toolkit
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index dfea55374b..d75c1d88c1 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -84,7 +84,7 @@ mouse-wheel-inhibit-click-time
:group 'mouse
:type 'number)
-(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((control) . nil))
+(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((meta) . nil))
"Amount to scroll windows by when spinning the mouse wheel.
This is an alist mapping the modifier key to the amount to scroll when
the wheel is moved with the modifier key depressed.
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-08-21 1:51 ` Stefan Kangas
@ 2019-08-21 2:12 ` Drew Adams
2019-08-21 13:19 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Drew Adams @ 2019-08-21 2:12 UTC (permalink / raw)
To: Stefan Kangas, Tak Kunihiro
Cc: Richard Stallman, 28182, 積丹尼 Dan Jacobson
> I think this is a good idea, which has the usability benefit to mirror
> what happens in many common browsers, and other common text editors.
> I remember myself that I was struggling to find the binding to change
> the font size when I was an Emacs beginner.
>
> I have implemented this suggestion in the attached patch.
>
> However, this will be an incompatible change, since this was
> previously bound to scrolling up and down by close to a full screen.
> I therefore moved that binding to the meta modifier and wrote a NEWS
> item that explains how to get the old functionality back.
>
> How does it look?
I'm not sure that mouse-4 and mouse-5 have that meaning
for all mice and platforms. Some mice have separate
mouse-4 and mouse-5 buttons.
I think this is the right way to do it:
(global-set-key (vector (list 'control mouse-wheel-up-event))
'text-scale-increase))
(global-set-key (vector (list 'control mouse-wheel-down-event))
'text-scale-decrease))
I've been using that for years, and I use it all the time.
---
But I bind them to `zoom-in' and `zoom-out', which can
zoom either the buffer (via `text-scale-(in|de)crease)
or the frame (via `zoom-frm-(in|out)'). A prefix arg
toggles between buffer and frame zooming.
https://www.emacswiki.org/emacs/download/zoom-frm.el
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-08-21 2:12 ` Drew Adams
@ 2019-08-21 13:19 ` Stefan Kangas
2019-08-24 22:06 ` Juri Linkov
0 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-08-21 13:19 UTC (permalink / raw)
To: Drew Adams
Cc: Tak Kunihiro, Richard Stallman, 28182,
積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]
Drew Adams <drew.adams@oracle.com> writes:
> > I think this is a good idea, which has the usability benefit to mirror
> > what happens in many common browsers, and other common text editors.
> > I remember myself that I was struggling to find the binding to change
> > the font size when I was an Emacs beginner.
> >
> > I have implemented this suggestion in the attached patch.
> >
> > However, this will be an incompatible change, since this was
> > previously bound to scrolling up and down by close to a full screen.
> > I therefore moved that binding to the meta modifier and wrote a NEWS
> > item that explains how to get the old functionality back.
> >
> > How does it look?
>
> I'm not sure that mouse-4 and mouse-5 have that meaning
> for all mice and platforms. Some mice have separate
> mouse-4 and mouse-5 buttons.
Thanks. Your comment made me realize that my entire approach had been
a bit naive. I've now reworked the patch to only enable these key
bindings when mouse-wheel-mode is enabled, and added a defcustom to
change which modifier the font size functionality will use (or to
optionally disable it completely).
One small comment regarding the patch. We could perhaps get away with
not adding the defvar mwheel-installed-text-scale-bindings, but I
added that to make sure that we don't accidentally remove any key
bindings we didn't mean to. I might be too defensive here, though, so
please let me know if simpler code is preferred here over this level
of cautiousness.
Thanks,
Stefan Kangas
[-- Attachment #2: 0001-Bind-changing-font-size-to-mouse-wheel-up-and-down.patch --]
[-- Type: text/x-patch, Size: 5521 bytes --]
From c87f900d71d3fdbd7fe3703bd22c3e738e973dd9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 21 Aug 2019 03:38:49 +0200
Subject: [PATCH] Bind changing font size to mouse wheel up and down
* lisp/mouse.el (mouse-wheel-down-event, mouse-wheel-up-event): Bind
to text-scale-increase and text-scale-decrease. (Bug#28182)
* lisp/mwheel.el (mouse-wheel-scroll-amount): Use the meta modifier
for scrolling by near full screen instead of control.
* etc/NEWS: Announce it.
---
etc/NEWS | 14 ++++++++++++++
lisp/mwheel.el | 49 ++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 3fdc185af4..3cdf7b2866 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2026,6 +2026,20 @@ valid event type.
---
** The obsolete package xesam.el (since Emacs 24) has been removed.
+---
+** Mouse scroll up and down with control key modifier changes font size.
+Previously, the control key modifier was used to scroll up or down by
+an amount which was close to near a full screen. This functionality
+is now instead available by scrolling with the meta modifier key.
+
+You can get the old functionality back by customizing the variables
+'mouse-wheel-font-size-modifier-key' and 'mouse-wheel-scroll-amount',
+or adding the following to your Emacs init file:
+
+(customize-set-variable 'mouse-wheel-font-size-modifier-key nil)
+(customize-set-variable 'mouse-wheel-scroll-amount
+ '(5 ((shift) . 1) ((control) . nil)))
+
\f
* Lisp Changes in Emacs 27.1
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index dfea55374b..2eb67be916 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -84,7 +84,7 @@ mouse-wheel-inhibit-click-time
:group 'mouse
:type 'number)
-(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((control) . nil))
+(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((meta) . nil))
"Amount to scroll windows by when spinning the mouse wheel.
This is an alist mapping the modifier key to the amount to scroll when
the wheel is moved with the modifier key depressed.
@@ -120,6 +120,17 @@ mouse-wheel-scroll-amount
(float :tag "Fraction of window")))))
:set 'mouse-wheel-change-button)
+(defcustom mouse-wheel-font-size-modifier-key 'control
+ "Modifier key to use for changing font size using mouse wheel.
+If nil, do not set up bindings for changing the font size."
+ :group 'mouse
+ :type '(choice :tag "modifier"
+ (const alt) (const control) (const hyper)
+ (const meta) (const shift) (const super)
+ (const nil))
+ :set 'mouse-wheel-change-button
+ :version "27.1")
+
(defcustom mouse-wheel-progressive-speed t
"If non-nil, the faster the user moves the wheel, the faster the scrolling.
Note that this has no effect when `mouse-wheel-scroll-amount' specifies
@@ -306,6 +317,15 @@ mwheel-scroll
(put 'mwheel-scroll 'scroll-command t)
(defvar mwheel-installed-bindings nil)
+(defvar mwheel-installed-text-scale-bindings nil)
+
+(defun mouse-wheel--remove-bindings (bindings funs)
+ "Remove key BINDINGS if they're bound to any function in FUNS.
+BINDINGS is a list of key bindings, FUNS is a list of functions.
+This is a helper function for `mouse-wheel-mode'."
+ (dolist (key bindings)
+ (when (memq (lookup-key (current-global-map) key) funs)
+ (global-unset-key key))))
(define-minor-mode mouse-wheel-mode
"Toggle mouse wheel support (Mouse Wheel mode)."
@@ -318,17 +338,32 @@ mouse-wheel-mode
:global t
:group 'mouse
;; Remove previous bindings, if any.
- (while mwheel-installed-bindings
- (let ((key (pop mwheel-installed-bindings)))
- (when (eq (lookup-key (current-global-map) key) 'mwheel-scroll)
- (global-unset-key key))))
+ (mouse-wheel--remove-bindings mwheel-installed-bindings
+ '(mwheel-scroll))
+ (mouse-wheel--remove-bindings mwheel-installed-text-scale-bindings
+ '(text-scale-increase
+ text-scale-decrease))
+ (setq mwheel-installed-bindings nil)
+ (setq mwheel-installed-text-scale-bindings nil)
;; Setup bindings as needed.
(when mouse-wheel-mode
- (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event mouse-wheel-right-event mouse-wheel-left-event))
+ ;; Bindings for scrolling.
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
+ mouse-wheel-right-event mouse-wheel-left-event))
(dolist (key (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,event)])
mouse-wheel-scroll-amount))
(global-set-key key 'mwheel-scroll)
- (push key mwheel-installed-bindings)))))
+ (push key mwheel-installed-bindings)))
+ ;; Bindings for changing font size.
+ (when mouse-wheel-font-size-modifier-key
+ (let ((increase-key `[,(list mouse-wheel-font-size-modifier-key
+ mouse-wheel-down-event)])
+ (decrease-key `[,(list mouse-wheel-font-size-modifier-key
+ mouse-wheel-up-event)]))
+ (global-set-key increase-key 'text-scale-increase)
+ (global-set-key decrease-key 'text-scale-decrease)
+ (push increase-key mwheel-installed-text-scale-bindings)
+ (push decrease-key mwheel-installed-text-scale-bindings)))))
;;; Compatibility entry point
;; preloaded ;;;###autoload
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-08-21 13:19 ` Stefan Kangas
@ 2019-08-24 22:06 ` Juri Linkov
2019-08-27 0:40 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Juri Linkov @ 2019-08-24 22:06 UTC (permalink / raw)
To: Stefan Kangas
Cc: Tak Kunihiro, Richard Stallman, 28182,
積丹尼 Dan Jacobson
> One small comment regarding the patch. We could perhaps get away with
> not adding the defvar mwheel-installed-text-scale-bindings, but I
> added that to make sure that we don't accidentally remove any key
> bindings we didn't mean to. I might be too defensive here, though, so
> please let me know if simpler code is preferred here over this level
> of cautiousness.
Nice change. Another variant is to add special symbols to
the existing customization, e.g.:
'(5 ((shift) . 1) ((control) . text-scale) ((meta) . nil))
or even support text-scale step number if needed:
'(5 ((shift) . 1) ((control) . (text-scale . 1)) ((meta) . nil))
This is similar to what I proposed with
'((shift) . (hscroll . 1))
to scroll horizontally like Shift-wheel does in web browsers:
https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00202.html
Also please look at discussions for other related requests:
https://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00529.html
https://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00797.html
https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00129.html
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-08-24 22:06 ` Juri Linkov
@ 2019-08-27 0:40 ` Stefan Kangas
2019-08-27 21:13 ` Juri Linkov
0 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-08-27 0:40 UTC (permalink / raw)
To: Juri Linkov
Cc: Tak Kunihiro, Richard Stallman, 28182,
積丹尼 Dan Jacobson
Juri Linkov <juri@linkov.net> writes:
> Nice change.
Glad you like it.
> Another variant is to add special symbols to
> the existing customization, e.g.:
>
> '(5 ((shift) . 1) ((control) . text-scale) ((meta) . nil))
>
> or even support text-scale step number if needed:
>
> '(5 ((shift) . 1) ((control) . (text-scale . 1)) ((meta) . nil))
I like your idea that this would all be defined in one place.
One nit is that the variable name there is mouse-wheel-scroll-amount,
and I'm not sure this is the best name for functionality to change the
font size. If we go ahead with that, perhaps it should be renamed to
something like mouse-wheel-scroll-modifiers?
> This is similar to what I proposed with
>
> '((shift) . (hscroll . 1))
>
> to scroll horizontally like Shift-wheel does in web browsers:
>
> https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00202.html
Thanks for pointing that out. AFAICT that was never merged?
> Also please look at discussions for other related requests:
>
> https://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00529.html
> https://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00797.html
> https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00129.html
Thanks.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-08-27 0:40 ` Stefan Kangas
@ 2019-08-27 21:13 ` Juri Linkov
2019-09-28 13:09 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Juri Linkov @ 2019-08-27 21:13 UTC (permalink / raw)
To: Stefan Kangas
Cc: Tak Kunihiro, Richard Stallman, 28182,
積丹尼 Dan Jacobson
>> Another variant is to add special symbols to
>> the existing customization, e.g.:
>>
>> '(5 ((shift) . 1) ((control) . text-scale) ((meta) . nil))
>>
>> or even support text-scale step number if needed:
>>
>> '(5 ((shift) . 1) ((control) . (text-scale . 1)) ((meta) . nil))
>
> I like your idea that this would all be defined in one place.
>
> One nit is that the variable name there is mouse-wheel-scroll-amount,
> and I'm not sure this is the best name for functionality to change the
> font size. If we go ahead with that, perhaps it should be renamed to
> something like mouse-wheel-scroll-modifiers?
It looks like mouse-wheel-scroll-amount still makes some sense
as using wheel-scrolling to change the amount of font pixels.
Generally it's better to refrain from renaming old customisable
variables when possible.
>> This is similar to what I proposed with
>>
>> '((shift) . (hscroll . 1))
>>
>> to scroll horizontally like Shift-wheel does in web browsers:
>>
>> https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00202.html
>
> Thanks for pointing that out. AFAICT that was never merged?
Alas, that was never merged, but I still miss this functionality.
Maybe now there is another chance first to implement ((control) . text-scale)
and then duplicate the same functionality for ((shift) . (hscroll . 1))
>> Also please look at discussions for other related requests:
>>
>> https://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00529.html
>> https://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00797.html
>> https://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00129.html
>
> Thanks.
These are more about changing the numeric values for smoother scrolling,
I already customized to the suggested values, and scrolling is really
smoother, but I'm not sure about changing the default values.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-08-27 21:13 ` Juri Linkov
@ 2019-09-28 13:09 ` Stefan Kangas
2019-09-28 13:48 ` Eli Zaretskii
0 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-09-28 13:09 UTC (permalink / raw)
To: Juri Linkov
Cc: Tak Kunihiro, Richard Stallman, 28182,
積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]
Juri Linkov <juri@linkov.net> writes:
> >> Another variant is to add special symbols to
> >> the existing customization, e.g.:
> >>
> >> '(5 ((shift) . 1) ((control) . text-scale) ((meta) . nil))
> >>
> >> or even support text-scale step number if needed:
> >>
> >> '(5 ((shift) . 1) ((control) . (text-scale . 1)) ((meta) . nil))
> >
> > I like your idea that this would all be defined in one place.
> >
> > One nit is that the variable name there is mouse-wheel-scroll-amount,
> > and I'm not sure this is the best name for functionality to change the
> > font size. If we go ahead with that, perhaps it should be renamed to
> > something like mouse-wheel-scroll-modifiers?
>
> It looks like mouse-wheel-scroll-amount still makes some sense
> as using wheel-scrolling to change the amount of font pixels.
> Generally it's better to refrain from renaming old customisable
> variables when possible.
I've attached a tentative patch along those lines. WDYT?
I'm not sure exactly how to reformulate the doc string for
mouse-wheel-scroll-amount to fit the new behaviour. I'll have to
think about it a bit more. Do let me know if you have any ideas.
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Support-changing-font-size-using-mouse-wheel.patch --]
[-- Type: text/x-patch, Size: 8021 bytes --]
From 974f0b8492684af35db21b1d8efe35dc94b0d491 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 21 Aug 2019 03:38:49 +0200
Subject: [PATCH] Support changing font size using mouse wheel
* lisp/mwheel.el (mouse-wheel-mode): Support changing font size (text
scaling) using mouse wheel. (Bug#28182)
(mouse-wheel-scroll-amount): Bind the Ctrl modifier to text scaling.
(mwheel-installed-text-scale-bindings): New variable.
(mouse-wheel--remove-bindings): New helper function for
'mouse-wheel-mode'.
* doc/emacs/frames.texi (Mouse Commands): Document this feature.
* etc/NEWS: Announce it.
---
doc/emacs/frames.texi | 10 +++---
etc/NEWS | 12 ++++++++
lisp/mwheel.el | 72 ++++++++++++++++++++++++++++++-------------
3 files changed, 69 insertions(+), 25 deletions(-)
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 367ac43a0a..1f4aa95c87 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -200,10 +200,12 @@ Mouse Commands
@vindex mouse-wheel-progressive-speed
Some mice have a ``wheel'' which can be used for scrolling. Emacs
supports scrolling windows with the mouse wheel, by default, on most
-graphical displays. To toggle this feature, use @kbd{M-x
-mouse-wheel-mode}. The variables @code{mouse-wheel-follow-mouse} and
-@code{mouse-wheel-scroll-amount} determine where and by how much
-buffers are scrolled. The variable
+graphical displays. There is also support for increasing or
+decreasing the height of the default face, by default bound to
+scrolling with the @key{Ctrl} modifier. To toggle this feature, use
+@kbd{M-x mouse-wheel-mode}. The variables
+@code{mouse-wheel-follow-mouse} and @code{mouse-wheel-scroll-amount}
+determine where and by how much buffers are scrolled. The variable
@code{mouse-wheel-progressive-speed} determines whether the scroll
speed is linked to how fast you move the wheel.
diff --git a/etc/NEWS b/etc/NEWS
index 3fdc185af4..6831167c4d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2026,6 +2026,18 @@ valid event type.
---
** The obsolete package xesam.el (since Emacs 24) has been removed.
++++
+** Mouse scroll up and down with control key modifier changes font size.
+Previously, the control key modifier was used to scroll up or down by
+an amount which was close to near a full screen. This is now instead
+available by scrolling with the meta modifier key.
+
+To get the old behaviour back, customize the variable
+'mouse-wheel-scroll-amount', or add the following to your init file:
+
+(customize-set-variable 'mouse-wheel-scroll-amount
+ '(5 ((shift) . 1) ((control) . nil)))
+
\f
* Lisp Changes in Emacs 27.1
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index dfea55374b..6e469ca698 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -84,17 +84,22 @@ mouse-wheel-inhibit-click-time
:group 'mouse
:type 'number)
-(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((control) . nil))
+(defcustom mouse-wheel-scroll-amount
+ '(5 ((shift) . 1) ((meta) . nil) ((control) . text-scale))
"Amount to scroll windows by when spinning the mouse wheel.
This is an alist mapping the modifier key to the amount to scroll when
the wheel is moved with the modifier key depressed.
-Elements of the list have the form (MODIFIERS . AMOUNT) or just AMOUNT if
-MODIFIERS is nil.
+Elements of the list have the form (MODIFIER . AMOUNT) or just AMOUNT if
+MODIFIER is nil.
AMOUNT should be the number of lines to scroll, or nil for near full
screen. It can also be a floating point number, specifying the fraction of
a full screen to scroll. A near full screen is `next-screen-context-lines'
-less than a full screen."
+less than a full screen.
+
+If AMOUNT is the symbol text-scale, this means that with
+MODIFIER, the mouse wheel will change the face height instead of
+scrolling."
:group 'mouse
:type '(cons
(choice :tag "Normal"
@@ -105,19 +110,20 @@ mouse-wheel-scroll-amount
(repeat (choice :tag "modifier"
(const alt) (const control) (const hyper)
(const meta) (const shift) (const super)))
- (choice :tag "scroll amount"
- (const :tag "Full screen" :value nil)
- (integer :tag "Specific # of lines")
- (float :tag "Fraction of window"))))
+ (choice :tag "action"
+ (const :tag "Scroll full screen" :value nil)
+ (integer :tag "Scroll specific # of lines")
+ (float :tag "Scroll fraction of window"))))
(repeat
(cons
(repeat (choice :tag "modifier"
(const alt) (const control) (const hyper)
(const meta) (const shift) (const super)))
- (choice :tag "scroll amount"
- (const :tag "Full screen" :value nil)
- (integer :tag "Specific # of lines")
- (float :tag "Fraction of window")))))
+ (choice :tag "action"
+ (const :tag "Scroll full screen" :value nil)
+ (integer :tag "Scroll specific # of lines")
+ (float :tag "Scroll fraction of window")
+ (const :tag "Change face size" :value text-scale)))))
:set 'mouse-wheel-change-button)
(defcustom mouse-wheel-progressive-speed t
@@ -306,6 +312,15 @@ mwheel-scroll
(put 'mwheel-scroll 'scroll-command t)
(defvar mwheel-installed-bindings nil)
+(defvar mwheel-installed-text-scale-bindings nil)
+
+(defun mouse-wheel--remove-bindings (bindings funs)
+ "Remove key BINDINGS if they're bound to any function in FUNS.
+BINDINGS is a list of key bindings, FUNS is a list of functions.
+This is a helper function for `mouse-wheel-mode'."
+ (dolist (key bindings)
+ (when (memq (lookup-key (current-global-map) key) funs)
+ (global-unset-key key))))
(define-minor-mode mouse-wheel-mode
"Toggle mouse wheel support (Mouse Wheel mode)."
@@ -318,17 +333,32 @@ mouse-wheel-mode
:global t
:group 'mouse
;; Remove previous bindings, if any.
- (while mwheel-installed-bindings
- (let ((key (pop mwheel-installed-bindings)))
- (when (eq (lookup-key (current-global-map) key) 'mwheel-scroll)
- (global-unset-key key))))
+ (mouse-wheel--remove-bindings mwheel-installed-bindings
+ '(mwheel-scroll))
+ (mouse-wheel--remove-bindings mwheel-installed-text-scale-bindings
+ '(text-scale-increase
+ text-scale-decrease))
+ (setq mwheel-installed-bindings nil)
+ (setq mwheel-installed-text-scale-bindings nil)
;; Setup bindings as needed.
(when mouse-wheel-mode
- (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event mouse-wheel-right-event mouse-wheel-left-event))
- (dolist (key (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,event)])
- mouse-wheel-scroll-amount))
- (global-set-key key 'mwheel-scroll)
- (push key mwheel-installed-bindings)))))
+ (dolist (binding mouse-wheel-scroll-amount)
+ (cond
+ ;; Bindings for changing font size.
+ ((and (consp binding) (eq (cdr binding) 'text-scale))
+ (let ((increase-key `[,(list (caar binding) mouse-wheel-down-event)])
+ (decrease-key `[,(list (caar binding) mouse-wheel-up-event)]))
+ (global-set-key increase-key 'text-scale-increase)
+ (global-set-key decrease-key 'text-scale-decrease)
+ (push increase-key mwheel-installed-text-scale-bindings)
+ (push decrease-key mwheel-installed-text-scale-bindings)))
+ ;; Bindings for scrolling.
+ (t
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
+ mouse-wheel-right-event mouse-wheel-left-event))
+ (let ((key `[(,@(if (consp binding) (car binding)) ,event)]))
+ (global-set-key key 'mwheel-scroll)
+ (push key mwheel-installed-bindings))))))))
;;; Compatibility entry point
;; preloaded ;;;###autoload
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-28 13:09 ` Stefan Kangas
@ 2019-09-28 13:48 ` Eli Zaretskii
2019-09-28 14:15 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-09-28 13:48 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, rms, 28182, jidanni
> From: Stefan Kangas <stefan@marxist.se>
> Date: Sat, 28 Sep 2019 15:09:34 +0200
> Cc: Tak Kunihiro <homeros.misasa@gmail.com>, Richard Stallman <rms@gnu.org>,
> 28182@debbugs.gnu.org,
> 積丹尼 Dan Jacobson <jidanni@jidanni.org>
>
> I've attached a tentative patch along those lines. WDYT?
Any reason to make the new behavior be the default, i.e. break
backward compatibility? Why not make this an opt-in feature instead?
> I'm not sure exactly how to reformulate the doc string for
> mouse-wheel-scroll-amount to fit the new behaviour. I'll have to
> think about it a bit more. Do let me know if you have any ideas.
I'm not sure we need to change the doc string, but we definitely need
to change the :version tag.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-28 13:48 ` Eli Zaretskii
@ 2019-09-28 14:15 ` Stefan Kangas
2019-09-29 1:09 ` Richard Stallman
2019-10-05 23:56 ` Stefan Kangas
0 siblings, 2 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-09-28 14:15 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Tak Kunihiro, Juri Linkov, Richard Stallman, 28182,
積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
> > I've attached a tentative patch along those lines. WDYT?
>
> Any reason to make the new behavior be the default, i.e. break
> backward compatibility? Why not make this an opt-in feature instead?
I think it's a better default, since it's more in line with user
expectations. The "Ctrl+mouse whell changes font size" behaviour is
pretty ubiquitous in browsers, text editors and IDEs. From the top of
my head, you can change the font size (sometimes called "zoom") using
this shortcut in Firefox, Chrome, Safari, Eclipse, LibreOffice, Adobe
Reader, evince, and many, many others. From searching the web, this
seems to be the default also in Atom, Sublime Text, TextMate,
Notepad++ and IntelliJ. VSCode stands out by making this optional.
We could of course make it an opt-in feature should we want to do that.
> > I'm not sure exactly how to reformulate the doc string for
> > mouse-wheel-scroll-amount to fit the new behaviour. I'll have to
> > think about it a bit more. Do let me know if you have any ideas.
>
> I'm not sure we need to change the doc string, but we definitely need
> to change the :version tag.
Fixed that in the attached patch.
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Support-changing-font-size-using-mouse-wheel.patch --]
[-- Type: text/x-patch, Size: 8199 bytes --]
From 3814fcf37ba429b302add3591b6dbb255496a20e Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 21 Aug 2019 03:38:49 +0200
Subject: [PATCH] Support changing font size using mouse wheel
* lisp/mwheel.el (mouse-wheel-mode): Support changing font size (text
scaling) using mouse wheel. (Bug#28182)
(mouse-wheel-scroll-amount): Bind the Ctrl modifier to text scaling.
(mwheel-installed-text-scale-bindings): New variable.
(mouse-wheel--remove-bindings): New helper function for
'mouse-wheel-mode'.
* doc/emacs/frames.texi (Mouse Commands): Document this feature.
* etc/NEWS: Announce it.
---
doc/emacs/frames.texi | 10 +++---
etc/NEWS | 12 +++++++
lisp/mwheel.el | 75 ++++++++++++++++++++++++++++++-------------
3 files changed, 71 insertions(+), 26 deletions(-)
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 367ac43a0a..1f4aa95c87 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -200,10 +200,12 @@ Mouse Commands
@vindex mouse-wheel-progressive-speed
Some mice have a ``wheel'' which can be used for scrolling. Emacs
supports scrolling windows with the mouse wheel, by default, on most
-graphical displays. To toggle this feature, use @kbd{M-x
-mouse-wheel-mode}. The variables @code{mouse-wheel-follow-mouse} and
-@code{mouse-wheel-scroll-amount} determine where and by how much
-buffers are scrolled. The variable
+graphical displays. There is also support for increasing or
+decreasing the height of the default face, by default bound to
+scrolling with the @key{Ctrl} modifier. To toggle this feature, use
+@kbd{M-x mouse-wheel-mode}. The variables
+@code{mouse-wheel-follow-mouse} and @code{mouse-wheel-scroll-amount}
+determine where and by how much buffers are scrolled. The variable
@code{mouse-wheel-progressive-speed} determines whether the scroll
speed is linked to how fast you move the wheel.
diff --git a/etc/NEWS b/etc/NEWS
index 97b96d1e4e..c50ccd5309 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2212,6 +2212,18 @@ bool vector.
** 'regexp-quote' may return its argument string.
If the argument needs no quoting, it can be returned instead of a copy.
++++
+** Mouse scroll up and down with control key modifier changes font size.
+Previously, the control key modifier was used to scroll up or down by
+an amount which was close to near a full screen. This is now instead
+available by scrolling with the meta modifier key.
+
+To get the old behaviour back, customize the variable
+'mouse-wheel-scroll-amount', or add the following to your init file:
+
+(customize-set-variable 'mouse-wheel-scroll-amount
+ '(5 ((shift) . 1) ((control) . nil)))
+
\f
* Lisp Changes in Emacs 27.1
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index dfea55374b..f05aae5369 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -84,17 +84,22 @@ mouse-wheel-inhibit-click-time
:group 'mouse
:type 'number)
-(defcustom mouse-wheel-scroll-amount '(5 ((shift) . 1) ((control) . nil))
+(defcustom mouse-wheel-scroll-amount
+ '(5 ((shift) . 1) ((meta) . nil) ((control) . text-scale))
"Amount to scroll windows by when spinning the mouse wheel.
This is an alist mapping the modifier key to the amount to scroll when
the wheel is moved with the modifier key depressed.
-Elements of the list have the form (MODIFIERS . AMOUNT) or just AMOUNT if
-MODIFIERS is nil.
+Elements of the list have the form (MODIFIER . AMOUNT) or just AMOUNT if
+MODIFIER is nil.
AMOUNT should be the number of lines to scroll, or nil for near full
screen. It can also be a floating point number, specifying the fraction of
a full screen to scroll. A near full screen is `next-screen-context-lines'
-less than a full screen."
+less than a full screen.
+
+If AMOUNT is the symbol text-scale, this means that with
+MODIFIER, the mouse wheel will change the face height instead of
+scrolling."
:group 'mouse
:type '(cons
(choice :tag "Normal"
@@ -105,20 +110,22 @@ mouse-wheel-scroll-amount
(repeat (choice :tag "modifier"
(const alt) (const control) (const hyper)
(const meta) (const shift) (const super)))
- (choice :tag "scroll amount"
- (const :tag "Full screen" :value nil)
- (integer :tag "Specific # of lines")
- (float :tag "Fraction of window"))))
+ (choice :tag "action"
+ (const :tag "Scroll full screen" :value nil)
+ (integer :tag "Scroll specific # of lines")
+ (float :tag "Scroll fraction of window"))))
(repeat
(cons
(repeat (choice :tag "modifier"
(const alt) (const control) (const hyper)
(const meta) (const shift) (const super)))
- (choice :tag "scroll amount"
- (const :tag "Full screen" :value nil)
- (integer :tag "Specific # of lines")
- (float :tag "Fraction of window")))))
- :set 'mouse-wheel-change-button)
+ (choice :tag "action"
+ (const :tag "Scroll full screen" :value nil)
+ (integer :tag "Scroll specific # of lines")
+ (float :tag "Scroll fraction of window")
+ (const :tag "Change face size" :value text-scale)))))
+ :set 'mouse-wheel-change-button
+ :version "27.1")
(defcustom mouse-wheel-progressive-speed t
"If non-nil, the faster the user moves the wheel, the faster the scrolling.
@@ -306,6 +313,15 @@ mwheel-scroll
(put 'mwheel-scroll 'scroll-command t)
(defvar mwheel-installed-bindings nil)
+(defvar mwheel-installed-text-scale-bindings nil)
+
+(defun mouse-wheel--remove-bindings (bindings funs)
+ "Remove key BINDINGS if they're bound to any function in FUNS.
+BINDINGS is a list of key bindings, FUNS is a list of functions.
+This is a helper function for `mouse-wheel-mode'."
+ (dolist (key bindings)
+ (when (memq (lookup-key (current-global-map) key) funs)
+ (global-unset-key key))))
(define-minor-mode mouse-wheel-mode
"Toggle mouse wheel support (Mouse Wheel mode)."
@@ -318,17 +334,32 @@ mouse-wheel-mode
:global t
:group 'mouse
;; Remove previous bindings, if any.
- (while mwheel-installed-bindings
- (let ((key (pop mwheel-installed-bindings)))
- (when (eq (lookup-key (current-global-map) key) 'mwheel-scroll)
- (global-unset-key key))))
+ (mouse-wheel--remove-bindings mwheel-installed-bindings
+ '(mwheel-scroll))
+ (mouse-wheel--remove-bindings mwheel-installed-text-scale-bindings
+ '(text-scale-increase
+ text-scale-decrease))
+ (setq mwheel-installed-bindings nil)
+ (setq mwheel-installed-text-scale-bindings nil)
;; Setup bindings as needed.
(when mouse-wheel-mode
- (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event mouse-wheel-right-event mouse-wheel-left-event))
- (dolist (key (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,event)])
- mouse-wheel-scroll-amount))
- (global-set-key key 'mwheel-scroll)
- (push key mwheel-installed-bindings)))))
+ (dolist (binding mouse-wheel-scroll-amount)
+ (cond
+ ;; Bindings for changing font size.
+ ((and (consp binding) (eq (cdr binding) 'text-scale))
+ (let ((increase-key `[,(list (caar binding) mouse-wheel-down-event)])
+ (decrease-key `[,(list (caar binding) mouse-wheel-up-event)]))
+ (global-set-key increase-key 'text-scale-increase)
+ (global-set-key decrease-key 'text-scale-decrease)
+ (push increase-key mwheel-installed-text-scale-bindings)
+ (push decrease-key mwheel-installed-text-scale-bindings)))
+ ;; Bindings for scrolling.
+ (t
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
+ mouse-wheel-right-event mouse-wheel-left-event))
+ (let ((key `[(,@(if (consp binding) (car binding)) ,event)]))
+ (global-set-key key 'mwheel-scroll)
+ (push key mwheel-installed-bindings))))))))
;;; Compatibility entry point
;; preloaded ;;;###autoload
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-28 14:15 ` Stefan Kangas
@ 2019-09-29 1:09 ` Richard Stallman
2019-09-29 1:40 ` Stefan Kangas
2019-10-05 23:56 ` Stefan Kangas
1 sibling, 1 reply; 57+ messages in thread
From: Richard Stallman @ 2019-09-29 1:09 UTC (permalink / raw)
To: Stefan Kangas; +Cc: juri, homeros.misasa, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> I think it's a better default, since it's more in line with user
> expectations. The "Ctrl+mouse whell changes font size" behaviour is
> pretty ubiquitous in browsers, text editors and IDEs.
I proposed CTRL +, but you're talking about the mouse wheel.
They are not the same: my laptop has no mouse wheel.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 1:09 ` Richard Stallman
@ 2019-09-29 1:40 ` Stefan Kangas
2019-09-29 7:36 ` Eli Zaretskii
2019-09-29 15:37 ` Richard Stallman
0 siblings, 2 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-09-29 1:40 UTC (permalink / raw)
To: Richard Stallman
Cc: Juri Linkov, Tak Kunihiro, 28182,
積丹尼 Dan Jacobson
Richard Stallman <rms@gnu.org> writes:
> > I think it's a better default, since it's more in line with user
> > expectations. The "Ctrl+mouse whell changes font size" behaviour is
> > pretty ubiquitous in browsers, text editors and IDEs.
>
> I proposed CTRL +, but you're talking about the mouse wheel.
> They are not the same: my laptop has no mouse wheel.
Earlier in this thread, Eli objected to that proposal because it would
be backwards incompatible. I don't know the status of that proposal
beyond that.
Changing the mouse wheel behaviour was raised during the discussion as
an alternative. I agreed, and there seemed to be little controversy
around it, so I implemented that and sent it here. Sorry if that
caused any confusion.
I see no conflict between changing the key bindings and changing the
mouse wheel behaviour.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 1:40 ` Stefan Kangas
@ 2019-09-29 7:36 ` Eli Zaretskii
2019-09-29 15:33 ` Richard Stallman
2019-09-29 15:37 ` Richard Stallman
1 sibling, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-09-29 7:36 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, rms, 28182, jidanni
> From: Stefan Kangas <stefan@marxist.se>
> Date: Sun, 29 Sep 2019 03:40:05 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, Tak Kunihiro <homeros.misasa@gmail.com>,
> Juri Linkov <juri@linkov.net>, 28182@debbugs.gnu.org,
> 積丹尼 Dan Jacobson <jidanni@jidanni.org>
>
> Richard Stallman <rms@gnu.org> writes:
>
> > > I think it's a better default, since it's more in line with user
> > > expectations. The "Ctrl+mouse whell changes font size" behaviour is
> > > pretty ubiquitous in browsers, text editors and IDEs.
> >
> > I proposed CTRL +, but you're talking about the mouse wheel.
> > They are not the same: my laptop has no mouse wheel.
>
> Earlier in this thread, Eli objected to that proposal because it would
> be backwards incompatible.
The problem is not with C-+, which is undefined by default. The
problem is with C--, which is used for numeric arguments. It makes
little sense to me to use C-+ for increasing the font size without
also using C-- for decreasing it.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 7:36 ` Eli Zaretskii
@ 2019-09-29 15:33 ` Richard Stallman
2019-09-29 15:40 ` Eli Zaretskii
0 siblings, 1 reply; 57+ messages in thread
From: Richard Stallman @ 2019-09-29 15:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> The problem is not with C-+, which is undefined by default. The
> problem is with C--, which is used for numeric arguments. It makes
> little sense to me to use C-+ for increasing the font size without
> also using C-- for decreasing it.
I would find C-+ useful even if C-- does numeric arguments.
C-- C-+ would shrink the font size. Indeed, that is an easy
combination to type.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 1:40 ` Stefan Kangas
2019-09-29 7:36 ` Eli Zaretskii
@ 2019-09-29 15:37 ` Richard Stallman
2019-09-29 15:44 ` Eli Zaretskii
1 sibling, 1 reply; 57+ messages in thread
From: Richard Stallman @ 2019-09-29 15:37 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
I have no objection to implementing a mouse wheel feature,
but it doesn't solve my problem.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 15:33 ` Richard Stallman
@ 2019-09-29 15:40 ` Eli Zaretskii
0 siblings, 0 replies; 57+ messages in thread
From: Eli Zaretskii @ 2019-09-29 15:40 UTC (permalink / raw)
To: rms; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
> From: Richard Stallman <rms@gnu.org>
> Cc: stefan@marxist.se, homeros.misasa@gmail.com, juri@linkov.net,
> 28182@debbugs.gnu.org, jidanni@jidanni.org
> Date: Sun, 29 Sep 2019 11:33:58 -0400
>
> I would find C-+ useful even if C-- does numeric arguments.
> C-- C-+ would shrink the font size. Indeed, that is an easy
> combination to type.
It isn't so easy on my keyboard, where C-+ requires to press Shift.
Also, this is not what other applications out there provide for this
purpose, they provide C-mouse-wheel. We already have "C-x C-+"
(actually, "C-x C-=", as pressing Shift is unnecessary) and its
counterpart "C-x C--", which are easy enough and don't get in the way
of other bindings. How many different bindings do we need to have for
such an infrequent command?
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 15:37 ` Richard Stallman
@ 2019-09-29 15:44 ` Eli Zaretskii
2019-09-29 23:36 ` Richard Stallman
0 siblings, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-09-29 15:44 UTC (permalink / raw)
To: rms; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
> From: Richard Stallman <rms@gnu.org>
> Date: Sun, 29 Sep 2019 11:37:01 -0400
> Cc: homeros.misasa@gmail.com, juri@linkov.net, 28182@debbugs.gnu.org,
> jidanni@jidanni.org
>
> I have no objection to implementing a mouse wheel feature,
> but it doesn't solve my problem.
Please tell what is your problem, and why "C-x C-+" doesn't solve it?
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 15:44 ` Eli Zaretskii
@ 2019-09-29 23:36 ` Richard Stallman
2019-09-30 3:52 ` Lars Ingebrigtsen
2019-09-30 6:16 ` Eli Zaretskii
0 siblings, 2 replies; 57+ messages in thread
From: Richard Stallman @ 2019-09-29 23:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> Please tell what is your problem, and why "C-x C-+" doesn't solve it?
Does C-x C-+ increase the font size? I didn't know that. I thought of
trying C-+ because that is what other graphical applications use.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 23:36 ` Richard Stallman
@ 2019-09-30 3:52 ` Lars Ingebrigtsen
2019-09-30 6:16 ` Eli Zaretskii
1 sibling, 0 replies; 57+ messages in thread
From: Lars Ingebrigtsen @ 2019-09-30 3:52 UTC (permalink / raw)
To: Richard Stallman; +Cc: stefan, juri, homeros.misasa, 28182, jidanni
Richard Stallman <rms@gnu.org> writes:
> > Please tell what is your problem, and why "C-x C-+" doesn't solve it?
>
> Does C-x C-+ increase the font size? I didn't know that. I thought of
> trying C-+ because that is what other graphical applications use.
It's a bit unusual, but it was presumably chosen because `C--' was
already taken, so the natural pair became `C-x C--' and `C-x C-+'.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-29 23:36 ` Richard Stallman
2019-09-30 3:52 ` Lars Ingebrigtsen
@ 2019-09-30 6:16 ` Eli Zaretskii
2019-09-30 9:02 ` Robert Pluim
2019-09-30 14:57 ` Richard Stallman
1 sibling, 2 replies; 57+ messages in thread
From: Eli Zaretskii @ 2019-09-30 6:16 UTC (permalink / raw)
To: rms; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
> From: Richard Stallman <rms@gnu.org>
> Cc: homeros.misasa@gmail.com, juri@linkov.net, stefan@marxist.se,
> 28182@debbugs.gnu.org, jidanni@jidanni.org
> Date: Sun, 29 Sep 2019 19:36:06 -0400
>
> > Please tell what is your problem, and why "C-x C-+" doesn't solve it?
>
> Does C-x C-+ increase the font size?
Yes. And "C-x C--" decreases it.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-30 6:16 ` Eli Zaretskii
@ 2019-09-30 9:02 ` Robert Pluim
2019-09-30 9:16 ` Eli Zaretskii
2019-09-30 14:57 ` Richard Stallman
1 sibling, 1 reply; 57+ messages in thread
From: Robert Pluim @ 2019-09-30 9:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: rms, stefan, juri, homeros.misasa, 28182, jidanni
>>>>> On Mon, 30 Sep 2019 09:16:16 +0300, Eli Zaretskii <eliz@gnu.org> said:
>> From: Richard Stallman <rms@gnu.org>
>> Cc: homeros.misasa@gmail.com, juri@linkov.net, stefan@marxist.se,
>> 28182@debbugs.gnu.org, jidanni@jidanni.org
>> Date: Sun, 29 Sep 2019 19:36:06 -0400
>>
>> > Please tell what is your problem, and why "C-x C-+" doesn't solve it?
>>
>> Does C-x C-+ increase the font size?
Eli> Yes. And "C-x C--" decreases it.
Whoever implemented this originally went a bit far, I think:
C-x C-= runs the command text-scale-adjust (found in global-map),
which is an autoloaded interactive compiled Lisp function in
`face-remap.el'.
It is bound to s-0, s-=, s-+, s--, C-x C-0, C-x C-=, C-x C--, C-x C-+.
Are those s- bindings really necessary? Hey, I have a usable super
key! :-)
Robert
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-30 9:02 ` Robert Pluim
@ 2019-09-30 9:16 ` Eli Zaretskii
2019-10-02 20:17 ` Alan Third
0 siblings, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-09-30 9:16 UTC (permalink / raw)
To: Robert Pluim; +Cc: rms, stefan, juri, homeros.misasa, 28182, jidanni
> From: Robert Pluim <rpluim@gmail.com>
> Cc: rms@gnu.org, homeros.misasa@gmail.com, juri@linkov.net,
> stefan@marxist.se, 28182@debbugs.gnu.org, jidanni@jidanni.org
> Date: Mon, 30 Sep 2019 11:02:00 +0200
>
> It is bound to s-0, s-=, s-+, s--, C-x C-0, C-x C-=, C-x C--, C-x C-+.
>
> Are those s- bindings really necessary?
I don't know, but we've survived that this far, didn't we?
(I'm guessing s-+ etc. was an attempt to have the simplicity of C-+
the other apps have.)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-30 6:16 ` Eli Zaretskii
2019-09-30 9:02 ` Robert Pluim
@ 2019-09-30 14:57 ` Richard Stallman
2019-10-15 6:42 ` Stefan Kangas
1 sibling, 1 reply; 57+ messages in thread
From: Richard Stallman @ 2019-09-30 14:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > > Please tell what is your problem, and why "C-x C-+" doesn't solve it?
> >
> > Does C-x C-+ increase the font size?
> Yes. And "C-x C--" decreases it.
It would be better to make C-+ do it also
since people used to other applications will try that.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-30 9:16 ` Eli Zaretskii
@ 2019-10-02 20:17 ` Alan Third
0 siblings, 0 replies; 57+ messages in thread
From: Alan Third @ 2019-10-02 20:17 UTC (permalink / raw)
To: Eli Zaretskii
Cc: rms, Robert Pluim, stefan, juri, homeros.misasa, 28182, jidanni
On Mon, Sep 30, 2019 at 12:16:36PM +0300, Eli Zaretskii wrote:
> > From: Robert Pluim <rpluim@gmail.com>
> > Cc: rms@gnu.org, homeros.misasa@gmail.com, juri@linkov.net,
> > stefan@marxist.se, 28182@debbugs.gnu.org, jidanni@jidanni.org
> > Date: Mon, 30 Sep 2019 11:02:00 +0200
> >
> > It is bound to s-0, s-=, s-+, s--, C-x C-0, C-x C-=, C-x C--, C-x C-+.
> >
> > Are those s- bindings really necessary?
>
> I don't know, but we've survived that this far, didn't we?
>
> (I'm guessing s-+ etc. was an attempt to have the simplicity of C-+
> the other apps have.)
I think Robert uses the NS port, and those super bindings were added
for compatibility with other *step applications. Quite recently,
actually: they’re not in Emacs 26.
--
Alan Third
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-28 14:15 ` Stefan Kangas
2019-09-29 1:09 ` Richard Stallman
@ 2019-10-05 23:56 ` Stefan Kangas
2019-10-06 17:28 ` Eli Zaretskii
1 sibling, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-10-05 23:56 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Tak Kunihiro, Juri Linkov, Richard Stallman, 28182,
積丹尼 Dan Jacobson
Stefan Kangas <stefan@marxist.se> writes:
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > > I've attached a tentative patch along those lines. WDYT?
> >
> > Any reason to make the new behavior be the default, i.e. break
> > backward compatibility? Why not make this an opt-in feature instead?
>
> I think it's a better default, since it's more in line with user
> expectations. The "Ctrl+mouse whell changes font size" behaviour is
> pretty ubiquitous in browsers, text editors and IDEs. From the top of
> my head, you can change the font size (sometimes called "zoom") using
> this shortcut in Firefox, Chrome, Safari, Eclipse, LibreOffice, Adobe
> Reader, evince, and many, many others. From searching the web, this
> seems to be the default also in Atom, Sublime Text, TextMate,
> Notepad++ and IntelliJ. VSCode stands out by making this optional.
>
> We could of course make it an opt-in feature should we want to do that.
>
> > > I'm not sure exactly how to reformulate the doc string for
> > > mouse-wheel-scroll-amount to fit the new behaviour. I'll have to
> > > think about it a bit more. Do let me know if you have any ideas.
> >
> > I'm not sure we need to change the doc string, but we definitely need
> > to change the :version tag.
>
> Fixed that in the attached patch.
I don't feel comfortable pushing this without an explicit go-ahead.
What do you think?
Thanks in advance.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-05 23:56 ` Stefan Kangas
@ 2019-10-06 17:28 ` Eli Zaretskii
2019-10-06 19:59 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-10-06 17:28 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, rms, 28182, jidanni
> From: Stefan Kangas <stefan@marxist.se>
> Date: Sun, 6 Oct 2019 01:56:28 +0200
> Cc: Juri Linkov <juri@linkov.net>, Tak Kunihiro <homeros.misasa@gmail.com>,
> Richard Stallman <rms@gnu.org>, 28182@debbugs.gnu.org,
> 積丹尼 Dan Jacobson <jidanni@jidanni.org>
>
> > Fixed that in the attached patch.
>
> I don't feel comfortable pushing this without an explicit go-ahead.
Please go ahead, and thanks.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-06 17:28 ` Eli Zaretskii
@ 2019-10-06 19:59 ` Stefan Kangas
2019-10-07 18:22 ` Juri Linkov
0 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-10-06 19:59 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Tak Kunihiro, Juri Linkov, Richard Stallman, 28182,
積丹尼 Dan Jacobson
Eli Zaretskii <eliz@gnu.org> writes:
> > I don't feel comfortable pushing this without an explicit go-ahead.
>
> Please go ahead, and thanks.
Thank you, Eli. I've now pushed this to master as commit dc8108e109.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-06 19:59 ` Stefan Kangas
@ 2019-10-07 18:22 ` Juri Linkov
2019-10-08 14:56 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Juri Linkov @ 2019-10-07 18:22 UTC (permalink / raw)
To: Stefan Kangas
Cc: 積丹尼 Dan Jacobson, Tak Kunihiro, 28182,
Richard Stallman
> I've now pushed this to master as commit dc8108e109.
Thank you. While trying your change for bug#28194, I noticed one
edge case, but I'm not sure if this is something that needs to be fixed.
Here is a recipe:
With at least two windows on the same frame:
1. Scroll mouse without Ctrl key in the selected window,
it scrolls the buffer in the selected window;
2. Scroll mouse without Ctrl key in the non-selected window,
it scrolls the buffer in the non-selected window;
3. Scroll mouse with Ctrl key in the selected window,
it changes text scale in the selected window;
4. Scroll mouse with Ctrl key in the non-selected window,
it DOESN'T change text scale in the non-selected window,
instead it changes text scale in the selected window.
What is expected is that mouse scrolling in the non-selected window
will affect the non-selected window. Does this need to be changed?
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-07 18:22 ` Juri Linkov
@ 2019-10-08 14:56 ` Stefan Kangas
2019-10-08 21:58 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-10-08 14:56 UTC (permalink / raw)
To: Juri Linkov
Cc: 積丹尼 Dan Jacobson, Tak Kunihiro, 28182,
Richard Stallman
Juri Linkov <juri@linkov.net> writes:
> What is expected is that mouse scrolling in the non-selected window
> will affect the non-selected window. Does this need to be changed?
I'm not sure, but I think I agree with you that it should be changed.
Perhaps we could try it and see if it feels better?
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-08 14:56 ` Stefan Kangas
@ 2019-10-08 21:58 ` Stefan Kangas
2019-10-09 6:08 ` Eli Zaretskii
2019-10-09 20:54 ` Juri Linkov
0 siblings, 2 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-10-08 21:58 UTC (permalink / raw)
To: Juri Linkov
Cc: 積丹尼 Dan Jacobson, Tak Kunihiro, 28182,
Richard Stallman
[-- Attachment #1: Type: text/plain, Size: 733 bytes --]
Stefan Kangas <stefan@marxist.se> writes:
> > What is expected is that mouse scrolling in the non-selected window
> > will affect the non-selected window. Does this need to be changed?
>
> I'm not sure, but I think I agree with you that it should be changed.
> Perhaps we could try it and see if it feels better?
It turns out there is already a defcustom 'mouse-wheel-follows-mouse'
that controls this behaviour when scrolling. If non-nil (the default)
it will scroll the window that the mouse pointer is over, otherwise
the one where point is. So the job is not that hard: we should just
do what the user wants.
The attached patch makes changing font size respect that option. What
do you think?
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Change-font-size-in-correct-window-using-mouse-wheel.patch --]
[-- Type: text/x-patch, Size: 6067 bytes --]
From 9172e861f69b811fd0da5e8be4cd7c1cf3c66e6f Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Tue, 8 Oct 2019 23:53:14 +0200
Subject: [PATCH] Change font size in correct window using mouse wheel
* lisp/mwheel.el (mouse-wheel--get-scroll-window): New function
extracted from...
(mwheel-scroll): ...here.
(mouse-wheel-text-scale): New function to change face height in
the correct window, depending on the value of
'mouse-wheel-follows-mouse'. (Bug#28182)
(mouse-wheel-mode): Bind 'mouse-wheel-text-scale' instead of
'text-scale-increase' and 'text-scale-decrease'.
---
lisp/mwheel.el | 77 ++++++++++++++++++++++++++++++--------------------
1 file changed, 47 insertions(+), 30 deletions(-)
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 9b67e71886..96cf286db1 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -210,34 +210,40 @@ mouse-wheel-right-event
(intern "mouse-7"))
"Event used for scrolling right.")
+(defun mouse-wheel--get-scroll-window (event)
+ "Return window for mouse wheel event EVENT.
+If `mouse-wheel-follow-mouse' is non-nil, return the window that
+the mouse pointer is over. Otherwise, return the currently
+active window."
+ (or (catch 'found
+ (let* ((window (if mouse-wheel-follow-mouse
+ (mwheel-event-window event)
+ (selected-window)))
+ (frame (when (window-live-p window)
+ (frame-parameter
+ (window-frame window) 'mouse-wheel-frame))))
+ (when (frame-live-p frame)
+ (let* ((pos (mouse-absolute-pixel-position))
+ (pos-x (car pos))
+ (pos-y (cdr pos)))
+ (walk-window-tree
+ (lambda (window-1)
+ (let ((edges (window-edges window-1 nil t t)))
+ (when (and (<= (nth 0 edges) pos-x)
+ (<= pos-x (nth 2 edges))
+ (<= (nth 1 edges) pos-y)
+ (<= pos-y (nth 3 edges)))
+ (throw 'found window-1))))
+ frame nil t)))))
+ (mwheel-event-window event)))
+
(defun mwheel-scroll (event)
"Scroll up or down according to the EVENT.
This should be bound only to mouse buttons 4, 5, 6, and 7 on
non-Windows systems."
(interactive (list last-input-event))
(let* ((selected-window (selected-window))
- (scroll-window
- (or (catch 'found
- (let* ((window (if mouse-wheel-follow-mouse
- (mwheel-event-window event)
- (selected-window)))
- (frame (when (window-live-p window)
- (frame-parameter
- (window-frame window) 'mouse-wheel-frame))))
- (when (frame-live-p frame)
- (let* ((pos (mouse-absolute-pixel-position))
- (pos-x (car pos))
- (pos-y (cdr pos)))
- (walk-window-tree
- (lambda (window-1)
- (let ((edges (window-edges window-1 nil t t)))
- (when (and (<= (nth 0 edges) pos-x)
- (<= pos-x (nth 2 edges))
- (<= (nth 1 edges) pos-y)
- (<= pos-y (nth 3 edges)))
- (throw 'found window-1))))
- frame nil t)))))
- (mwheel-event-window event)))
+ (scroll-window (mouse-wheel--get-scroll-window event))
(old-point
(and (eq scroll-window selected-window)
(eq (car-safe transient-mark-mode) 'only)
@@ -322,6 +328,20 @@ mwheel-scroll
(put 'mwheel-scroll 'scroll-command t)
+(defun mouse-wheel-text-scale (event)
+ "Increase or decrease the height of the default face according to the EVENT."
+ (interactive (list last-input-event))
+ (let ((selected-window (selected-window))
+ (scroll-window (mouse-wheel--get-scroll-window event))
+ (button (mwheel-event-button event)))
+ (select-window scroll-window 'mark-for-redisplay)
+ (unwind-protect
+ (cond ((eq button mouse-wheel-down-event)
+ (text-scale-decrease 1))
+ ((eq button mouse-wheel-up-event)
+ (text-scale-increase 1)))
+ (select-window selected-window))))
+
(defvar mwheel-installed-bindings nil)
(defvar mwheel-installed-text-scale-bindings nil)
@@ -347,8 +367,7 @@ mouse-wheel-mode
(mouse-wheel--remove-bindings mwheel-installed-bindings
'(mwheel-scroll))
(mouse-wheel--remove-bindings mwheel-installed-text-scale-bindings
- '(text-scale-increase
- text-scale-decrease))
+ '(mouse-wheel-text-scale))
(setq mwheel-installed-bindings nil)
(setq mwheel-installed-text-scale-bindings nil)
;; Setup bindings as needed.
@@ -357,12 +376,10 @@ mouse-wheel-mode
(cond
;; Bindings for changing font size.
((and (consp binding) (eq (cdr binding) 'text-scale))
- (let ((increase-key `[,(list (caar binding) mouse-wheel-down-event)])
- (decrease-key `[,(list (caar binding) mouse-wheel-up-event)]))
- (global-set-key increase-key 'text-scale-increase)
- (global-set-key decrease-key 'text-scale-decrease)
- (push increase-key mwheel-installed-text-scale-bindings)
- (push decrease-key mwheel-installed-text-scale-bindings)))
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event))
+ (let ((key `[,(list (caar binding) event)]))
+ (global-set-key key 'mouse-wheel-text-scale)
+ (push key mwheel-installed-text-scale-bindings))))
;; Bindings for scrolling.
(t
(dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-08 21:58 ` Stefan Kangas
@ 2019-10-09 6:08 ` Eli Zaretskii
2019-10-09 21:56 ` Stefan Kangas
2019-10-09 20:54 ` Juri Linkov
1 sibling, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-10-09 6:08 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, rms, 28182, jidanni
> From: Stefan Kangas <stefan@marxist.se>
> Date: Tue, 8 Oct 2019 23:58:09 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, Tak Kunihiro <homeros.misasa@gmail.com>,
> 積丹尼 Dan Jacobson <jidanni@jidanni.org>,
> Richard Stallman <rms@gnu.org>, 28182@debbugs.gnu.org
>
> It turns out there is already a defcustom 'mouse-wheel-follows-mouse'
> that controls this behaviour when scrolling. If non-nil (the default)
> it will scroll the window that the mouse pointer is over, otherwise
> the one where point is. So the job is not that hard: we should just
> do what the user wants.
>
> The attached patch makes changing font size respect that option. What
> do you think?
Please don't forget mentioning this in NEWS (and in the manual, if
applicable).
Thanks.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-08 21:58 ` Stefan Kangas
2019-10-09 6:08 ` Eli Zaretskii
@ 2019-10-09 20:54 ` Juri Linkov
1 sibling, 0 replies; 57+ messages in thread
From: Juri Linkov @ 2019-10-09 20:54 UTC (permalink / raw)
To: Stefan Kangas
Cc: 積丹尼 Dan Jacobson, Tak Kunihiro, 28182,
Richard Stallman
>> > What is expected is that mouse scrolling in the non-selected window
>> > will affect the non-selected window. Does this need to be changed?
>>
>> I'm not sure, but I think I agree with you that it should be changed.
>> Perhaps we could try it and see if it feels better?
>
> It turns out there is already a defcustom 'mouse-wheel-follows-mouse'
> that controls this behaviour when scrolling. If non-nil (the default)
> it will scroll the window that the mouse pointer is over, otherwise
> the one where point is. So the job is not that hard: we should just
> do what the user wants.
Thanks for finding mouse-wheel-follow-mouse, I didn't know about it.
> The attached patch makes changing font size respect that option. What
> do you think?
Your refactoring makes code more nice, thanks.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-09 6:08 ` Eli Zaretskii
@ 2019-10-09 21:56 ` Stefan Kangas
2019-10-10 7:26 ` Eli Zaretskii
2019-10-10 8:00 ` Robert Pluim
0 siblings, 2 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-10-09 21:56 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Tak Kunihiro, Juri Linkov, Richard Stallman, 28182,
積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
> Please don't forget mentioning this in NEWS (and in the manual, if
> applicable).
Thanks. Is something like the attached okay? I'm not sure exactly
what you had in mind, since this mostly preserves previous behaviour
also for changing the font size.
(I checked the manual, but it is fine as is, IMO.)
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Change-font-size-in-correct-window-using-mouse-wheel.patch --]
[-- Type: text/x-patch, Size: 6993 bytes --]
From 01cac92927782e889c6e65dc0df70733e9ffa12f Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Tue, 8 Oct 2019 23:53:14 +0200
Subject: [PATCH] Change font size in correct window using mouse wheel
* lisp/mwheel.el (mouse-wheel--get-scroll-window): New function
extracted from...
(mwheel-scroll): ...here.
(mouse-wheel-text-scale): New function to change face height in
the correct window, depending on the value of
'mouse-wheel-follows-mouse'. (Bug#28182)
(mouse-wheel-mode): Bind 'mouse-wheel-text-scale' instead of
'text-scale-increase' and 'text-scale-decrease'.
---
etc/NEWS | 5 ++++
lisp/mwheel.el | 80 +++++++++++++++++++++++++++++++-------------------
2 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 2ca681ff9b..53b9c1eec2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2335,6 +2335,11 @@ To get the old behaviour back, customize the variable
(customize-set-variable 'mouse-wheel-scroll-amount
'(5 ((shift) . 1) ((control) . nil)))
+By default, the font size will be changed in the window that the mouse
+pointer is over. To change this behaviour, you can customize the
+option 'mouse-wheel-follow-mouse'. Note that this will also affect
+scrolling.
+
\f
* Lisp Changes in Emacs 27.1
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 9b67e71886..8c1927950a 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -137,7 +137,8 @@ mouse-wheel-progressive-speed
(defcustom mouse-wheel-follow-mouse t
"Whether the mouse wheel should scroll the window that the mouse is over.
-This can be slightly disconcerting, but some people prefer it."
+This affects both the commands for scrolling and changing the
+face height."
:group 'mouse
:type 'boolean)
@@ -210,34 +211,40 @@ mouse-wheel-right-event
(intern "mouse-7"))
"Event used for scrolling right.")
+(defun mouse-wheel--get-scroll-window (event)
+ "Return window for mouse wheel event EVENT.
+If `mouse-wheel-follow-mouse' is non-nil, return the window that
+the mouse pointer is over. Otherwise, return the currently
+active window."
+ (or (catch 'found
+ (let* ((window (if mouse-wheel-follow-mouse
+ (mwheel-event-window event)
+ (selected-window)))
+ (frame (when (window-live-p window)
+ (frame-parameter
+ (window-frame window) 'mouse-wheel-frame))))
+ (when (frame-live-p frame)
+ (let* ((pos (mouse-absolute-pixel-position))
+ (pos-x (car pos))
+ (pos-y (cdr pos)))
+ (walk-window-tree
+ (lambda (window-1)
+ (let ((edges (window-edges window-1 nil t t)))
+ (when (and (<= (nth 0 edges) pos-x)
+ (<= pos-x (nth 2 edges))
+ (<= (nth 1 edges) pos-y)
+ (<= pos-y (nth 3 edges)))
+ (throw 'found window-1))))
+ frame nil t)))))
+ (mwheel-event-window event)))
+
(defun mwheel-scroll (event)
"Scroll up or down according to the EVENT.
This should be bound only to mouse buttons 4, 5, 6, and 7 on
non-Windows systems."
(interactive (list last-input-event))
(let* ((selected-window (selected-window))
- (scroll-window
- (or (catch 'found
- (let* ((window (if mouse-wheel-follow-mouse
- (mwheel-event-window event)
- (selected-window)))
- (frame (when (window-live-p window)
- (frame-parameter
- (window-frame window) 'mouse-wheel-frame))))
- (when (frame-live-p frame)
- (let* ((pos (mouse-absolute-pixel-position))
- (pos-x (car pos))
- (pos-y (cdr pos)))
- (walk-window-tree
- (lambda (window-1)
- (let ((edges (window-edges window-1 nil t t)))
- (when (and (<= (nth 0 edges) pos-x)
- (<= pos-x (nth 2 edges))
- (<= (nth 1 edges) pos-y)
- (<= pos-y (nth 3 edges)))
- (throw 'found window-1))))
- frame nil t)))))
- (mwheel-event-window event)))
+ (scroll-window (mouse-wheel--get-scroll-window event))
(old-point
(and (eq scroll-window selected-window)
(eq (car-safe transient-mark-mode) 'only)
@@ -322,6 +329,20 @@ mwheel-scroll
(put 'mwheel-scroll 'scroll-command t)
+(defun mouse-wheel-text-scale (event)
+ "Increase or decrease the height of the default face according to the EVENT."
+ (interactive (list last-input-event))
+ (let ((selected-window (selected-window))
+ (scroll-window (mouse-wheel--get-scroll-window event))
+ (button (mwheel-event-button event)))
+ (select-window scroll-window 'mark-for-redisplay)
+ (unwind-protect
+ (cond ((eq button mouse-wheel-down-event)
+ (text-scale-decrease 1))
+ ((eq button mouse-wheel-up-event)
+ (text-scale-increase 1)))
+ (select-window selected-window))))
+
(defvar mwheel-installed-bindings nil)
(defvar mwheel-installed-text-scale-bindings nil)
@@ -347,8 +368,7 @@ mouse-wheel-mode
(mouse-wheel--remove-bindings mwheel-installed-bindings
'(mwheel-scroll))
(mouse-wheel--remove-bindings mwheel-installed-text-scale-bindings
- '(text-scale-increase
- text-scale-decrease))
+ '(mouse-wheel-text-scale))
(setq mwheel-installed-bindings nil)
(setq mwheel-installed-text-scale-bindings nil)
;; Setup bindings as needed.
@@ -357,12 +377,10 @@ mouse-wheel-mode
(cond
;; Bindings for changing font size.
((and (consp binding) (eq (cdr binding) 'text-scale))
- (let ((increase-key `[,(list (caar binding) mouse-wheel-down-event)])
- (decrease-key `[,(list (caar binding) mouse-wheel-up-event)]))
- (global-set-key increase-key 'text-scale-increase)
- (global-set-key decrease-key 'text-scale-decrease)
- (push increase-key mwheel-installed-text-scale-bindings)
- (push decrease-key mwheel-installed-text-scale-bindings)))
+ (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event))
+ (let ((key `[,(list (caar binding) event)]))
+ (global-set-key key 'mouse-wheel-text-scale)
+ (push key mwheel-installed-text-scale-bindings))))
;; Bindings for scrolling.
(t
(dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-09 21:56 ` Stefan Kangas
@ 2019-10-10 7:26 ` Eli Zaretskii
2019-10-11 0:18 ` Stefan Kangas
2019-10-10 8:00 ` Robert Pluim
1 sibling, 1 reply; 57+ messages in thread
From: Eli Zaretskii @ 2019-10-10 7:26 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, rms, 28182, jidanni
> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 9 Oct 2019 23:56:22 +0200
> Cc: Juri Linkov <juri@linkov.net>, Tak Kunihiro <homeros.misasa@gmail.com>,
> 積丹尼 Dan Jacobson <jidanni@jidanni.org>,
> Richard Stallman <rms@gnu.org>, 28182@debbugs.gnu.org
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Please don't forget mentioning this in NEWS (and in the manual, if
> > applicable).
>
> Thanks. Is something like the attached okay? I'm not sure exactly
> what you had in mind, since this mostly preserves previous behaviour
> also for changing the font size.
What I had in mind was to say that this option now _also_ controls the
font size-changing mouse gestures.
I think the text you wrote is OK, thanks.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-09 21:56 ` Stefan Kangas
2019-10-10 7:26 ` Eli Zaretskii
@ 2019-10-10 8:00 ` Robert Pluim
2019-10-11 0:24 ` Stefan Kangas
1 sibling, 1 reply; 57+ messages in thread
From: Robert Pluim @ 2019-10-10 8:00 UTC (permalink / raw)
To: Stefan Kangas
Cc: Richard Stallman, Juri Linkov, Tak Kunihiro, 28182,
積丹尼 Dan Jacobson
>>>>> On Wed, 9 Oct 2019 23:56:22 +0200, Stefan Kangas <stefan@marxist.se> said:
Stefan> Eli Zaretskii <eliz@gnu.org> writes:
>> Please don't forget mentioning this in NEWS (and in the manual, if
>> applicable).
Stefan> Thanks. Is something like the attached okay? I'm not sure exactly
Stefan> what you had in mind, since this mostly preserves previous behaviour
Stefan> also for changing the font size.
Stefan> (I checked the manual, but it is fine as is, IMO.)
I took a look at the manual, it says:
Some mice have a “wheel” which can be used for scrolling. Emacs
supports scrolling windows with the mouse wheel, by default, on most
graphical displays. There is also support for increasing or decreasing
the height of the default face, by default bound to scrolling with the
<Ctrl> modifier. To toggle this feature, use ‘M-x mouse-wheel-mode’.
The variables ‘mouse-wheel-follow-mouse’ and ‘mouse-wheel-scroll-amount’
determine where and by how much buffers are scrolled. The variable
‘mouse-wheel-progressive-speed’ determines whether the scroll speed is
linked to how fast you move the wheel.
That read to me like 'M-x mouse-wheel-mode' is concerned with enabling
the face increase/decrease feature. Should that bit be moved to the
end of the paragraph?
Robert
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-10 7:26 ` Eli Zaretskii
@ 2019-10-11 0:18 ` Stefan Kangas
0 siblings, 0 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-10-11 0:18 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Tak Kunihiro, Juri Linkov, Richard Stallman, 28182,
積丹尼 Dan Jacobson
Eli Zaretskii <eliz@gnu.org> writes:
> I think the text you wrote is OK, thanks.
Thanks, now pushed as commit ffb7100750.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-10 8:00 ` Robert Pluim
@ 2019-10-11 0:24 ` Stefan Kangas
2019-10-11 5:53 ` Robert Pluim
0 siblings, 1 reply; 57+ messages in thread
From: Stefan Kangas @ 2019-10-11 0:24 UTC (permalink / raw)
To: Robert Pluim
Cc: Richard Stallman, Juri Linkov, Tak Kunihiro, 28182,
積丹尼 Dan Jacobson
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
Robert Pluim <rpluim@gmail.com> writes:
> I took a look at the manual, it says:
>
> Some mice have a “wheel” which can be used for scrolling. Emacs
> supports scrolling windows with the mouse wheel, by default, on most
> graphical displays. There is also support for increasing or decreasing
> the height of the default face, by default bound to scrolling with the
> <Ctrl> modifier. To toggle this feature, use ‘M-x mouse-wheel-mode’.
> The variables ‘mouse-wheel-follow-mouse’ and ‘mouse-wheel-scroll-amount’
> determine where and by how much buffers are scrolled. The variable
> ‘mouse-wheel-progressive-speed’ determines whether the scroll speed is
> linked to how fast you move the wheel.
>
> That read to me like 'M-x mouse-wheel-mode' is concerned with enabling
> the face increase/decrease feature. Should that bit be moved to the
> end of the paragraph?
I think you're right that it could be more clear. Patch attached.
Best regards,
Stefan Kangas
[-- Attachment #2: 0001-Clarify-mouse-commands-section-in-manual.patch --]
[-- Type: text/x-patch, Size: 1778 bytes --]
From a7ec6669f789c7be706c4a91d8901b22c4c1b3a5 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Fri, 11 Oct 2019 02:21:08 +0200
Subject: [PATCH] Clarify mouse commands section in manual
* doc/emacs/frames.texi (Mouse Commands): Clarify section on mouse
wheel somewhat. (Bug#28182)
---
doc/emacs/frames.texi | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 169eebab3e..f93c5b168b 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -201,14 +201,14 @@ Mouse Commands
@vindex mouse-wheel-progressive-speed
Some mice have a ``wheel'' which can be used for scrolling. Emacs
supports scrolling windows with the mouse wheel, by default, on most
-graphical displays. There is also support for increasing or
-decreasing the height of the default face, by default bound to
-scrolling with the @key{Ctrl} modifier. To toggle this feature, use
-@kbd{M-x mouse-wheel-mode}. The variables
-@code{mouse-wheel-follow-mouse} and @code{mouse-wheel-scroll-amount}
-determine where and by how much buffers are scrolled. The variable
+graphical displays. To toggle this feature, use @kbd{M-x
+mouse-wheel-mode}. The variables @code{mouse-wheel-follow-mouse} and
+@code{mouse-wheel-scroll-amount} determine where and by how much
+buffers are scrolled. The variable
@code{mouse-wheel-progressive-speed} determines whether the scroll
-speed is linked to how fast you move the wheel.
+speed is linked to how fast you move the wheel. This mode also
+supports increasing or decreasing the height of the default face, by
+default bound to scrolling with the @key{Ctrl} modifier.
@vindex mouse-wheel-tilt-scroll
@vindex mouse-wheel-flip-direction
--
2.20.1
^ permalink raw reply related [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-11 0:24 ` Stefan Kangas
@ 2019-10-11 5:53 ` Robert Pluim
2019-10-13 22:05 ` Stefan Kangas
0 siblings, 1 reply; 57+ messages in thread
From: Robert Pluim @ 2019-10-11 5:53 UTC (permalink / raw)
To: Stefan Kangas
Cc: Richard Stallman, Juri Linkov, Tak Kunihiro, 28182,
積丹尼 Dan Jacobson
>>>>> On Fri, 11 Oct 2019 02:24:36 +0200, Stefan Kangas <stefan@marxist.se> said:
Stefan> Robert Pluim <rpluim@gmail.com> writes:
>> That read to me like 'M-x mouse-wheel-mode' is concerned with enabling
>> the face increase/decrease feature. Should that bit be moved to the
>> end of the paragraph?
Stefan> I think you're right that it could be more clear. Patch attached.
LGTM, thanks.
Robert
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-11 5:53 ` Robert Pluim
@ 2019-10-13 22:05 ` Stefan Kangas
0 siblings, 0 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-10-13 22:05 UTC (permalink / raw)
To: Robert Pluim
Cc: Richard Stallman, Juri Linkov, Tak Kunihiro, 28182,
積丹尼 Dan Jacobson
Robert Pluim <rpluim@gmail.com> writes:
> Stefan> I think you're right that it could be more clear. Patch attached.
>
> LGTM, thanks.
Thanks, pushed as commit ea7610f1f1.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-09-30 14:57 ` Richard Stallman
@ 2019-10-15 6:42 ` Stefan Kangas
2019-10-15 14:15 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 57+ messages in thread
From: Stefan Kangas @ 2019-10-15 6:42 UTC (permalink / raw)
To: Richard Stallman
Cc: Juri Linkov, Tak Kunihiro, 28182,
積丹尼 Dan Jacobson
Richard Stallman <rms@gnu.org> writes:
> > > > Please tell what is your problem, and why "C-x C-+" doesn't solve it?
> > >
> > > Does C-x C-+ increase the font size?
>
> > Yes. And "C-x C--" decreases it.
>
> It would be better to make C-+ do it also
> since people used to other applications will try that.
Does that make sense even if we don't change the corresponding C--
binding to decrease the font size?
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-15 6:42 ` Stefan Kangas
@ 2019-10-15 14:15 ` Drew Adams
2019-10-16 3:29 ` Richard Stallman
2019-10-15 17:51 ` Juri Linkov
2019-10-16 3:27 ` Richard Stallman
2 siblings, 1 reply; 57+ messages in thread
From: Drew Adams @ 2019-10-15 14:15 UTC (permalink / raw)
To: Stefan Kangas, Richard Stallman
Cc: Tak Kunihiro, Juri Linkov, 28182,
積丹尼 Dan Jacobson
> > > Does C-x C-+ increase the font size?
> > Yes. And "C-x C--" decreases it.
>
> It would be better to make C-+ do it also
> since people used to other applications will try that.
FWIW, if this is about binding `C-+' to do this
by default then I'm against it. (Just one opinion.)
Anyone can add such a binding, if s?he wants.
The argument that "other applications" have such
a binding is a pretty weak one, in general. And
I think it's pretty weak in this case too.
If it's really important to provide this because
users are used to such a binding in other apps
then provide a toggle function (e.g. global minor
mode) that binds that key. But don't bind it
by default. (The mode could also bind `C--', if
that's also important for those used to outside
bindings.)
---
FWIW:
I zoom buffer text and frames (face `default') all
the time - many times a day. I use `C-' plus mouse
wheel, which is also what "other applications" do.
Or I use `S-mouse-1' and `C-S-mouse-1'. Or I use
`C-x C--' and `C-x C-='.
But I make such bindings myself - I don't expect
Emacs to do that by default.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-15 6:42 ` Stefan Kangas
2019-10-15 14:15 ` Drew Adams
@ 2019-10-15 17:51 ` Juri Linkov
2019-10-16 3:27 ` Richard Stallman
2 siblings, 0 replies; 57+ messages in thread
From: Juri Linkov @ 2019-10-15 17:51 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 28182
>> > > > Please tell what is your problem, and why "C-x C-+" doesn't solve it?
>> > >
>> > > Does C-x C-+ increase the font size?
>>
>> > Yes. And "C-x C--" decreases it.
>>
>> It would be better to make C-+ do it also
>> since people used to other applications will try that.
>
> Does that make sense even if we don't change the corresponding C--
> binding to decrease the font size?
Rather not because it will violate user expectations that C-- is symmetric.
Now that we have the mouse zooming, the need in additional keys diminished.
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-15 6:42 ` Stefan Kangas
2019-10-15 14:15 ` Drew Adams
2019-10-15 17:51 ` Juri Linkov
@ 2019-10-16 3:27 ` Richard Stallman
2 siblings, 0 replies; 57+ messages in thread
From: Richard Stallman @ 2019-10-16 3:27 UTC (permalink / raw)
To: Stefan Kangas; +Cc: homeros.misasa, juri, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > > Yes. And "C-x C--" decreases it.
> >
> > It would be better to make C-+ do it also
> > since people used to other applications will try that.
> Does that make sense even if we don't change the corresponding C--
> binding to decrease the font size?
I think so. It could display a message saying "Use C-x C-- to
decrease font size", generating that based on the keymaps.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
* bug#28182: maybe implement CTRL++ to zoom text
2019-10-15 14:15 ` Drew Adams
@ 2019-10-16 3:29 ` Richard Stallman
0 siblings, 0 replies; 57+ messages in thread
From: Richard Stallman @ 2019-10-16 3:29 UTC (permalink / raw)
To: Drew Adams; +Cc: homeros.misasa, juri, stefan, 28182, jidanni
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> The argument that "other applications" have such
> a binding is a pretty weak one, in general.
It is strong enough, as a general rule, to be a reason tro do this if
there is no particular reason not to.
--
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 57+ messages in thread
end of thread, other threads:[~2019-10-16 3:29 UTC | newest]
Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <<87y3qcs3nf.fsf@jidanni.org>
[not found] ` <<831so3bror.fsf@gnu.org>
[not found] ` <<E1dkWS3-0005Wd-6g@fencepost.gnu.org>
2017-08-23 14:29 ` bug#28182: maybe implement CTRL++ to zoom text Drew Adams
2017-08-22 3:05 積丹尼 Dan Jacobson
2017-08-22 12:30 ` Nathan Moreau
2017-08-22 14:30 ` Eli Zaretskii
2017-08-23 14:16 ` Richard Stallman
2017-08-23 17:55 ` Eli Zaretskii
2017-08-23 23:05 ` Tak Kunihiro
2017-08-23 23:23 ` Drew Adams
2017-08-23 14:57 ` 積丹尼 Dan Jacobson
2017-08-23 15:55 ` Drew Adams
2017-08-23 16:05 ` 積丹尼 Dan Jacobson
2017-08-23 16:19 ` Drew Adams
2017-08-23 23:11 ` 積丹尼 Dan Jacobson
2017-08-23 23:28 ` Drew Adams
2019-08-21 1:51 ` Stefan Kangas
2019-08-21 2:12 ` Drew Adams
2019-08-21 13:19 ` Stefan Kangas
2019-08-24 22:06 ` Juri Linkov
2019-08-27 0:40 ` Stefan Kangas
2019-08-27 21:13 ` Juri Linkov
2019-09-28 13:09 ` Stefan Kangas
2019-09-28 13:48 ` Eli Zaretskii
2019-09-28 14:15 ` Stefan Kangas
2019-09-29 1:09 ` Richard Stallman
2019-09-29 1:40 ` Stefan Kangas
2019-09-29 7:36 ` Eli Zaretskii
2019-09-29 15:33 ` Richard Stallman
2019-09-29 15:40 ` Eli Zaretskii
2019-09-29 15:37 ` Richard Stallman
2019-09-29 15:44 ` Eli Zaretskii
2019-09-29 23:36 ` Richard Stallman
2019-09-30 3:52 ` Lars Ingebrigtsen
2019-09-30 6:16 ` Eli Zaretskii
2019-09-30 9:02 ` Robert Pluim
2019-09-30 9:16 ` Eli Zaretskii
2019-10-02 20:17 ` Alan Third
2019-09-30 14:57 ` Richard Stallman
2019-10-15 6:42 ` Stefan Kangas
2019-10-15 14:15 ` Drew Adams
2019-10-16 3:29 ` Richard Stallman
2019-10-15 17:51 ` Juri Linkov
2019-10-16 3:27 ` Richard Stallman
2019-10-05 23:56 ` Stefan Kangas
2019-10-06 17:28 ` Eli Zaretskii
2019-10-06 19:59 ` Stefan Kangas
2019-10-07 18:22 ` Juri Linkov
2019-10-08 14:56 ` Stefan Kangas
2019-10-08 21:58 ` Stefan Kangas
2019-10-09 6:08 ` Eli Zaretskii
2019-10-09 21:56 ` Stefan Kangas
2019-10-10 7:26 ` Eli Zaretskii
2019-10-11 0:18 ` Stefan Kangas
2019-10-10 8:00 ` Robert Pluim
2019-10-11 0:24 ` Stefan Kangas
2019-10-11 5:53 ` Robert Pluim
2019-10-13 22:05 ` Stefan Kangas
2019-10-09 20:54 ` Juri Linkov
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).