GNU bug report logs - #25189
Use `current-global-map' in `comint-insert-input'

Previous Next

Package: emacs;

Reported by: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>

Date: Tue, 13 Dec 2016 00:37:02 UTC

Severity: minor

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25189 in the body.
You can then email your comments to 25189 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Tue, 13 Dec 2016 00:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alexander Shukaev <emacs <at> Alexander.Shukaev.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 13 Dec 2016 00:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: bug-gnu-emacs <at> gnu.org
Subject: Use `current-global-map' in `comint-insert-input'
Date: Tue, 13 Dec 2016 01:36:08 +0100
Hi,

I think according to Emacs documentation it's more correct to change the

(lookup-key global-map (vector last-key))

form to the

(lookup-key (current-global-map) (vector last-key))

form.

Regards,
Alexander




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Sat, 27 Jul 2019 11:30:02 GMT) Full text and rfc822 format available.

Message #8 received at 25189 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 25189 <at> debbugs.gnu.org
Subject: Re: bug#25189: Use `current-global-map' in `comint-insert-input'
Date: Sat, 27 Jul 2019 13:29:17 +0200
Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:

> I think according to Emacs documentation it's more correct to change the
>
> (lookup-key global-map (vector last-key))
>
> form to the
>
> (lookup-key (current-global-map) (vector last-key))
>
> form.

(I'm going through older Emacs bug reports that have received no
response.)

Looking at the manual section in "Controlling Active Maps", there
doesn't seem to be anything to discourage using `global-map' directly
there.  I've grepped through the sources, though, and `global-map' is
used all over the place (while `current-global-map' is used less).

So this doesn't seem like something to be fixed, and I'm closing this
bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 27 Jul 2019 11:30:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 25189 <at> debbugs.gnu.org and Alexander Shukaev <emacs <at> Alexander.Shukaev.name> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 27 Jul 2019 11:30:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Aug 2019 11:24:10 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Alexander Shukaev <emacs <at> Alexander.Shukaev.name> to control <at> debbugs.gnu.org. (Mon, 16 Dec 2019 01:49:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Mon, 16 Dec 2019 01:59:01 GMT) Full text and rfc822 format available.

Message #19 received at 25189 <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 25189 <at> debbugs.gnu.org
Subject: Re: bug#25189: Use `current-global-map' in `comint-insert-input'
Date: Mon, 16 Dec 2019 02:58:04 +0100
On 7/27/19 1:29 PM, Lars Ingebrigtsen wrote:
> Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:
> 
>> I think according to Emacs documentation it's more correct to change the
>>
>> (lookup-key global-map (vector last-key))
>>
>> form to the
>>
>> (lookup-key (current-global-map) (vector last-key))
>>
>> form.
> 
> (I'm going through older Emacs bug reports that have received no
> response.)
> 
> Looking at the manual section in "Controlling Active Maps", there
> doesn't seem to be anything to discourage using `global-map' directly
> there.  I've grepped through the sources, though, and `global-map' is
> used all over the place (while `current-global-map' is used less).
> 
> So this doesn't seem like something to be fixed, and I'm closing this
> bug report.
> 

I believe you want to see the documentation of `global-map' for that point.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Tue, 24 Dec 2019 16:26:02 GMT) Full text and rfc822 format available.

Message #22 received at 25189 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 25189 <at> debbugs.gnu.org
Subject: Re: bug#25189: Use `current-global-map' in `comint-insert-input'
Date: Tue, 24 Dec 2019 17:25:26 +0100
Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:

> On 7/27/19 1:29 PM, Lars Ingebrigtsen wrote:
>> Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:
>> 
>>> I think according to Emacs documentation it's more correct to change the
>>>
>>> (lookup-key global-map (vector last-key))
>>>
>>> form to the
>>>
>>> (lookup-key (current-global-map) (vector last-key))
>>>
>>> form.
>> (I'm going through older Emacs bug reports that have received no
>> response.)
>> Looking at the manual section in "Controlling Active Maps", there
>> doesn't seem to be anything to discourage using `global-map' directly
>> there.  I've grepped through the sources, though, and `global-map' is
>> used all over the place (while `current-global-map' is used less).
>> So this doesn't seem like something to be fixed, and I'm closing
>> this
>> bug report.
>> 
>
> I believe you want to read the docstring of `global-map' for that point.

It would help if you could point to where you think Emacs says this.

This is the doc string of global-map:

global-map is a variable defined in ‘subr.el’.
Its value is shown below.

  This variable may be risky if used as a file-local variable.
  Probably introduced at or before Emacs version 21.1.

Documentation:
Default global keymap mapping Emacs keyboard input into commands.
The value is a keymap that is usually (but not necessarily) Emacs’s
global map.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Wed, 25 Dec 2019 10:01:02 GMT) Full text and rfc822 format available.

Message #25 received at 25189 <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 25189 <at> debbugs.gnu.org
Subject: Re: bug#25189: Use `current-global-map' in `comint-insert-input'
Date: Wed, 25 Dec 2019 10:59:56 +0100
On 12/24/19 5:25 PM, Lars Ingebrigtsen wrote:
> Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:
> 
>> On 7/27/19 1:29 PM, Lars Ingebrigtsen wrote:
>>> Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:
>>>
>>>> I think according to Emacs documentation it's more correct to change the
>>>>
>>>> (lookup-key global-map (vector last-key))
>>>>
>>>> form to the
>>>>
>>>> (lookup-key (current-global-map) (vector last-key))
>>>>
>>>> form.
>>> (I'm going through older Emacs bug reports that have received no
>>> response.)
>>> Looking at the manual section in "Controlling Active Maps", there
>>> doesn't seem to be anything to discourage using `global-map' directly
>>> there.  I've grepped through the sources, though, and `global-map' is
>>> used all over the place (while `current-global-map' is used less).
>>> So this doesn't seem like something to be fixed, and I'm closing
>>> this
>>> bug report.
>>>
>>
>> I believe you want to read the docstring of `global-map' for that point.
> 
> It would help if you could point to where you think Emacs says this.
> 
> This is the doc string of global-map:
> 
> global-map is a variable defined in ‘subr.el’.
> Its value is shown below.
> 
>    This variable may be risky if used as a file-local variable.
>    Probably introduced at or before Emacs version 21.1.
> 
> Documentation:
> Default global keymap mapping Emacs keyboard input into commands.
> The value is a keymap that is usually (but not necessarily) Emacs’s
> global map.
> 
> 

In particular,

> The value is a keymap that is usually (but not necessarily) Emacs’s
> global map.

So it's not necessarily the current global keymap.  Hence, applying 
`define-key' (or any other mutating function to it), may not take any 
effect and do what is expected.  It is safer to always use 
`current-global-map'.  At least that is my understanding why there are 
special functions like `current-global-map' for accessing and 
`use-global-map' for assignment.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Wed, 25 Dec 2019 21:41:02 GMT) Full text and rfc822 format available.

Message #28 received at 25189 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 25189 <at> debbugs.gnu.org
Subject: Re: bug#25189: Use `current-global-map' in `comint-insert-input'
Date: Wed, 25 Dec 2019 22:39:51 +0100
Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:

>> The value is a keymap that is usually (but not necessarily) Emacs’s
>> global map.
>
> So it's not necessarily the current global keymap.  Hence, applying
> `define-key' (or any other mutating function to it), may not take any 
> effect and do what is expected.  It is safer to always use
> `current-global-map'.  At least that is my understanding why there are 
> special functions like `current-global-map' for accessing and
> `use-global-map' for assignment.

I'm unable to read any such thing from the documentation (or usage) of
those functions.  A handful of places use use-global-map to alter what
global map is in usage, and I see no indication that functions like
comint-insert-input would want to alter these other maps instead of
(the real) global-map.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25189; Package emacs. (Thu, 26 Dec 2019 00:33:01 GMT) Full text and rfc822 format available.

Message #31 received at 25189 <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 25189 <at> debbugs.gnu.org
Subject: Re: bug#25189: Use `current-global-map' in `comint-insert-input'
Date: Thu, 26 Dec 2019 01:32:00 +0100
On 12/25/19 10:39 PM, Lars Ingebrigtsen wrote:
> Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:
> 
>>> The value is a keymap that is usually (but not necessarily) Emacs’s
>>> global map.
>>
>> So it's not necessarily the current global keymap.  Hence, applying
>> `define-key' (or any other mutating function to it), may not take any
>> effect and do what is expected.  It is safer to always use
>> `current-global-map'.  At least that is my understanding why there are
>> special functions like `current-global-map' for accessing and
>> `use-global-map' for assignment.
> 
> I'm unable to read any such thing from the documentation (or usage) of
> those functions.  A handful of places use use-global-map to alter what
> global map is in usage, and I see no indication that functions like
> comint-insert-input would want to alter these other maps instead of
> (the real) global-map.
> 

There is no "real" global map.  There is only one current global map, 
any that can be chosen by user at any point in time.  Emacs is 
inconsistent in how it uses either `global-map' or 
`(current-global-map)' to assign key bindings.  I would guess this is 
due to historical reasons of `current-global-map' appearing later than 
`global-map'.  This is more of a call to review the Emacs code base 
and/or documentation with respect to this inconsistency in order to 
decide what is the conventional/consistent approach to bind keys to a 
global map as both have advantages and disadvantages.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 23 Jan 2020 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 95 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.