Don't recommend legacy keymap functions in documentation

* doc/emacs/mule.texi (Input Methods):
* doc/lispintro/emacs-lisp-intro.texi (Miscellaneous):
* doc/lispref/text.texi (Clickable Text):
* doc/misc/calc.texi (Defining Functions, Defining Simple Commands)
(Customizing Calc):
* doc/misc/efaq.texi (Matching parentheses, Modifying pull-down menus)
(Deleting menus and menu options, Binding keys to commands)
(Invalid prefix characters)
(Terminal setup code works after Emacs has begun)
(Backspace invokes help, Swapping keys, No Escape key)
(Binding combinations of modifiers and function keys)
(Replying to the sender of a message):
* doc/misc/eudc.texi (Installation, Emacs-only Configuration)
(External Configuration):
* doc/misc/gnus.texi (Group Parameters, Misc Group Stuff)
(Summary Buffer, Generic Marking Commands, RSS)
(nnmairix tips and tricks, Oort Gnus):
* doc/misc/ido.texi (Customization):
* doc/misc/mairix-el.texi (Using):
* doc/misc/mh-e.texi (HTML, Miscellaneous Commands and Options)
(Folders, Composing):
* doc/misc/octave-mode.texi (Running Octave from Within Emacs):
* doc/misc/reftex.texi (Citations Outside LaTeX):
* doc/misc/remember.texi (Quick Start):
* doc/misc/sem-user.texi (Smart Jump):
* doc/misc/viper.texi (Key Bindings, Vi Macros):
* doc/misc/widget.texi (Defining New Widgets):
* doc/misc/woman.texi (Word at point): Recommend 'keymap-set',
'keymap-global-set', 'keymap-global-unset', 'keymap-local-set', and
'key-translate', instead of their legacy equivalents.  (Bug#55647)
This commit is contained in:
Stefan Kangas 2025-03-11 21:18:24 +01:00
parent 0c8d30045b
commit 96a704346a
17 changed files with 109 additions and 113 deletions

View file

@ -573,7 +573,7 @@ not when you are in the minibuffer).
function that you add to the hook variable @code{quail-activate-hook}. function that you add to the hook variable @code{quail-activate-hook}.
@xref{Hooks}. For example, you can redefine some of the input @xref{Hooks}. For example, you can redefine some of the input
method's keys by defining key bindings in the keymap returned by the method's keys by defining key bindings in the keymap returned by the
function @code{quail-translation-keymap}, using @code{define-key}. function @code{quail-translation-keymap}, using @code{keymap-set}.
@xref{Init Rebinding}. @xref{Init Rebinding}.
Input methods are inhibited when the text in the buffer is read-only Input methods are inhibited when the text in the buffer is read-only

View file

@ -17873,10 +17873,10 @@ problem recently.)
@smallexample @smallexample
@group @group
;; Translate 'C-h' to <DEL>. ;; Translate 'C-h' to <DEL>.
; (keyboard-translate ?\C-h ?\C-?) ; (key-translate "C-h" "C-?")
;; Translate <DEL> to 'C-h'. ;; Translate <DEL> to 'C-h'.
(keyboard-translate ?\C-? ?\C-h) (key-translate "C-?" "C-h")
@end group @end group
@end smallexample @end smallexample

View file

@ -4291,7 +4291,7 @@ bind it within the link text, using the @code{keymap} text property
@example @example
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map [mouse-2] 'operate-this-button) (keymap-set map "<mouse-2>" 'operate-this-button)
(put-text-property link-start link-end 'keymap map)) (put-text-property link-start link-end 'keymap map))
@end example @end example

View file

@ -32370,7 +32370,7 @@ has the advantage that it is quietly ignored if @code{calc-check-defines}
is not yet defined because Calc has not yet been loaded. is not yet defined because Calc has not yet been loaded.
Examples of things that ought to be enclosed in a @code{calc-define} Examples of things that ought to be enclosed in a @code{calc-define}
property are @code{defmath} calls, @code{define-key} calls that modify property are @code{defmath} calls, @code{keymap-set} calls that modify
the Calc key map, and any calls that redefine things defined inside Calc. the Calc key map, and any calls that redefine things defined inside Calc.
Ordinary @code{defun}s need not be enclosed with @code{calc-define}. Ordinary @code{defun}s need not be enclosed with @code{calc-define}.
@ -32478,7 +32478,7 @@ there.
@vindex calc-Y-help-msgs @vindex calc-Y-help-msgs
Calc reserves a special prefix key, shift-@kbd{Y}, for user-written Calc reserves a special prefix key, shift-@kbd{Y}, for user-written
extensions to Calc. There are no built-in commands that work with extensions to Calc. There are no built-in commands that work with
this prefix key; you must call @code{define-key} from Lisp (probably this prefix key; you must call @code{keymap-set} from Lisp (probably
from inside a @code{calc-define} property) to add to it. Initially only from inside a @code{calc-define} property) to add to it. Initially only
@kbd{Y ?} is defined; it takes help messages from a list of strings @kbd{Y ?} is defined; it takes help messages from a list of strings
(initially @code{nil}) in the variable @code{calc-Y-help-msgs}. All (initially @code{nil}) in the variable @code{calc-Y-help-msgs}. All
@ -32512,9 +32512,9 @@ decreases the precision.
(put 'calc-define 'inc-prec '(progn (put 'calc-define 'inc-prec '(progn
(define-key calc-mode-map (format "Y%sI" inc-prec-base-key) (keymap-set calc-mode-map (format "Y %s I" inc-prec-base-key)
'calc-increase-precision) 'calc-increase-precision)
(define-key calc-mode-map (format "Y%sD" inc-prec-base-key) (keymap-set calc-mode-map (format "Y %s D" inc-prec-base-key)
'calc-decrease-precision) 'calc-decrease-precision)
(setq calc-Y-help-msgs (setq calc-Y-help-msgs
@ -35297,7 +35297,7 @@ The usual prefix for Calc is the key sequence @kbd{C-x *}. If you wish
to use a different prefix, you can put to use a different prefix, you can put
@example @example
(global-set-key "NEWPREFIX" 'calc-dispatch) (keymap-global-set "NEWPREFIX" 'calc-dispatch)
@end example @end example
@noindent @noindent

View file

@ -2622,7 +2622,7 @@ parenthesis, it simply inserts a % like normal.
@lisp @lisp
;; By an unknown contributor ;; By an unknown contributor
(global-set-key "%" 'match-paren) (keymap-global-set "%" 'match-paren)
(defun match-paren (arg) (defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %." "Go to the matching paren if on a paren; otherwise insert %."
@ -3012,8 +3012,8 @@ new definition to the appropriate keymap. Adding a @samp{Forward Word}
item to the @samp{Edit} menu thus requires the following Lisp code: item to the @samp{Edit} menu thus requires the following Lisp code:
@lisp @lisp
(define-key global-map (keymap-set global-map
[menu-bar edit forward] "<menu-bar> <edit> <forward>"
'("Forward word" . forward-word)) '("Forward word" . forward-word))
@end lisp @end lisp
@ -3035,7 +3035,7 @@ To add a new menu, rather than a new option to an existing menu, we must
define an entirely new keymap: define an entirely new keymap:
@lisp @lisp
(define-key global-map [menu-bar words] (keymap-set global-map "<menu-bar> <words>"
(cons "Words" (make-sparse-keymap "Words"))) (cons "Words" (make-sparse-keymap "Words")))
@end lisp @end lisp
@ -3045,8 +3045,8 @@ The above code creates a new sparse keymap, gives it the name
following code: following code:
@lisp @lisp
(define-key global-map (keymap-set global-map
[menu-bar words forward] "<menu-bar> <words> <forward>"
'("Forward word" . forward-word)) '("Forward word" . forward-word))
@end lisp @end lisp
@ -3057,26 +3057,26 @@ define menu options @samp{foo}, @samp{bar}, and @samp{baz} (in that
order), the menu option @samp{baz} would appear at the top, and order), the menu option @samp{baz} would appear at the top, and
@samp{foo} would be at the bottom. @samp{foo} would be at the bottom.
One way to avoid this problem is to use the function @code{define-key-after}, One way to avoid this problem is to use the function @code{keymap-set-after},
which works the same as @code{define-key}, but lets you modify where items which works the same as @code{keymap-set}, but lets you modify where items
appear. The following Lisp code would insert the @samp{Forward Word} appear. The following Lisp code would insert the @samp{Forward Word}
item in the @samp{Edit} menu immediately following the @samp{Undo} item: item in the @samp{Edit} menu immediately following the @samp{Undo} item:
@lisp @lisp
(define-key-after (keymap-set-after
(lookup-key global-map [menu-bar edit]) (keymap-lookup global-map "<menu-bar> <edit>")
[forward] "<forward>"
'("Forward word" . forward-word) '("Forward word" . forward-word)
'undo) 'undo)
@end lisp @end lisp
Note how the second and third arguments to @code{define-key-after} are Note how the second and third arguments to @code{keymap-set-after} are
different from those of @code{define-key}, and that we have added a new different from those of @code{keymap-set}, and that we have added a new
(final) argument, the function after which our new key should be (final) argument, the function after which our new key should be
defined. defined.
To move a menu option from one position to another, simply evaluate To move a menu option from one position to another, simply evaluate
@code{define-key-after} with the appropriate final argument. @code{keymap-set-after} with the appropriate final argument.
More detailed information---and more examples of how to create and More detailed information---and more examples of how to create and
modify menu options---are in the @cite{Emacs Lisp Reference Manual}, under modify menu options---are in the @cite{Emacs Lisp Reference Manual}, under
@ -3093,7 +3093,7 @@ For example, to delete the @samp{Words} menu (@pxref{Modifying pull-down
menus}), use: menus}), use:
@lisp @lisp
(define-key global-map [menu-bar words] nil) (keymap-set global-map "<menu-bar> <words>" nil)
@end lisp @end lisp
Similarly, removing a menu option requires redefining a keymap entry to Similarly, removing a menu option requires redefining a keymap entry to
@ -3102,7 +3102,7 @@ from the @samp{Edit} menu (we added it in @ref{Modifying pull-down
menus}), use: menus}), use:
@lisp @lisp
(define-key global-map [menu-bar edit forward] nil) (keymap-set global-map "<menu-bar> <edit> <forward>" nil)
@end lisp @end lisp
@node Turning on syntax highlighting @node Turning on syntax highlighting
@ -4083,11 +4083,11 @@ information is available from
Keys can be bound to commands either interactively or in your init Keys can be bound to commands either interactively or in your init
file (@pxref{Setting up a customization file}). To interactively bind file (@pxref{Setting up a customization file}). To interactively bind
keys for all modes, type @kbd{M-x global-set-key @key{RET} @var{key} keys for all modes, type @kbd{M-x keymap-global-set @key{RET} @var{key}
@var{cmd} @key{RET}}. @var{cmd} @key{RET}}.
To bind a key just in the current major mode, type @kbd{M-x To bind a key just in the current major mode, type @kbd{M-x
local-set-key @key{RET} @var{key} @var{cmd} @key{RET}}. keymap-local-set @key{RET} @var{key} @var{cmd} @key{RET}}.
@xref{Key Bindings,,, emacs, The GNU Emacs Manual}. @xref{Key Bindings,,, emacs, The GNU Emacs Manual}.
@ -4099,7 +4099,7 @@ init file. If the key binding is global, no changes to the
command are required. For example, command are required. For example,
@lisp @lisp
(global-set-key [f1] 'help-for-help) (keymap-global-set "<f1>" 'help-for-help)
@end lisp @end lisp
@noindent @noindent
@ -4110,7 +4110,7 @@ function. For example, in TeX mode, a local binding might be
@lisp @lisp
(add-hook 'tex-mode-hook (add-hook 'tex-mode-hook
(lambda () (lambda ()
(local-set-key [f1] 'help-for-help))) (keymap-local-set "<f1>" 'help-for-help)))
@end lisp @end lisp
@ -4128,8 +4128,8 @@ bound as a complete key, then you must unbind it before the new
binding. For example, if @kbd{ESC @{} is previously bound: binding. For example, if @kbd{ESC @{} is previously bound:
@lisp @lisp
(global-unset-key [?\e ?@{]) ;; or (keymap-global-unset "M-@{") ;; or
(local-unset-key [?\e ?@{]) (keymap-local-unset "M-@{")
@end lisp @end lisp
@item @item
@ -4137,8 +4137,8 @@ Aside from commands and ``lambda lists,'' a vector or string also
can be bound to a key and thus treated as a macro. For example: can be bound to a key and thus treated as a macro. For example:
@lisp @lisp
(global-set-key [f10] [?\C-x?\e?\e?\C-a?\C-k?\C-g]) ;; or (keymap-global-set "<f10>" [?\C-x?\e?\e?\C-a?\C-k?\C-g]) ;; or
(global-set-key [f10] "\C-x\e\e\C-a\C-k\C-g") (keymap-global-set "<f10>" "\C-x\e\e\C-a\C-k\C-g")
@end lisp @end lisp
@end itemize @end itemize
@ -4154,12 +4154,11 @@ character in the key sequence has been misspecified (e.g., @samp{C-f}
used instead of @samp{\C-f} within a Lisp expression). In the other used instead of @samp{\C-f} within a Lisp expression). In the other
case, a @dfn{prefix key} in the keystroke sequence you were trying to bind case, a @dfn{prefix key} in the keystroke sequence you were trying to bind
was already bound as a @dfn{complete key}. Historically, the @samp{ESC [} was already bound as a @dfn{complete key}. Historically, the @samp{ESC [}
prefix was usually the problem, in which case you should evaluate either prefix was usually the problem, in which case you should evaluate this
of these forms before attempting to bind the key sequence: form before attempting to bind the key sequence:
@lisp @lisp
(global-unset-key [?\e ?[]) ;; or (keymap-global-unset "M-[")
(global-unset-key "\e[")
@end lisp @end lisp
@node Terminal setup code works after Emacs has begun @node Terminal setup code works after Emacs has begun
@ -4183,7 +4182,7 @@ newer). For example,
(lambda () (lambda ()
(when (string-match "\\`vt220" (or (getenv "TERM") "")) (when (string-match "\\`vt220" (or (getenv "TERM") ""))
;; Make vt220's "Do" key behave like M-x: ;; Make vt220's "Do" key behave like M-x:
(global-set-key [do] 'execute-extended-command)))) (keymap-global-set "<do>" 'execute-extended-command))))
@end lisp @end lisp
For information on what Emacs does every time it is started, see the For information on what Emacs does every time it is started, see the
@ -4280,7 +4279,7 @@ It is possible to swap the @key{Backspace} and @key{DEL} keys inside
Emacs: Emacs:
@lisp @lisp
(keyboard-translate ?\C-h ?\C-?) (key-translate "C-h" "C-?")
@end lisp @end lisp
@noindent @noindent
@ -4292,20 +4291,20 @@ Similarly, you could remap @key{DEL} to act as @kbd{C-d}, which by
default deletes forward: default deletes forward:
@lisp @lisp
(keyboard-translate ?\C-? ?\C-d) (key-translate "C-?" "C-d")
@end lisp @end lisp
@xref{Swapping keys}, for further details about @code{keyboard-translate}. @xref{Swapping keys}, for further details about @code{key-translate}.
@item @item
Another approach is to switch key bindings and put help on @kbd{C-x h} Another approach is to switch key bindings and put help on @kbd{C-x h}
instead: instead:
@lisp @lisp
(global-set-key "\C-h" 'delete-backward-char) (keymap-global-set "C-h" 'delete-backward-char)
;; overrides mark-whole-buffer ;; overrides mark-whole-buffer
(global-set-key "\C-xh" 'help-command) (keymap-global-set "C-x h" 'help-command)
@end lisp @end lisp
@noindent @noindent
@ -4313,7 +4312,7 @@ This method is not recommended, though: it only solves the problem for
those modes which bind @key{DEL} to @code{delete-backward-char}. Modes those modes which bind @key{DEL} to @code{delete-backward-char}. Modes
which bind @key{DEL} to something else, such as @code{view-mode}, will which bind @key{DEL} to something else, such as @code{view-mode}, will
not work as you expect when you press the @key{Backspace} key. For this not work as you expect when you press the @key{Backspace} key. For this
reason, we recommend the @code{keyboard-translate} method, shown reason, we recommend the @code{key-translate} method, shown
above. above.
Other popular key bindings for help are @kbd{M-?} and @kbd{C-x ?}. Other popular key bindings for help are @kbd{M-?} and @kbd{C-x ?}.
@ -4336,15 +4335,15 @@ Manual}.
@section How do I swap two keys? @section How do I swap two keys?
@cindex Swapping keys @cindex Swapping keys
@cindex Keys, swapping @cindex Keys, swapping
@cindex @code{keyboard-translate} @cindex @code{key-translate}
You can swap two keys (or key sequences) by using the You can swap two keys (or key sequences) by using the
@code{keyboard-translate} function. For example, to turn @kbd{C-h} @code{key-translate} function. For example, to turn @kbd{C-h}
into @key{DEL} and @key{DEL} to @kbd{C-h}, use into @key{DEL} and @key{DEL} to @kbd{C-h}, use
@lisp @lisp
(keyboard-translate ?\C-h ?\C-?) ; translate 'C-h' to DEL (key-translate "C-h" "C-?") ; translate 'C-h' to DEL
(keyboard-translate ?\C-? ?\C-h) ; translate DEL to 'C-h'. (key-translate "C-?" "C-h") ; translate DEL to 'C-h'.
@end lisp @end lisp
@noindent @noindent
@ -4354,7 +4353,7 @@ keymaps.
However, in the specific case of @kbd{C-h} and @key{DEL}, you should However, in the specific case of @kbd{C-h} and @key{DEL}, you should
toggle @code{normal-erase-is-backspace-mode} instead of calling toggle @code{normal-erase-is-backspace-mode} instead of calling
@code{keyboard-translate}. @code{key-translate}.
@xref{DEL Does Not Delete,,, emacs, The GNU Emacs Manual}. @xref{DEL Does Not Delete,,, emacs, The GNU Emacs Manual}.
Keyboard translations are not the same as key bindings in keymaps. Keyboard translations are not the same as key bindings in keymaps.
@ -4426,7 +4425,7 @@ generates @key{ESC}. If not, the following form can be used to bind it:
@lisp @lisp
;; F11 is the documented ESC replacement on DEC terminals. ;; F11 is the documented ESC replacement on DEC terminals.
(define-key function-key-map [f11] [?\e]) (keymap-set function-key-map "<f11>" [?\e])
@end lisp @end lisp
@node Compose Character @node Compose Character
@ -4450,7 +4449,7 @@ prefixes to the function key symbol. For example (from the Emacs
documentation): documentation):
@lisp @lisp
(global-set-key [?\C-x right] 'forward-page) (keymap-global-set "C-x <right>" 'forward-page)
@end lisp @end lisp
@noindent @noindent
@ -4463,7 +4462,7 @@ represent these modifiers, prepend the strings @samp{C-}, @samp{M-},
is how to make @kbd{H-M-RIGHT} move forward a word: is how to make @kbd{H-M-RIGHT} move forward a word:
@lisp @lisp
(global-set-key [H-M-right] 'forward-word) (keymap-global-set "H-M-<right>" 'forward-word)
@end lisp @end lisp
@itemize @bullet @itemize @bullet
@ -4821,8 +4820,8 @@ best fix I've been able to come up with:
(add-hook 'rmail-mode-hook (add-hook 'rmail-mode-hook
(lambda () (lambda ()
(define-key rmail-mode-map "r" 'rmail-reply-t) (keymap-set rmail-mode-map "r" 'rmail-reply-t)
(define-key rmail-mode-map "R" 'rmail-reply))) (keymap-set rmail-mode-map "R" 'rmail-reply)))
@end lisp @end lisp
@node Automatically starting a mail or news reader @node Automatically starting a mail or news reader

View file

@ -257,9 +257,9 @@ email composition buffers (@pxref{Inline Query Expansion})
@lisp @lisp
(with-eval-after-load "message" (with-eval-after-load "message"
(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-try-all)) (keymap-set message-mode-map "C-c <tab>" 'eudc-expand-try-all))
(with-eval-after-load "sendmail" (with-eval-after-load "sendmail"
(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-try-all)) (keymap-set mail-mode-map "C-c <tab>" 'eudc-expand-try-all))
@end lisp @end lisp
@menu @menu
@ -355,7 +355,7 @@ LDAP:
@vindex ldap-host-parameters-alist @vindex ldap-host-parameters-alist
@lisp @lisp
(with-eval-after-load "message" (with-eval-after-load "message"
(define-key message-mode-map (kbd "TAB") 'eudc-expand-try-all)) (keymap-set message-mode-map "TAB" 'eudc-expand-try-all))
(setopt eudc-server-hotlist (setopt eudc-server-hotlist
'(("" . bbdb) '(("" . bbdb)
("ldaps://ldap.gnu.org" . ldap))) ("ldaps://ldap.gnu.org" . ldap)))
@ -412,7 +412,7 @@ configure EUDC for LDAP:
@vindex ldap-host-parameters-alist @vindex ldap-host-parameters-alist
@lisp @lisp
(with-eval-after-load "message" (with-eval-after-load "message"
(define-key message-mode-map (kbd "TAB") 'eudc-expand-try-all)) (keymap-set message-mode-map "TAB" 'eudc-expand-try-all))
(setopt eudc-server-hotlist (setopt eudc-server-hotlist
'(("" . bbdb) '(("" . bbdb)
("ldaps://ldap.gnu.org" . ldap))) ("ldaps://ldap.gnu.org" . ldap)))
@ -442,7 +442,7 @@ and the @file{.emacs} expressions become:
@vindex ldap-host-parameters-alist @vindex ldap-host-parameters-alist
@lisp @lisp
(with-eval-after-load "message" (with-eval-after-load "message"
(define-key message-mode-map (kbd "TAB") 'eudc-expand-try-all)) (keymap-set message-mode-map "TAB" 'eudc-expand-try-all))
(setopt eudc-server-hotlist (setopt eudc-server-hotlist
'(("" . bbdb) ("" . ldap))) '(("" . bbdb) ("" . ldap)))
(setopt ldap-host-parameters-alist (setopt ldap-host-parameters-alist

View file

@ -3311,7 +3311,7 @@ following is added to a group parameter
@lisp @lisp
(gnus-summary-prepared-hook (gnus-summary-prepared-hook
(lambda nil (local-set-key "d" (local-key-binding "n")))) (lambda nil (keymap-local-set "d" (local-key-binding "n"))))
@end lisp @end lisp
when the group is entered, the 'd' key will not mark the article as when the group is entered, the 'd' key will not mark the article as
@ -4529,7 +4529,7 @@ The key @kbd{v} is reserved for users. You can bind it to some
command or better use it as a prefix key. For example: command or better use it as a prefix key. For example:
@lisp @lisp
(define-key gnus-group-mode-map (kbd "v j d") (keymap-set gnus-group-mode-map "v j d"
(lambda () (lambda ()
(interactive) (interactive)
(gnus-group-jump-to-group "nndraft:drafts"))) (gnus-group-jump-to-group "nndraft:drafts")))
@ -4882,7 +4882,7 @@ customize-apropos @key{RET} gnus-summary-tool-bar}.
The key @kbd{v} is reserved for users. You can bind it to some The key @kbd{v} is reserved for users. You can bind it to some
command or better use it as a prefix key. For example: command or better use it as a prefix key. For example:
@lisp @lisp
(define-key gnus-summary-mode-map (kbd "v -") "LrS") ;; lower subthread (keymap-set gnus-summary-mode-map "v -" "LrS") ;; lower subthread
@end lisp @end lisp
@menu @menu
@ -6654,7 +6654,7 @@ article, you could say something like:
@group @group
(add-hook 'gnus-summary-mode-hook 'my-alter-summary-map) (add-hook 'gnus-summary-mode-hook 'my-alter-summary-map)
(defun my-alter-summary-map () (defun my-alter-summary-map ()
(local-set-key "!" 'gnus-summary-put-mark-as-ticked-next)) (keymap-local-set "!" 'gnus-summary-put-mark-as-ticked-next))
@end group @end group
@end lisp @end lisp
@ -6663,7 +6663,7 @@ or
@lisp @lisp
(defun my-alter-summary-map () (defun my-alter-summary-map ()
(local-set-key "!" "MM!n")) (keymap-local-set "!" "MM!n"))
@end lisp @end lisp
@ -17485,8 +17485,7 @@ summary buffer.
(gnus-summary-scroll-up arg)))) (gnus-summary-scroll-up arg))))
(with-eval-after-load "gnus" (with-eval-after-load "gnus"
(define-key gnus-summary-mode-map (keymap-set gnus-summary-mode-map "RET" 'browse-nnrss-url))
(kbd "<RET>") 'browse-nnrss-url))
(add-to-list 'nnmail-extra-headers nnrss-url-field) (add-to-list 'nnmail-extra-headers nnrss-url-field)
@end lisp @end lisp
@ -22498,7 +22497,7 @@ I use the following to check for mails:
(nnmairix-update-groups "mairixsearch" t t) (nnmairix-update-groups "mairixsearch" t t)
(gnus-group-list-groups)) (gnus-group-list-groups))
(define-key gnus-group-mode-map "g" 'my-check-mail-mairix-update) (keymap-set gnus-group-mode-map "g" 'my-check-mail-mairix-update)
@end lisp @end lisp
Instead of @samp{"mairixsearch"} use the name of your @code{nnmairix} Instead of @samp{"mairixsearch"} use the name of your @code{nnmairix}
@ -28524,8 +28523,7 @@ enjoy the power of @acronym{MML}.
The line below enables BBDB in resending a message: The line below enables BBDB in resending a message:
@lisp @lisp
(define-key message-minibuffer-local-map [(tab)] (keymap-set message-minibuffer-local-map "TAB" 'bbdb-complete-name)
'bbdb-complete-name)
@end lisp @end lisp
@item @item

View file

@ -483,7 +483,7 @@ To modify the key bindings, use the @code{ido-setup-hook}. For example:
(defun ido-my-keys () (defun ido-my-keys ()
"Add my key bindings for Ido." "Add my key bindings for Ido."
(define-key ido-completion-map " " 'ido-next-match)) (keymap-set ido-completion-map "SPC" 'ido-next-match))
@end example @end example
@c @defopt ido-setup-hook @c @defopt ido-setup-hook

View file

@ -199,15 +199,15 @@ might or might not collide with some other modes. Simply include them
in your @file{.emacs} and adapt to your needs: in your @file{.emacs} and adapt to your needs:
@lisp @lisp
(global-set-key (kbd "C-c C-o m") 'mairix-search) (keymap-global-set "C-c C-o m" 'mairix-search)
(global-set-key (kbd "C-c C-o w") 'mairix-widget-search) (keymap-global-set "C-c C-o w" 'mairix-widget-search)
(global-set-key (kbd "C-c C-o u") 'mairix-update-database) (keymap-global-set "C-c C-o u" 'mairix-update-database)
(global-set-key (kbd "C-c C-o f") 'mairix-search-from-this-article) (keymap-global-set "C-c C-o f" 'mairix-search-from-this-article)
(global-set-key (kbd "C-c C-o t") 'mairix-search-thread-this-article) (keymap-global-set "C-c C-o t" 'mairix-search-thread-this-article)
(global-set-key (kbd "C-c C-o b") 'mairix-widget-search-based-on-article) (keymap-global-set "C-c C-o b" 'mairix-widget-search-based-on-article)
(global-set-key (kbd "C-c C-o s") 'mairix-save-search) (keymap-global-set "C-c C-o s" 'mairix-save-search)
(global-set-key (kbd "C-c C-o i") 'mairix-use-saved-search) (keymap-global-set "C-c C-o i" 'mairix-use-saved-search)
(global-set-key (kbd "C-c C-o e") 'mairix-edit-saved-searches) (keymap-global-set "C-c C-o e" 'mairix-edit-saved-searches)
@end lisp @end lisp
Here's a description of the available interactive functions: Here's a description of the available interactive functions:

View file

@ -2646,7 +2646,7 @@ browser when clicked with @kbd{S-mouse-2}. This binding works in any
buffer, including HTML buffers. buffer, including HTML buffers.
@smalllisp @smalllisp
(global-set-key [S-mouse-2] 'browse-url-at-mouse) (keymap-global-set "S-<mouse-2>" 'browse-url-at-mouse)
@end smalllisp @end smalllisp
@node Digests @node Digests
@ -3112,7 +3112,7 @@ electric-buffer-list} to see what I mean.
Before we leave this section, I'll include a function that I use as a Before we leave this section, I'll include a function that I use as a
front end to MH-E@footnote{Stephen Gildea's favorite binding is front end to MH-E@footnote{Stephen Gildea's favorite binding is
@kbd{(global-set-key "\C-cr" 'mh-rmail)}.}. It toggles between your @kbd{(keymap-global-set "C-c r" 'mh-rmail)}.}. It toggles between your
working window configuration, which may be quite involved---windows working window configuration, which may be quite involved---windows
filled with source, compilation output, man pages, and other filled with source, compilation output, man pages, and other
documentation---and your MH-E window configuration. Like the rest of documentation---and your MH-E window configuration. Like the rest of
@ -3153,7 +3153,7 @@ when going into mail."
(set-window-configuration my-normal-screen) (set-window-configuration my-normal-screen)
nil)))) ; @r{set my-mh-screen-saved to nil} nil)))) ; @r{set my-mh-screen-saved to nil}
(global-set-key "\C-x\r" 'my-mh-rmail) ;@r{ call with C-x @key{RET}} (keymap-global-set "C-x RET" 'my-mh-rmail) ;@r{ call with C-x @key{RET}}
@i{Starting MH-E} @i{Starting MH-E}
@ -3447,11 +3447,10 @@ bindings, for example:
(defun my-mh-folder-mode-hook () (defun my-mh-folder-mode-hook ()
"Hook to set key bindings in MH-Folder mode." "Hook to set key bindings in MH-Folder mode."
(if (not my-mh-init-done) ; @r{only need to bind the keys once } (unless my-mh-init-done ; @r{only need to bind the keys once }
(progn (keymap-local-set "/ /" 'my-search-msg)
(local-set-key "//" 'my-search-msg) (keymap-local-set "b" 'mh-burst-digest) ; @r{better use of @kbd{b}}
(local-set-key "b" 'mh-burst-digest) ; @r{better use of @kbd{b}} (setq my-mh-init-done t)))
(setq my-mh-init-done t))))
(add-hook 'mh-folder-mode-hook 'my-mh-folder-mode-hook) (add-hook 'mh-folder-mode-hook 'my-mh-folder-mode-hook)
@ -3983,8 +3982,8 @@ you would rather preserve the window layout. You may find adding the
following key bindings to @file{~/.emacs} useful: following key bindings to @file{~/.emacs} useful:
@smalllisp @smalllisp
(global-set-key "\C-xm" 'mh-smail) (keymap-global-set "C-x m" 'mh-smail)
(global-set-key "\C-x4m" 'mh-smail-other-window) (keymap-global-set "C-x 4 m" 'mh-smail-other-window)
@end smalllisp @end smalllisp
@cindex draft folder @cindex draft folder
@ -4054,13 +4053,13 @@ this hook.
(defun my-mh-letter-mode-hook () (defun my-mh-letter-mode-hook ()
"Prepare letter for editing." "Prepare letter for editing."
(when (not letter-mode-init-done) ; @r{only need to bind the keys once} (when (not letter-mode-init-done) ; @r{only need to bind the keys once}
(local-set-key "\C-ctb" 'add-enriched-text) (keymap-local-set "C-c t b" 'add-enriched-text)
(local-set-key "\C-cti" 'add-enriched-text) (keymap-local-set "C-c t i" 'add-enriched-text)
(local-set-key "\C-ctf" 'add-enriched-text) (keymap-local-set "C-c t f" 'add-enriched-text)
(local-set-key "\C-cts" 'add-enriched-text) (keymap-local-set "C-c t s" 'add-enriched-text)
(local-set-key "\C-ctB" 'add-enriched-text) (keymap-local-set "C-c t B" 'add-enriched-text)
(local-set-key "\C-ctu" 'add-enriched-text) (keymap-local-set "C-c t u" 'add-enriched-text)
(local-set-key "\C-ctc" 'add-enriched-text) (keymap-local-set "C-c t c" 'add-enriched-text)
(setq letter-mode-init-done t)) (setq letter-mode-init-done t))
(save-excursion (save-excursion
(goto-char (point-max)) ; @r{go to end of message to} (goto-char (point-max)) ; @r{go to end of message to}

View file

@ -374,9 +374,9 @@ add
@lisp @lisp
(add-hook 'inferior-octave-mode-hook (add-hook 'inferior-octave-mode-hook
(lambda () (lambda ()
(define-key inferior-octave-mode-map [up] (keymap-set inferior-octave-mode-map "<up>"
'comint-previous-input) 'comint-previous-input)
(define-key inferior-octave-mode-map [down] (keymap-set inferior-octave-mode-map "<down>"
'comint-next-input))) 'comint-next-input)))
@end lisp @end lisp
@noindent @noindent

View file

@ -2050,7 +2050,7 @@ binding for @code{reftex-cite-format}.
@lisp @lisp
(add-hook 'mail-setup-hook (add-hook 'mail-setup-hook
(lambda () (define-key mail-mode-map "\C-c[" (lambda () (keymap-set mail-mode-map "C-c ["
(lambda () (lambda ()
(interactive) (interactive)
(let ((reftex-cite-format 'locally)) (let ((reftex-cite-format 'locally))

View file

@ -211,8 +211,8 @@ Here is one way to map the remember functions in your init file
Manual}) to very accessible keystrokes facilities using the mode: Manual}) to very accessible keystrokes facilities using the mode:
@lisp @lisp
(define-key global-map (kbd "<f9> r") 'remember) (keymap-set global-map "<f9> r" 'remember)
(define-key global-map (kbd "<f9> R") 'remember-region) (keymap-set global-map "<f9> R" 'remember-region)
@end lisp @end lisp
@cindex annotation @cindex annotation

View file

@ -870,7 +870,7 @@ event @var{event}. This command is meant to be bound to a mouse
command, like this: command, like this:
@example @example
(global-set-key '[(S-mouse-1)] semantic-ia-fast-mouse-jump) (keymap-global-set "S-<mouse-1>" 'semantic-ia-fast-mouse-jump)
@end example @end example
@end defun @end defun

View file

@ -1968,8 +1968,8 @@ Under the X Window System, every keyboard key emits its preferred form,
so you can just type so you can just type
@lisp @lisp
(global-set-key [f11] 'calendar) ; L1, Stop (keymap-global-set "<f11>" 'calendar) ; L1, Stop
(global-set-key [f14] 'undo) ; L4, Undo (keymap-global-set "<f14>" 'undo) ; L4, Undo
@end lisp @end lisp
@noindent @noindent
@ -2885,7 +2885,7 @@ the standard Emacs mechanism for binding function keys to commands.
For instance, For instance,
@example @example
(global-set-key [f13] 'repeat-complex-command) (keymap-global-set "<f13>" 'repeat-complex-command)
@end example @end example
@noindent @noindent
@ -2932,7 +2932,7 @@ say, @kbd{f12 \3} like this:
Note that even though the macro uses the function key @kbd{f12}, the key is Note that even though the macro uses the function key @kbd{f12}, the key is
actually free and can still be bound to some Emacs function via actually free and can still be bound to some Emacs function via
@code{define-key} or @code{global-set-key}. @code{define-key} or @code{keymap-global-set}.
Viper allows the user to define macro names that are prefixes of other macros. Viper allows the user to define macro names that are prefixes of other macros.

View file

@ -3088,8 +3088,8 @@ Example:
@group @group
(defvar widget-ranged-integer-map (defvar widget-ranged-integer-map
(let ((map (copy-keymap widget-keymap))) (let ((map (copy-keymap widget-keymap)))
(define-key map [up] #'widget-ranged-integer-increase) (keymap-set map "<up>" #'widget-ranged-integer-increase)
(define-key map [down] #'widget-ranged-integer-decrease) (keymap-set map "<down>" #'widget-ranged-integer-decrease)
map)) map))
@end group @end group

View file

@ -473,11 +473,11 @@ e.g., this key binding for @kbd{C-c w} runs WoMan on the topic at
point without seeking confirmation: point without seeking confirmation:
@lisp @lisp
(global-set-key "\C-cw" (keymap-global-set "C-c w"
(lambda () (lambda ()
(interactive) (interactive)
(let ((woman-use-topic-at-point t)) (let ((woman-use-topic-at-point t))
(woman)))) (woman))))
@end lisp @end lisp