unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25189: Use `current-global-map' in `comint-insert-input'
@ 2016-12-13  0:36 Alexander Shukaev
  2019-07-27 11:29 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Shukaev @ 2016-12-13  0:36 UTC (permalink / raw)
  To: 25189

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#25189: Use `current-global-map' in `comint-insert-input'
  2016-12-13  0:36 bug#25189: Use `current-global-map' in `comint-insert-input' Alexander Shukaev
@ 2019-07-27 11:29 ` Lars Ingebrigtsen
  2019-12-16  1:58   ` Alexander Shukaev
       [not found]   ` <45ae521c-6f37-292e-c169-9ed591cb0504@Alexander.Shukaev.name>
  0 siblings, 2 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-27 11:29 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 25189

Alexander Shukaev <emacs@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#25189: Use `current-global-map' in `comint-insert-input'
  2019-07-27 11:29 ` Lars Ingebrigtsen
@ 2019-12-16  1:58   ` Alexander Shukaev
       [not found]   ` <45ae521c-6f37-292e-c169-9ed591cb0504@Alexander.Shukaev.name>
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Shukaev @ 2019-12-16  1:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 25189

On 7/27/19 1:29 PM, Lars Ingebrigtsen wrote:
> Alexander Shukaev <emacs@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#25189: Use `current-global-map' in `comint-insert-input'
       [not found]   ` <45ae521c-6f37-292e-c169-9ed591cb0504@Alexander.Shukaev.name>
@ 2019-12-24 16:25     ` Lars Ingebrigtsen
  2019-12-25  9:59       ` Alexander Shukaev
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-12-24 16:25 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 25189

Alexander Shukaev <emacs@Alexander.Shukaev.name> writes:

> On 7/27/19 1:29 PM, Lars Ingebrigtsen wrote:
>> Alexander Shukaev <emacs@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#25189: Use `current-global-map' in `comint-insert-input'
  2019-12-24 16:25     ` Lars Ingebrigtsen
@ 2019-12-25  9:59       ` Alexander Shukaev
  2019-12-25 21:39         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Shukaev @ 2019-12-25  9:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 25189

On 12/24/19 5:25 PM, Lars Ingebrigtsen wrote:
> Alexander Shukaev <emacs@Alexander.Shukaev.name> writes:
> 
>> On 7/27/19 1:29 PM, Lars Ingebrigtsen wrote:
>>> Alexander Shukaev <emacs@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#25189: Use `current-global-map' in `comint-insert-input'
  2019-12-25  9:59       ` Alexander Shukaev
@ 2019-12-25 21:39         ` Lars Ingebrigtsen
  2019-12-26  0:32           ` Alexander Shukaev
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-12-25 21:39 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: 25189

Alexander Shukaev <emacs@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#25189: Use `current-global-map' in `comint-insert-input'
  2019-12-25 21:39         ` Lars Ingebrigtsen
@ 2019-12-26  0:32           ` Alexander Shukaev
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Shukaev @ 2019-12-26  0:32 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 25189

On 12/25/19 10:39 PM, Lars Ingebrigtsen wrote:
> Alexander Shukaev <emacs@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-26  0:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13  0:36 bug#25189: Use `current-global-map' in `comint-insert-input' Alexander Shukaev
2019-07-27 11:29 ` Lars Ingebrigtsen
2019-12-16  1:58   ` Alexander Shukaev
     [not found]   ` <45ae521c-6f37-292e-c169-9ed591cb0504@Alexander.Shukaev.name>
2019-12-24 16:25     ` Lars Ingebrigtsen
2019-12-25  9:59       ` Alexander Shukaev
2019-12-25 21:39         ` Lars Ingebrigtsen
2019-12-26  0:32           ` Alexander Shukaev

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).