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: Thu, 26 Dec 2019 01:32:00 +0100

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.





reply via email to

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