1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-21 18:23:59 +00:00

Prefer defvar-keymap in some progmodes

* lisp/progmodes/asm-mode.el (asm-mode-map):
* lisp/progmodes/bug-reference.el (bug-reference-map):
* lisp/progmodes/erts-mode.el (erts-mode-map):
* lisp/progmodes/flymake.el (flymake-mode-map)
(flymake-diagnostics-buffer-mode-map):
* lisp/progmodes/icon.el (icon-mode-map):
* lisp/progmodes/js.el (js-mode-map):
* lisp/progmodes/m4-mode.el (m4-mode-map):
* lisp/progmodes/mixal-mode.el (mixal-mode-map):
* lisp/progmodes/scheme.el (scheme-mode-map): Prefer defvar-keymap.
This commit is contained in:
Stefan Kangas 2022-05-17 17:25:27 +02:00
parent 4ed0f6e965
commit 7d74b8f632
9 changed files with 49 additions and 69 deletions

View File

@ -68,13 +68,11 @@
"Abbrev table used while in Asm mode.")
(define-abbrev-table 'asm-mode-abbrev-table ())
(defvar asm-mode-map
(let ((map (make-sparse-keymap)))
;; Note that the comment character isn't set up until asm-mode is called.
(define-key map ":" 'asm-colon)
(define-key map "\C-c;" 'comment-region)
map)
"Keymap for Asm mode.")
(defvar-keymap asm-mode-map
:doc "Keymap for Asm mode."
;; Note that the comment character isn't set up until asm-mode is called.
":" #'asm-colon
"C-c ;" #'comment-region)
(easy-menu-define asm-mode-menu asm-mode-map
"Menu for Asm mode."

View File

@ -40,12 +40,10 @@
;; Somewhat arbitrary, by analogy with eg goto-address.
:group 'comm)
(defvar bug-reference-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-2] 'bug-reference-push-button)
(define-key map (kbd "C-c RET") 'bug-reference-push-button)
map)
"Keymap used by bug reference buttons.")
(defvar-keymap bug-reference-map
:doc "Keymap used by bug reference buttons."
"<mouse-2>" #'bug-reference-push-button
"C-c RET" #'bug-reference-push-button)
;; E.g., "https://gcc.gnu.org/PR%s"
(defvar bug-reference-url-format nil

View File

@ -64,12 +64,10 @@
"Face used for displaying specification test start markers."
:group 'erts-mode)
(defvar erts-mode-map
(let ((map (make-keymap)))
(set-keymap-parent map prog-mode-map)
(define-key map "\C-c\C-r" 'erts-tag-region)
(define-key map "\C-c\C-c" 'erts-run-test)
map))
(defvar-keymap erts-mode-map
:parent prog-mode-map
"C-c C-r" #'erts-tag-region
"C-c C-c" #'erts-run-test)
(defvar erts-mode-font-lock-keywords
;; Specifications.

View File

@ -1080,9 +1080,8 @@ Interactively, with a prefix arg, FORCE is t."
(flymake--run-backend backend backend-args)))
nil))))))))
(defvar flymake-mode-map
(let ((map (make-sparse-keymap))) map)
"Keymap for `flymake-mode'.")
(defvar-keymap flymake-mode-map
:doc "Keymap for `flymake-mode'.")
;;;###autoload
(define-minor-mode flymake-mode
@ -1493,11 +1492,9 @@ TYPE is usually keyword `:error', `:warning' or `:note'."
(defvar-local flymake--diagnostics-buffer-source nil)
(defvar flymake-diagnostics-buffer-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "RET") 'flymake-goto-diagnostic)
(define-key map (kbd "SPC") 'flymake-show-diagnostic)
map))
(defvar-keymap flymake-diagnostics-buffer-mode-map
"RET" #'flymake-goto-diagnostic
"SPC" #'flymake-show-diagnostic)
(defun flymake-show-diagnostic (pos &optional other-window)
"Show location of diagnostic at POS."

View File

@ -31,17 +31,16 @@
"Abbrev table in use in Icon-mode buffers.")
(define-abbrev-table 'icon-mode-abbrev-table ())
(defvar icon-mode-map
(let ((map (make-sparse-keymap "Icon")))
(define-key map "{" 'electric-icon-brace)
(define-key map "}" 'electric-icon-brace)
(define-key map "\e\C-h" 'mark-icon-function)
(define-key map "\e\C-a" 'beginning-of-icon-defun)
(define-key map "\e\C-e" 'end-of-icon-defun)
(define-key map "\e\C-q" 'indent-icon-exp)
(define-key map "\177" 'backward-delete-char-untabify)
map)
"Keymap used in Icon mode.")
(defvar-keymap icon-mode-map
:doc "Keymap used in Icon mode."
:name "Icon"
"{" #'electric-icon-brace
"}" #'electric-icon-brace
"C-M-h" #'mark-icon-function
"C-M-a" #'beginning-of-icon-defun
"C-M-e" #'end-of-icon-defun
"C-M-q" #'indent-icon-exp
"DEL" #'backward-delete-char-untabify)
(easy-menu-define icon-mode-menu icon-mode-map
"Menu for Icon mode."

View File

@ -660,13 +660,11 @@ This variable is like `sgml-attribute-offset'."
:type 'integer
:safe 'integerp)
;;; KeyMap
;;; Keymap
(defvar js-mode-map
(let ((keymap (make-sparse-keymap)))
(define-key keymap [(meta ?.)] #'js-find-symbol)
keymap)
"Keymap for `js-mode'.")
(defvar-keymap js-mode-map
:doc "Keymap for `js-mode'."
"M-." #'js-find-symbol)
;;; Syntax table and parsing

View File

@ -121,13 +121,11 @@ If m4 is not in your PATH, set this to an absolute file name."
("#" (0 (when (m4--quoted-p (match-beginning 0))
(string-to-syntax "."))))))
(defvar m4-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-b" 'm4-m4-buffer)
(define-key map "\C-c\C-r" 'm4-m4-region)
(define-key map "\C-c\C-c" 'comment-region)
map)
"Keymap for M4 Mode.")
(defvar-keymap m4-mode-map
:doc "Keymap for M4 Mode."
"C-c C-b" #'m4-m4-buffer
"C-c C-r" #'m4-m4-region
"C-c C-c" #'comment-region)
(easy-menu-define m4-mode-menu m4-mode-map
"Menu for M4 Mode."

View File

@ -78,16 +78,13 @@
;;; Code:
(defvar compile-command)
;;; Key map
(defvar mixal-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-c" 'compile)
(define-key map "\C-c\C-r" 'mixal-run)
(define-key map "\C-c\C-d" 'mixal-debug)
(define-key map "\C-h\C-o" 'mixal-describe-operation-code)
map)
"Keymap for `mixal-mode'.")
;; (makunbound 'mixal-mode-map)
;;; Keymap
(defvar-keymap mixal-mode-map
:doc "Keymap for `mixal-mode'."
"C-c C-c" #'compile
"C-c C-r" #'mixal-run
"C-c C-d" #'mixal-debug
"C-h C-o" #'mixal-describe-operation-code)
;;; Syntax table
(defvar mixal-mode-syntax-table

View File

@ -1,7 +1,6 @@
;;; scheme.el --- Scheme (and DSSSL) editing mode -*- lexical-binding: t; -*-
;; Copyright (C) 1986-1988, 1997-1998, 2001-2022 Free Software
;; Foundation, Inc.
;; Copyright (C) 1986-2022 Free Software Foundation, Inc.
;; Author: Bill Rozas <jinx@martigny.ai.mit.edu>
;; Adapted-by: Dave Love <d.love@dl.ac.uk>
@ -201,12 +200,10 @@
(defvar scheme-mode-line-process "")
(defvar scheme-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map lisp-mode-shared-map)
map)
"Keymap for Scheme mode.
All commands in `lisp-mode-shared-map' are inherited by this map.")
(defvar-keymap scheme-mode-map
:doc "Keymap for Scheme mode.
All commands in `lisp-mode-shared-map' are inherited by this map."
:parent lisp-mode-shared-map)
(easy-menu-define scheme-mode-menu scheme-mode-map
"Menu for Scheme mode."