* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
@ 2019-10-15 19:07 Alan Mackenzie
2019-10-17 3:00 ` Lars Ingebrigtsen
2019-10-17 9:17 ` Andreas Schwab
0 siblings, 2 replies; 13+ messages in thread
From: Alan Mackenzie @ 2019-10-15 19:07 UTC (permalink / raw)
To: 37769
Hello, Emacs
On the master branch, global-set-key calls read-key-sequence, but wrongly
fails to set the DONT-DOWNCASE-LAST argument. The doc-string for
read-key-sequence rightly notes "A non-nil value is appropriate for
reading a key sequence to be defined.".
As a consequence, it is impossible to use M-x global-set-key to bind
S-tab on a tty where local-function-key-map converts S-tab to [33554441]
= 2^25 + 9.
The fix is easy:
diff --git a/lisp/subr.el b/lisp/subr.el
index 1a4a2e8b81..f3371dd2d7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1120,7 +1120,7 @@ global-set-key
that you make with this function."
(interactive
(let* ((menu-prompting nil)
- (key (read-key-sequence "Set key globally: ")))
+ (key (read-key-sequence "Set key globally: " nil t)))
(list key
(read-command (format "Set key %s to command: "
(key-description key))))))
This fix should also be safe, since it is only in the interactive spec
part of the function, and thus can only affect interactive use.
Any objections to me installing this fix on the master branch?
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply related [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-15 19:07 bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab) Alan Mackenzie
@ 2019-10-17 3:00 ` Lars Ingebrigtsen
2019-10-17 8:16 ` Eli Zaretskii
2019-10-17 15:58 ` Alan Mackenzie
2019-10-17 9:17 ` Andreas Schwab
1 sibling, 2 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-17 3:00 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: 37769
Alan Mackenzie <acm@muc.de> writes:
> As a consequence, it is impossible to use M-x global-set-key to bind
> S-tab on a tty where local-function-key-map converts S-tab to [33554441]
> = 2^25 + 9.
[...]
> This fix should also be safe, since it is only in the interactive spec
> part of the function, and thus can only affect interactive use.
>
> Any objections to me installing this fix on the master branch?
Hm... but you can't use S-tab on a tty, surely? So we're offering to
interactively bind a key that can't be used (after this change)? Or am
I misunderstanding something?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-17 3:00 ` Lars Ingebrigtsen
@ 2019-10-17 8:16 ` Eli Zaretskii
2019-10-17 15:58 ` Alan Mackenzie
1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2019-10-17 8:16 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: acm, 37769
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Thu, 17 Oct 2019 05:00:11 +0200
> Cc: 37769@debbugs.gnu.org
>
> > Any objections to me installing this fix on the master branch?
>
> Hm... but you can't use S-tab on a tty, surely? So we're offering to
> interactively bind a key that can't be used (after this change)? Or am
> I misunderstanding something?
When I hold Shift and press TAB on a TTY frame, Emacs receives
<backtab>, so I don't think I understand why you say it's impossible.
It is possible at least with some terminals.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-15 19:07 bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab) Alan Mackenzie
2019-10-17 3:00 ` Lars Ingebrigtsen
@ 2019-10-17 9:17 ` Andreas Schwab
2019-10-17 16:00 ` Alan Mackenzie
1 sibling, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2019-10-17 9:17 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: 37769
On Okt 15 2019, Alan Mackenzie <acm@muc.de> wrote:
> As a consequence, it is impossible to use M-x global-set-key to bind
> S-tab on a tty where local-function-key-map converts S-tab to [33554441]
> = 2^25 + 9.
Why is that wrong? [33554441] _is_ S-TAB.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-17 3:00 ` Lars Ingebrigtsen
2019-10-17 8:16 ` Eli Zaretskii
@ 2019-10-17 15:58 ` Alan Mackenzie
2019-10-18 3:09 ` Lars Ingebrigtsen
1 sibling, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2019-10-17 15:58 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 37769
Hello, Lars.
On Thu, Oct 17, 2019 at 05:00:11 +0200, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@muc.de> writes:
> > As a consequence, it is impossible to use M-x global-set-key to bind
> > S-tab on a tty where local-function-key-map converts S-tab to [33554441]
> > = 2^25 + 9.
> [...]
> > This fix should also be safe, since it is only in the interactive spec
> > part of the function, and thus can only affect interactive use.
> > Any objections to me installing this fix on the master branch?
> Hm... but you can't use S-tab on a tty, surely?
_I_ can, because I've set up my (Linux) tty's keyboard and Emacs to do
this. (This according to a scheme written by Kalle Niemitalo about
twenty years ago.)
> So we're offering to interactively bind a key that can't be used (after
> this change)? Or am I misunderstanding something?
The same problem applies to any unused keybinding involving an upper case
letter. For example, if you tried to bind C-M-S-a on a tty with M-x
global-set-key, that function would bind C-M-a instead. This is not
good.
I can't see see any circumstances where a user would want such a
keybinding to be downcased. Nearly all of the time, she will have
expressly pressed the shift key.
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-17 9:17 ` Andreas Schwab
@ 2019-10-17 16:00 ` Alan Mackenzie
0 siblings, 0 replies; 13+ messages in thread
From: Alan Mackenzie @ 2019-10-17 16:00 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 37769
Hello, Andreas.
On Thu, Oct 17, 2019 at 11:17:48 +0200, Andreas Schwab wrote:
> On Okt 15 2019, Alan Mackenzie <acm@muc.de> wrote:
> > As a consequence, it is impossible to use M-x global-set-key to bind
> > S-tab on a tty where local-function-key-map converts S-tab to [33554441]
> > = 2^25 + 9.
> Why is that wrong? [33554441] _is_ S-TAB.
Yes. But if you type the key binding into M-x global-set-key, it will
erroneously bind TAB rather than S-TAB.
> Andreas.
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-17 15:58 ` Alan Mackenzie
@ 2019-10-18 3:09 ` Lars Ingebrigtsen
2019-10-18 7:11 ` Eli Zaretskii
0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-18 3:09 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: 37769
Alan Mackenzie <acm@muc.de> writes:
>> Hm... but you can't use S-tab on a tty, surely?
>
> _I_ can, because I've set up my (Linux) tty's keyboard and Emacs to do
> this. (This according to a scheme written by Kalle Niemitalo about
> twenty years ago.)
Hm, I think I was confused thinking that TAB was the same as C-i on a
tty, and thinking about how you can't bind C-I in non-graphical
environments. But I see that instead I get TAB when I run under a
tty -- both on the TAB key and when hitting C-i? And S-TAB gives me a
backtab event? But C-S-i gives me a TAB event.
Hm.
>> So we're offering to interactively bind a key that can't be used (after
>> this change)? Or am I misunderstanding something?
>
> The same problem applies to any unused keybinding involving an upper case
> letter. For example, if you tried to bind C-M-S-a on a tty with M-x
> global-set-key, that function would bind C-M-a instead. This is not
> good.
>
> I can't see see any circumstances where a user would want such a
> keybinding to be downcased. Nearly all of the time, she will have
> expressly pressed the shift key.
But if you M-: (global-set-key (kbd "C-M-S-o") 'previous-line) and then
hit C-M-S-o, then Emacs will try to execute the command bound to C-M-o,
so at least there it makes sense for the interactive spec to downcase,
doesn't it? Because that will at least bind something that can be
executed with the same chord that the user hit (even if it wasn't the
chord the user expected).
But I see that M-x global-set-key does the same under guis, and it
doesn't make much sense there.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-18 3:09 ` Lars Ingebrigtsen
@ 2019-10-18 7:11 ` Eli Zaretskii
2019-10-19 8:02 ` Lars Ingebrigtsen
0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-10-18 7:11 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: acm, 37769
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 18 Oct 2019 05:09:36 +0200
> Cc: 37769@debbugs.gnu.org
>
> Hm, I think I was confused thinking that TAB was the same as C-i on a
> tty, and thinking about how you can't bind C-I in non-graphical
> environments. But I see that instead I get TAB when I run under a
> tty -- both on the TAB key and when hitting C-i? And S-TAB gives me a
> backtab event? But C-S-i gives me a TAB event.
>
> Hm.
That's Emacs translation of events in action, sometimes aided by the
keyboard driver, and sometimes just an emulation (depending on the
terminal emulator you use).
> > The same problem applies to any unused keybinding involving an upper case
> > letter. For example, if you tried to bind C-M-S-a on a tty with M-x
> > global-set-key, that function would bind C-M-a instead. This is not
> > good.
> >
> > I can't see see any circumstances where a user would want such a
> > keybinding to be downcased. Nearly all of the time, she will have
> > expressly pressed the shift key.
>
> But if you M-: (global-set-key (kbd "C-M-S-o") 'previous-line) and then
> hit C-M-S-o, then Emacs will try to execute the command bound to C-M-o,
> so at least there it makes sense for the interactive spec to downcase,
> doesn't it? Because that will at least bind something that can be
> executed with the same chord that the user hit (even if it wasn't the
> chord the user expected).
>
> But I see that M-x global-set-key does the same under guis, and it
> doesn't make much sense there.
I admit I don't understand what both of you think is not good or make
no sense. Emacs has been downcasing keys since day one, if the upper
case has no binding. The reason is to allow the user not to have to
release the Shift key too fast when typing fast.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-18 7:11 ` Eli Zaretskii
@ 2019-10-19 8:02 ` Lars Ingebrigtsen
2019-10-19 8:53 ` Andreas Schwab
2019-10-19 9:36 ` Eli Zaretskii
0 siblings, 2 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-19 8:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: acm, 37769
Eli Zaretskii <eliz@gnu.org> writes:
> I admit I don't understand what both of you think is not good or make
> no sense. Emacs has been downcasing keys since day one, if the upper
> case has no binding. The reason is to allow the user not to have to
> release the Shift key too fast when typing fast.
The complaint is that the interactive spec of global-set-key downcases
whatever the user enters.
M-x global-set-key RET C-S-o
will bind C-o, not C-S-o. (Well, the case in question was about TAB,
aka C-i, but...) This is surprising, and should be fixed, I think (and
the patch suggested fixes this).
I entered the discussion because I thought that this would be a bad
change on ttys, because Emacs would then go ahead and bind the `C-S-o'
key -- which then couldn't be used by the user, because there's no way
to use shifted control keys under a tty. At least I don't think so?
If this is the case, I think the original patch should be applied, but
if we're running in an environment where `C-S-o' can't be entered (i.e.,
not on a gui), then the command should error out or give a warning, at
least.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-19 8:02 ` Lars Ingebrigtsen
@ 2019-10-19 8:53 ` Andreas Schwab
2019-10-19 9:03 ` Lars Ingebrigtsen
2019-10-19 9:36 ` Eli Zaretskii
1 sibling, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2019-10-19 8:53 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: acm, 37769
On Okt 19 2019, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> I entered the discussion because I thought that this would be a bad
> change on ttys, because Emacs would then go ahead and bind the `C-S-o'
> key -- which then couldn't be used by the user, because there's no way
> to use shifted control keys under a tty. At least I don't think so?
If M-x global-set-key can receive C-S-o, then you can also execute the
resulting binding.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-19 8:53 ` Andreas Schwab
@ 2019-10-19 9:03 ` Lars Ingebrigtsen
0 siblings, 0 replies; 13+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-19 9:03 UTC (permalink / raw)
To: Andreas Schwab; +Cc: acm, 37769
Andreas Schwab <schwab@linux-m68k.org> writes:
> On Okt 19 2019, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
>> I entered the discussion because I thought that this would be a bad
>> change on ttys, because Emacs would then go ahead and bind the `C-S-o'
>> key -- which then couldn't be used by the user, because there's no way
>> to use shifted control keys under a tty. At least I don't think so?
>
> If M-x global-set-key can receive C-S-o, then you can also execute the
> resulting binding.
Oh, yeah. OK, then I think Alan's patch should go in as is, but as it's
a behavioural change, it should probably be noted in NEWS.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-19 8:02 ` Lars Ingebrigtsen
2019-10-19 8:53 ` Andreas Schwab
@ 2019-10-19 9:36 ` Eli Zaretskii
2019-10-19 18:26 ` Alan Mackenzie
1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-10-19 9:36 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: acm, 37769
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: acm@muc.de, 37769@debbugs.gnu.org
> Date: Sat, 19 Oct 2019 10:02:15 +0200
>
> The complaint is that the interactive spec of global-set-key downcases
> whatever the user enters.
>
> M-x global-set-key RET C-S-o
>
> will bind C-o, not C-S-o. (Well, the case in question was about TAB,
> aka C-i, but...) This is surprising, and should be fixed, I think (and
> the patch suggested fixes this).
>
> I entered the discussion because I thought that this would be a bad
> change on ttys, because Emacs would then go ahead and bind the `C-S-o'
> key -- which then couldn't be used by the user, because there's no way
> to use shifted control keys under a tty. At least I don't think so?
>
> If this is the case, I think the original patch should be applied, but
> if we're running in an environment where `C-S-o' can't be entered (i.e.,
> not on a gui), then the command should error out or give a warning, at
> least.
Ah, okay. Yes, I think Alan's change should be installed, but FWIW I
don't see a need for any warning (and we will have hard time knowing
when to show it, given the different capabilities of different
terminal emulators).
Thanks.
^ permalink raw reply [flat|nested] 13+ messages in thread
* bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab).
2019-10-19 9:36 ` Eli Zaretskii
@ 2019-10-19 18:26 ` Alan Mackenzie
0 siblings, 0 replies; 13+ messages in thread
From: Alan Mackenzie @ 2019-10-19 18:26 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 37769-done
Hello, Eli.
On Sat, Oct 19, 2019 at 12:36:07 +0300, Eli Zaretskii wrote:
> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > Cc: acm@muc.de, 37769@debbugs.gnu.org
> > Date: Sat, 19 Oct 2019 10:02:15 +0200
> > The complaint is that the interactive spec of global-set-key downcases
> > whatever the user enters.
> > M-x global-set-key RET C-S-o
> > will bind C-o, not C-S-o. (Well, the case in question was about TAB,
> > aka C-i, but...) This is surprising, and should be fixed, I think (and
> > the patch suggested fixes this).
> > I entered the discussion because I thought that this would be a bad
> > change on ttys, because Emacs would then go ahead and bind the `C-S-o'
> > key -- which then couldn't be used by the user, because there's no way
> > to use shifted control keys under a tty. At least I don't think so?
> > If this is the case, I think the original patch should be applied, but
> > if we're running in an environment where `C-S-o' can't be entered (i.e.,
> > not on a gui), then the command should error out or give a warning, at
> > least.
> Ah, okay. Yes, I think Alan's change should be installed, but FWIW I
> don't see a need for any warning (and we will have hard time knowing
> when to show it, given the different capabilities of different
> terminal emulators).
Thanks, I've installed it, together with an entry in NEWS.
With this, I'm closing the bug.
> Thanks.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-10-19 18:26 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-15 19:07 bug#37769: global-set-key wrongly downcases the typed key (e.g. S-tab) Alan Mackenzie
2019-10-17 3:00 ` Lars Ingebrigtsen
2019-10-17 8:16 ` Eli Zaretskii
2019-10-17 15:58 ` Alan Mackenzie
2019-10-18 3:09 ` Lars Ingebrigtsen
2019-10-18 7:11 ` Eli Zaretskii
2019-10-19 8:02 ` Lars Ingebrigtsen
2019-10-19 8:53 ` Andreas Schwab
2019-10-19 9:03 ` Lars Ingebrigtsen
2019-10-19 9:36 ` Eli Zaretskii
2019-10-19 18:26 ` Alan Mackenzie
2019-10-17 9:17 ` Andreas Schwab
2019-10-17 16:00 ` Alan Mackenzie
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).