Prefer defvar-keymap in nxml/*.el

* lisp/nxml/nxml-mode.el (nxml-mode-map):
* lisp/nxml/nxml-outln.el (nxml-outline-prefix-map)
(nxml-outline-show-map, nxml-outline-hiding-tag-map)
(nxml-outline-showing-tag-map): Prefer defvar-keymap.
This commit is contained in:
Stefan Kangas 2022-07-02 12:25:03 +02:00
parent b25ca54298
commit 25d80e4f81
2 changed files with 46 additions and 56 deletions

View file

@ -369,31 +369,29 @@ and, if `nxml-char-ref-display-glyph-flag' is non-nil, a glyph
corresponding to the referenced character following the character
reference.")
(defvar nxml-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\M-\C-u" 'nxml-backward-up-element)
(define-key map "\M-\C-d" 'nxml-down-element)
(define-key map "\M-\C-n" 'nxml-forward-element)
(define-key map "\M-\C-p" 'nxml-backward-element)
(define-key map "\M-{" 'nxml-backward-paragraph)
(define-key map "\M-}" 'nxml-forward-paragraph)
(define-key map "\M-h" 'nxml-mark-paragraph)
(define-key map "\C-c\C-f" 'nxml-finish-element)
(define-key map "\C-c]" 'nxml-finish-element)
(define-key map "\C-c/" 'nxml-finish-element)
(define-key map "\C-c\C-m" 'nxml-split-element)
(define-key map "\C-c\C-b" 'nxml-balanced-close-start-tag-block)
(define-key map "\C-c\C-i" 'nxml-balanced-close-start-tag-inline)
(define-key map "\C-c\C-x" 'nxml-insert-xml-declaration)
(define-key map "\C-c\C-d" 'nxml-dynamic-markup-word)
;; u is for Unicode
(define-key map "\C-c\C-u" 'nxml-insert-named-char)
(define-key map "\C-c\C-o" nxml-outline-prefix-map)
(define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content)
(define-key map "/" 'nxml-electric-slash)
(define-key map "\M-\t" 'completion-at-point)
map)
"Keymap for `nxml-mode'.")
(defvar-keymap nxml-mode-map
:doc "Keymap for `nxml-mode'."
"C-M-u" #'nxml-backward-up-element
"C-M-d" #'nxml-down-element
"C-M-n" #'nxml-forward-element
"C-M-p" #'nxml-backward-element
"M-{" #'nxml-backward-paragraph
"M-}" #'nxml-forward-paragraph
"M-h" #'nxml-mark-paragraph
"C-c C-f" #'nxml-finish-element
"C-c ]" #'nxml-finish-element
"C-c /" #'nxml-finish-element
"C-c C-m" #'nxml-split-element
"C-c C-b" #'nxml-balanced-close-start-tag-block
"C-c C-i" #'nxml-balanced-close-start-tag-inline
"C-c C-x" #'nxml-insert-xml-declaration
"C-c C-d" #'nxml-dynamic-markup-word
;; u is for Unicode
"C-c C-u" #'nxml-insert-named-char
"C-c C-o" nxml-outline-prefix-map
"/" #'nxml-electric-slash
"M-TAB" #'completion-at-point
"S-<mouse-2>" #'nxml-mouse-hide-direct-text-content)
(defvar nxml-font-lock-keywords
'(nxml-fontify-matcher)

View file

@ -129,20 +129,18 @@ See the variable `nxml-section-element-name-regexp' for more details."
(defvar nxml-heading-scan-distance 1000
"Maximum distance from section to scan for heading.")
(defvar nxml-outline-prefix-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-a" 'nxml-show-all)
(define-key map "\C-t" 'nxml-hide-all-text-content)
(define-key map "\C-r" 'nxml-refresh-outline)
(define-key map "\C-c" 'nxml-hide-direct-text-content)
(define-key map "\C-e" 'nxml-show-direct-text-content)
(define-key map "\C-d" 'nxml-hide-subheadings)
(define-key map "\C-s" 'nxml-show)
(define-key map "\C-k" 'nxml-show-subheadings)
(define-key map "\C-l" 'nxml-hide-text-content)
(define-key map "\C-i" 'nxml-show-direct-subheadings)
(define-key map "\C-o" 'nxml-hide-other)
map))
(defvar-keymap nxml-outline-prefix-map
"C-a" #'nxml-show-all
"C-t" #'nxml-hide-all-text-content
"C-r" #'nxml-refresh-outline
"C-c" #'nxml-hide-direct-text-content
"C-e" #'nxml-show-direct-text-content
"C-d" #'nxml-hide-subheadings
"C-s" #'nxml-show
"C-k" #'nxml-show-subheadings
"C-l" #'nxml-hide-text-content
"C-i" #'nxml-show-direct-subheadings
"C-o" #'nxml-hide-other)
;;; Commands for changing visibility
@ -693,11 +691,9 @@ non-transparent child section."
(nxml-highlighted-qname (xmltok-end-tag-qname))
nxml-highlighted-greater-than))))
(defvar nxml-outline-show-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-m" 'nxml-show-direct-text-content)
(define-key map [mouse-2] 'nxml-mouse-show-direct-text-content)
map))
(defvar-keymap nxml-outline-show-map
"RET" #'nxml-show-direct-text-content
"<mouse-2>" #'nxml-mouse-show-direct-text-content)
(defvar nxml-outline-show-help "mouse-2: show")
@ -724,12 +720,10 @@ non-transparent child section."
(put 'nxml-outline-display-heading 'evaporate t)
(put 'nxml-outline-display-heading 'face 'nxml-heading)
(defvar nxml-outline-hiding-tag-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'nxml-mouse-show-direct-subheadings)
(define-key map [mouse-2] 'nxml-mouse-show-direct-text-content)
(define-key map "\C-m" 'nxml-show-direct-text-content)
map))
(defvar-keymap nxml-outline-hiding-tag-map
"<mouse-1>" #'nxml-mouse-show-direct-subheadings
"<mouse-2>" #'nxml-mouse-show-direct-text-content
"RET" #'nxml-show-direct-text-content)
(defvar nxml-outline-hiding-tag-help
"mouse-1: show subheadings, mouse-2: show text content")
@ -739,12 +733,10 @@ non-transparent child section."
(put 'nxml-outline-display-hiding-tag 'keymap nxml-outline-hiding-tag-map)
(put 'nxml-outline-display-hiding-tag 'help-echo nxml-outline-hiding-tag-help)
(defvar nxml-outline-showing-tag-map
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'nxml-mouse-hide-subheadings)
(define-key map [mouse-2] 'nxml-mouse-show-direct-text-content)
(define-key map "\C-m" 'nxml-show-direct-text-content)
map))
(defvar-keymap nxml-outline-showing-tag-map
"<mouse-1>" #'nxml-mouse-hide-subheadings
"<mouse-2>" #'nxml-mouse-show-direct-text-content
"RET" #'nxml-show-direct-text-content)
(defvar nxml-outline-showing-tag-help
"mouse-1: hide subheadings, mouse-2: show text content")