bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25189: Use `current-global-map' in `comint-insert-input'


From: Alexander Shukaev
Subject: 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@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]