; Improve documentation of "C-x @"

* doc/emacs/custom.texi (Modifier Keys): Document how to enter
Shift, Control, and Meta using "C-x @".

* lisp/simple.el (function-key-map): Add commentary to "C-x @"
bindings to make them easier to discover.
This commit is contained in:
Eli Zaretskii 2022-12-23 14:37:04 +02:00
parent a0738e8ad1
commit 6dda2106ec
2 changed files with 7 additions and 1 deletions

View file

@ -1990,13 +1990,17 @@ to assign meanings to key bindings that use these modifiers. The
modifier bits are labeled as @samp{s-}, @samp{H-} and @samp{A-} modifier bits are labeled as @samp{s-}, @samp{H-} and @samp{A-}
respectively. respectively.
@cindex modifier keys unsupported by keyboard
Even if your keyboard lacks these additional modifier keys, you can Even if your keyboard lacks these additional modifier keys, you can
enter it using @kbd{C-x @@}: @kbd{C-x @@ h} adds the Hyper flag to enter them using @kbd{C-x @@}: @kbd{C-x @@ h} adds the Hyper flag to
the next character, @kbd{C-x @@ s} adds the Super flag, and the next character, @kbd{C-x @@ s} adds the Super flag, and
@kbd{C-x @@ a} adds the Alt flag. For instance, @kbd{C-x @@ h @kbd{C-x @@ a} adds the Alt flag. For instance, @kbd{C-x @@ h
C-a} is a way to enter @kbd{Hyper-Control-a}. (Unfortunately, there C-a} is a way to enter @kbd{Hyper-Control-a}. (Unfortunately, there
is no way to add two modifiers by using @kbd{C-x @@} twice for the is no way to add two modifiers by using @kbd{C-x @@} twice for the
same character, because the first one goes to work on the @kbd{C-x}.) same character, because the first one goes to work on the @kbd{C-x}.)
You can similarly enter the Shift, Control, and Meta modifiers by
using @kbd{C-x @ S}, @kbd{C-x @ c}, and @kbd{C-x @ m}, respectively,
although this is rarely needed.
@node Function Keys @node Function Keys
@subsection Rebinding Function Keys @subsection Rebinding Function Keys

View file

@ -10053,6 +10053,8 @@ PREFIX is the string that represents this modifier in an event type symbol."
event-type event-type
(cons event-type (cdr event))))))) (cons event-type (cdr event)))))))
;; This is what makes "C-x @" followed by [hsmaSc] work even though
;; you won't find any (define-key ctl-x-map "@" ...) binding.
(define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier) (define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier)
(define-key function-key-map [?\C-x ?@ ?s] 'event-apply-super-modifier) (define-key function-key-map [?\C-x ?@ ?s] 'event-apply-super-modifier)
(define-key function-key-map [?\C-x ?@ ?m] 'event-apply-meta-modifier) (define-key function-key-map [?\C-x ?@ ?m] 'event-apply-meta-modifier)