Recommend using 'keymap-set' in Commentaries

* lisp/calendar/timeclock.el, lisp/comint.el, lisp/ehelp.el:
* lisp/gnus/gnus-bookmark.el, lisp/gnus/smiley.el, lisp/ido.el:
* lisp/isearchb.el, lisp/mail/mailabbrev.el, lisp/net/ange-ftp.el:
* lisp/net/goto-addr.el, lisp/play/fortune.el, lisp/saveplace.el:
* lisp/shell.el, lisp/term.el, lisp/textmodes/makeinfo.el:
* lisp/textmodes/refer.el, lisp/textmodes/remember.el:
* lisp/textmodes/table.el, lisp/woman.el: Recommend using
'keymap-set' instead of 'define-key' in Commentaries.
This commit is contained in:
Stefan Kangas 2025-03-15 01:01:16 +01:00
parent 679ad95a67
commit ecd756dd39
19 changed files with 43 additions and 49 deletions

View file

@ -37,12 +37,12 @@
;; You'll probably want to bind the timeclock commands to some handy ;; You'll probably want to bind the timeclock commands to some handy
;; keystrokes. Assuming C-c t is unbound, you might use: ;; keystrokes. Assuming C-c t is unbound, you might use:
;; ;;
;; (define-key (kbd "C-c t i") 'timeclock-in) ;; (keymap-set "C-c t i" 'timeclock-in)
;; (define-key (kbd "C-c t o") 'timeclock-out) ;; (keymap-set "C-c t o" 'timeclock-out)
;; (define-key (kbd "C-c t c") 'timeclock-change) ;; (keymap-set "C-c t c" 'timeclock-change)
;; (define-key (kbd "C-c t r") 'timeclock-reread-log) ;; (keymap-set "C-c t r" 'timeclock-reread-log)
;; (define-key (kbd "C-c t u") 'timeclock-update-mode-line) ;; (keymap-set "C-c t u" 'timeclock-update-mode-line)
;; (define-key (kbd "C-c t w") 'timeclock-when-to-leave-string) ;; (keymap-set "C-c t w" 'timeclock-when-to-leave-string)
;; If you want Emacs to display the amount of time "left" to your ;; If you want Emacs to display the amount of time "left" to your
;; workday in the mode-line, you can either set the value of ;; workday in the mode-line, you can either set the value of

View file

@ -3215,8 +3215,8 @@ its response can be seen."
;; These are not installed in the comint-mode keymap. But they are ;; These are not installed in the comint-mode keymap. But they are
;; available for people who want them. Shell-mode installs them: ;; available for people who want them. Shell-mode installs them:
;; (define-key shell-mode-map "\t" 'completion-at-point) ;; (keymap-set shell-mode-map "TAB" 'completion-at-point)
;; (define-key shell-mode-map "\M-?" ;; (keymap-set shell-mode-map "M-?"
;; 'comint-dynamic-list-filename-completions))) ;; 'comint-dynamic-list-filename-completions)))
;; ;;
;; Commands like this are fine things to put in load hooks if you ;; Commands like this are fine things to put in load hooks if you

View file

@ -31,9 +31,9 @@
;; buffer. ;; buffer.
;; To make this the default, you must do ;; To make this the default, you must do
;; (define-key global-map "\C-h" 'ehelp-command) ;; (keymap-global-set "C-h" 'ehelp-command)
;; (define-key global-map [help] 'ehelp-command) ;; (keymap-global-set "<help>" 'ehelp-command)
;; (define-key global-map [f1] 'ehelp-command) ;; (keymap-global-set "<f1>" 'ehelp-command)
;;; Code: ;;; Code:

View file

@ -55,10 +55,10 @@
(require 'gnus-sum) (require 'gnus-sum)
;; FIXME: should avoid using C-c (no?) ;; FIXME: should avoid using C-c (no?)
;; (define-key gnus-summary-mode-map "\C-crm" 'gnus-bookmark-set) ;; (keymap-set gnus-summary-mode-map "C-c r m" 'gnus-bookmark-set)
;; (define-key global-map "\C-crb" 'gnus-bookmark-jump) ;; (keymap-global-set "C-c r b" 'gnus-bookmark-jump)
;; (define-key global-map "\C-crj" 'gnus-bookmark-jump) ;; (keymap-global-set "C-c r j" 'gnus-bookmark-jump)
;; (define-key global-map "\C-crl" 'gnus-bookmark-bmenu-list) ;; (keymap-global-set "C-c r l" 'gnus-bookmark-bmenu-list)
;; FIXME: Add keybindings, see ;; FIXME: Add keybindings, see
;; http://thread.gmane.org/gmane.emacs.gnus.general/63101/focus=63379 [dead link] ;; http://thread.gmane.org/gmane.emacs.gnus.general/63101/focus=63379 [dead link]

View file

@ -189,12 +189,9 @@ regexp to replace with IMAGE. IMAGE is the name of an image file in
smiley-cached-regexp-alist)))))))) smiley-cached-regexp-alist))))))))
;; Not implemented: ;; Not implemented:
;; (defvar smiley-mouse-map ;; (defvar-keymap smiley-mouse-map
;; (let ((map (make-sparse-keymap))) ;; "<down-mouse-2>" #'ignore ; override widget
;; (define-key map [down-mouse-2] 'ignore) ; override widget ;; "<mouse-2>" #'smiley-mouse-toggle-buffer)
;; (define-key map [mouse-2]
;; 'smiley-mouse-toggle-buffer)
;; map))
;;;###autoload ;;;###autoload
(defun smiley-region (start end) (defun smiley-region (start end)

View file

@ -214,7 +214,7 @@
;; `ido-buffer-completion-map'. ;; `ido-buffer-completion-map'.
;; ;;
;; (with-eval-after-load 'ido ;; (with-eval-after-load 'ido
;; (define-key ido-common-completion-map " " 'ido-next-match)) ;; (keymap-set ido-common-completion-map "SPC" 'ido-next-match))
;; Seeing all the matching buffers or files ;; Seeing all the matching buffers or files
;; ---------------------------------------- ;; ----------------------------------------

View file

@ -41,7 +41,7 @@
;; mode, just like with isearch. I use C-z for this. The binding in ;; mode, just like with isearch. I use C-z for this. The binding in
;; my .emacs looks like: ;; my .emacs looks like:
;; ;;
;; (define-key global-map [(control ?z)] 'isearchb-activate) ;; (keymap-global-set "C-z" 'isearchb-activate)
;; ;;
;; Now, after pressing C-z (for example), each self-inserting ;; Now, after pressing C-z (for example), each self-inserting
;; character thereafter will search for a buffer containing those ;; character thereafter will search for a buffer containing those

View file

@ -109,8 +109,8 @@
;; (add-hook ;; (add-hook
;; 'mail-mode-hook ;; 'mail-mode-hook
;; (lambda () ;; (lambda ()
;; (define-key mail-mode-map [remap next-line] 'mail-abbrev-next-line) ;; (keymap-set mail-mode-map "<remap> <next-line>" 'mail-abbrev-next-line)
;; (define-key mail-mode-map [remap end-of-buffer] 'mail-abbrev-end-of-buffer))) ;; (keymap-set mail-mode-map "<remap> <end-of-buffer>" 'mail-abbrev-end-of-buffer)))
;; ;;
;; If you want multiple addresses separated by a string other than ", " then ;; If you want multiple addresses separated by a string other than ", " then
;; you can set the variable mail-alias-separator-string to it. This has to ;; you can set the variable mail-alias-separator-string to it. This has to

View file

@ -1460,7 +1460,7 @@ only return the directory part of FILE."
;;;; ------------------------------------------------------------ ;;;; ------------------------------------------------------------
;; (setq ange-ftp-tmp-keymap (make-sparse-keymap)) ;; (setq ange-ftp-tmp-keymap (make-sparse-keymap))
;; (define-key ange-ftp-tmp-keymap "\C-m" 'exit-minibuffer) ;; (keymap-set ange-ftp-tmp-keymap "C-m" 'exit-minibuffer)
(defun ange-ftp-repaint-minibuffer () (defun ange-ftp-repaint-minibuffer ()
"Clear any existing minibuffer message; let the minibuffer contents show." "Clear any existing minibuffer message; let the minibuffer contents show."
@ -4101,8 +4101,8 @@ E.g.,
;; Put these lines uncommented in your .emacs if you want C-r to refresh ;; Put these lines uncommented in your .emacs if you want C-r to refresh
;; ange-ftp's cache whilst doing filename completion. ;; ange-ftp's cache whilst doing filename completion.
;; ;;
;;(define-key minibuffer-local-completion-map "\C-r" 'ange-ftp-reread-dir) ;;(keymap-set minibuffer-local-completion-map "C-r" 'ange-ftp-reread-dir)
;;(define-key minibuffer-local-must-match-map "\C-r" 'ange-ftp-reread-dir) ;;(keymap-set minibuffer-local-must-match-map "C-r" 'ange-ftp-reread-dir)
;;;###autoload ;;;###autoload
(define-obsolete-function-alias 'ange-ftp-re-read-dir #'ange-ftp-reread-dir "29.1") (define-obsolete-function-alias 'ange-ftp-re-read-dir #'ange-ftp-reread-dir "29.1")

View file

@ -43,9 +43,8 @@
;; (for example): ;; (for example):
;; ;;
;; (setq goto-address-highlight-keymap ;; (setq goto-address-highlight-keymap
;; (let ((m (make-sparse-keymap))) ;; (define-keymap
;; (define-key m [S-mouse-2] 'goto-address-at-point) ;; "S-<mouse-2>" 'goto-address-at-point))
;; m))
;; ;;
;; Known bugs/features: ;; Known bugs/features:

View file

@ -57,9 +57,8 @@
;; ;;
;; I also have this in my .gnus: ;; I also have this in my .gnus:
;; ;;
;; (add-hook 'gnus-article-mode-hook ;; (with-eval-after-load 'gnus-art
;; (lambda () ;; (keymap-set gnus-article-mode-map "i" #'fortune-from-region))
;; (define-key gnus-article-mode-map "i" #'fortune-from-region)))
;; ;;
;; which allows marking a region and then pressing "i" so that the marked ;; which allows marking a region and then pressing "i" so that the marked
;; region will be automatically added to my favorite fortune file. ;; region will be automatically added to my favorite fortune file.

View file

@ -38,7 +38,7 @@
(require 'cl-lib) (require 'cl-lib)
;; this is what I was using during testing: ;; this is what I was using during testing:
;; (define-key ctl-x-map "p" 'toggle-save-place-globally) ;; (keymap-set ctl-x-map "p" 'toggle-save-place-globally)
(defgroup save-place nil (defgroup save-place nil
"Automatically save place in files." "Automatically save place in files."

View file

@ -48,8 +48,8 @@
;; Some suggestions for your init file. ;; Some suggestions for your init file.
;; ;;
;; ;; Define M-# to run some strange command: ;; ;; Define M-# to run some strange command:
;; (eval-after-load "shell" ;; (with-eval-after-load 'shell
;; '(define-key shell-mode-map "\M-#" 'shells-dynamic-spell)) ;; (keymap-set shell-mode-map "M-#" 'shells-dynamic-spell))
;; Brief Command Documentation: ;; Brief Command Documentation:
;;============================================================================ ;;============================================================================

View file

@ -4228,8 +4228,8 @@ This is a good place to put keybindings.")
;; These are not installed in the term-mode keymap. But they are ;; These are not installed in the term-mode keymap. But they are
;; available for people who want them. Shell-mode installs them: ;; available for people who want them. Shell-mode installs them:
;; (define-key shell-mode-map "\t" 'term-dynamic-complete) ;; (keymap-set shell-mode-map "TAB" 'term-dynamic-complete)
;; (define-key shell-mode-map "\M-?" ;; (keymap-set shell-mode-map "M-?"
;; 'term-dynamic-list-filename-completions))) ;; 'term-dynamic-list-filename-completions)))
;; ;;
;; Commands like this are fine things to put in load hooks if you ;; Commands like this are fine things to put in load hooks if you

View file

@ -34,10 +34,10 @@
;;; Keybindings (defined in `texinfo.el') ;;; Keybindings (defined in `texinfo.el')
;; makeinfo bindings ;; makeinfo bindings
; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region) ; (keymap-set texinfo-mode-map "C-c C-m C-r" 'makeinfo-region)
; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer) ; (keymap-set texinfo-mode-map "C-c C-m C-b" 'makeinfo-buffer)
; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation) ; (keymap-set texinfo-mode-map "C-c C-m C-k" 'kill-compilation)
; (define-key texinfo-mode-map "\C-c\C-m\C-l" ; (keymap-set texinfo-mode-map "C-c C-m C-l"
; 'makeinfo-recenter-compilation-buffer) ; 'makeinfo-recenter-compilation-buffer)
;;; Code: ;;; Code:

View file

@ -46,7 +46,7 @@
;; refer-yank-key to insert it at point in the current buffer ;; refer-yank-key to insert it at point in the current buffer
;; (typically as the argument of a \cite{} command). ;; (typically as the argument of a \cite{} command).
;; ;;
;; I use (define-key tex-mode-map "\C-c\C-y" 'refer-yank-key) ;; I use (keymap-set tex-mode-map "C-c C-y" 'refer-yank-key)
;; to bind this often-used function to a key in (la)tex-mode. ;; to bind this often-used function to a key in (la)tex-mode.
;; ;;
;; If the list of bibliography files changes, reinitialize the variable ;; If the list of bibliography files changes, reinitialize the variable

View file

@ -129,7 +129,7 @@
;; To map the primary remember function to the keystroke F8, do the ;; To map the primary remember function to the keystroke F8, do the
;; following. ;; following.
;; ;;
;; (define-key global-map [f8] 'remember) ;; (keymap-global-set "<f8>" 'remember)
;; ;;
;; * Feedback ;; * Feedback
;; ;;

View file

@ -343,7 +343,7 @@
;; ;;
;; (add-hook 'table-cell-map-hook ;; (add-hook 'table-cell-map-hook
;; (lambda () ;; (lambda ()
;; (define-key table-cell-map [<key sequence>] '<function>))) ;; (keymap-set table-cell-map "<key sequence>" '<function>)))
;; ;;
;; ----- ;; -----
;; Menu: ;; Menu:

View file

@ -89,9 +89,8 @@
;; structure. ;; structure.
;; Or (3): Put this in your init file: ;; Or (3): Put this in your init file:
;; (add-hook 'dired-mode-hook ;; (with-eval-after-load 'dired
;; (lambda () ;; (keymap-set dired-mode-map "W" 'woman-dired-find-file))
;; (define-key dired-mode-map "W" 'woman-dired-find-file)))
;; and open the directory containing the man page file using Dired, ;; and open the directory containing the man page file using Dired,
;; put the cursor on the file, and press `W'. ;; put the cursor on the file, and press `W'.