aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2022-07-02 12:25:03 +0200
committerStefan Kangas2022-07-02 16:37:49 +0200
commit25d80e4f8115bc297ebe99bc698e8257bb0d29b3 (patch)
tree548cbc7a0c5c7c7cc0cbdb0693dafe05ea87a630
parentb25ca542983dc885d69d263cb9719f7f3db416fa (diff)
downloademacs-25d80e4f8115bc297ebe99bc698e8257bb0d29b3.tar.gz
emacs-25d80e4f8115bc297ebe99bc698e8257bb0d29b3.zip
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.
-rw-r--r--lisp/nxml/nxml-mode.el48
-rw-r--r--lisp/nxml/nxml-outln.el54
2 files changed, 46 insertions, 56 deletions
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 171b7088c10..dfe5c369e2c 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -369,31 +369,29 @@ and, if `nxml-char-ref-display-glyph-flag' is non-nil, a glyph
369corresponding to the referenced character following the character 369corresponding to the referenced character following the character
370reference.") 370reference.")
371 371
372(defvar nxml-mode-map 372(defvar-keymap nxml-mode-map
373 (let ((map (make-sparse-keymap))) 373 :doc "Keymap for `nxml-mode'."
374 (define-key map "\M-\C-u" 'nxml-backward-up-element) 374 "C-M-u" #'nxml-backward-up-element
375 (define-key map "\M-\C-d" 'nxml-down-element) 375 "C-M-d" #'nxml-down-element
376 (define-key map "\M-\C-n" 'nxml-forward-element) 376 "C-M-n" #'nxml-forward-element
377 (define-key map "\M-\C-p" 'nxml-backward-element) 377 "C-M-p" #'nxml-backward-element
378 (define-key map "\M-{" 'nxml-backward-paragraph) 378 "M-{" #'nxml-backward-paragraph
379 (define-key map "\M-}" 'nxml-forward-paragraph) 379 "M-}" #'nxml-forward-paragraph
380 (define-key map "\M-h" 'nxml-mark-paragraph) 380 "M-h" #'nxml-mark-paragraph
381 (define-key map "\C-c\C-f" 'nxml-finish-element) 381 "C-c C-f" #'nxml-finish-element
382 (define-key map "\C-c]" 'nxml-finish-element) 382 "C-c ]" #'nxml-finish-element
383 (define-key map "\C-c/" 'nxml-finish-element) 383 "C-c /" #'nxml-finish-element
384 (define-key map "\C-c\C-m" 'nxml-split-element) 384 "C-c C-m" #'nxml-split-element
385 (define-key map "\C-c\C-b" 'nxml-balanced-close-start-tag-block) 385 "C-c C-b" #'nxml-balanced-close-start-tag-block
386 (define-key map "\C-c\C-i" 'nxml-balanced-close-start-tag-inline) 386 "C-c C-i" #'nxml-balanced-close-start-tag-inline
387 (define-key map "\C-c\C-x" 'nxml-insert-xml-declaration) 387 "C-c C-x" #'nxml-insert-xml-declaration
388 (define-key map "\C-c\C-d" 'nxml-dynamic-markup-word) 388 "C-c C-d" #'nxml-dynamic-markup-word
389 ;; u is for Unicode 389 ;; u is for Unicode
390 (define-key map "\C-c\C-u" 'nxml-insert-named-char) 390 "C-c C-u" #'nxml-insert-named-char
391 (define-key map "\C-c\C-o" nxml-outline-prefix-map) 391 "C-c C-o" nxml-outline-prefix-map
392 (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) 392 "/" #'nxml-electric-slash
393 (define-key map "/" 'nxml-electric-slash) 393 "M-TAB" #'completion-at-point
394 (define-key map "\M-\t" 'completion-at-point) 394 "S-<mouse-2>" #'nxml-mouse-hide-direct-text-content)
395 map)
396 "Keymap for `nxml-mode'.")
397 395
398(defvar nxml-font-lock-keywords 396(defvar nxml-font-lock-keywords
399 '(nxml-fontify-matcher) 397 '(nxml-fontify-matcher)
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index 928338a6af9..1518122a79d 100644
--- a/lisp/nxml/nxml-outln.el
+++ b/lisp/nxml/nxml-outln.el
@@ -129,20 +129,18 @@ See the variable `nxml-section-element-name-regexp' for more details."
129(defvar nxml-heading-scan-distance 1000 129(defvar nxml-heading-scan-distance 1000
130 "Maximum distance from section to scan for heading.") 130 "Maximum distance from section to scan for heading.")
131 131
132(defvar nxml-outline-prefix-map 132(defvar-keymap nxml-outline-prefix-map
133 (let ((map (make-sparse-keymap))) 133 "C-a" #'nxml-show-all
134 (define-key map "\C-a" 'nxml-show-all) 134 "C-t" #'nxml-hide-all-text-content
135 (define-key map "\C-t" 'nxml-hide-all-text-content) 135 "C-r" #'nxml-refresh-outline
136 (define-key map "\C-r" 'nxml-refresh-outline) 136 "C-c" #'nxml-hide-direct-text-content
137 (define-key map "\C-c" 'nxml-hide-direct-text-content) 137 "C-e" #'nxml-show-direct-text-content
138 (define-key map "\C-e" 'nxml-show-direct-text-content) 138 "C-d" #'nxml-hide-subheadings
139 (define-key map "\C-d" 'nxml-hide-subheadings) 139 "C-s" #'nxml-show
140 (define-key map "\C-s" 'nxml-show) 140 "C-k" #'nxml-show-subheadings
141 (define-key map "\C-k" 'nxml-show-subheadings) 141 "C-l" #'nxml-hide-text-content
142 (define-key map "\C-l" 'nxml-hide-text-content) 142 "C-i" #'nxml-show-direct-subheadings
143 (define-key map "\C-i" 'nxml-show-direct-subheadings) 143 "C-o" #'nxml-hide-other)
144 (define-key map "\C-o" 'nxml-hide-other)
145 map))
146 144
147;;; Commands for changing visibility 145;;; Commands for changing visibility
148 146
@@ -693,11 +691,9 @@ non-transparent child section."
693 (nxml-highlighted-qname (xmltok-end-tag-qname)) 691 (nxml-highlighted-qname (xmltok-end-tag-qname))
694 nxml-highlighted-greater-than)))) 692 nxml-highlighted-greater-than))))
695 693
696(defvar nxml-outline-show-map 694(defvar-keymap nxml-outline-show-map
697 (let ((map (make-sparse-keymap))) 695 "RET" #'nxml-show-direct-text-content
698 (define-key map "\C-m" 'nxml-show-direct-text-content) 696 "<mouse-2>" #'nxml-mouse-show-direct-text-content)
699 (define-key map [mouse-2] 'nxml-mouse-show-direct-text-content)
700 map))
701 697
702(defvar nxml-outline-show-help "mouse-2: show") 698(defvar nxml-outline-show-help "mouse-2: show")
703 699
@@ -724,12 +720,10 @@ non-transparent child section."
724(put 'nxml-outline-display-heading 'evaporate t) 720(put 'nxml-outline-display-heading 'evaporate t)
725(put 'nxml-outline-display-heading 'face 'nxml-heading) 721(put 'nxml-outline-display-heading 'face 'nxml-heading)
726 722
727(defvar nxml-outline-hiding-tag-map 723(defvar-keymap nxml-outline-hiding-tag-map
728 (let ((map (make-sparse-keymap))) 724 "<mouse-1>" #'nxml-mouse-show-direct-subheadings
729 (define-key map [mouse-1] 'nxml-mouse-show-direct-subheadings) 725 "<mouse-2>" #'nxml-mouse-show-direct-text-content
730 (define-key map [mouse-2] 'nxml-mouse-show-direct-text-content) 726 "RET" #'nxml-show-direct-text-content)
731 (define-key map "\C-m" 'nxml-show-direct-text-content)
732 map))
733 727
734(defvar nxml-outline-hiding-tag-help 728(defvar nxml-outline-hiding-tag-help
735 "mouse-1: show subheadings, mouse-2: show text content") 729 "mouse-1: show subheadings, mouse-2: show text content")
@@ -739,12 +733,10 @@ non-transparent child section."
739(put 'nxml-outline-display-hiding-tag 'keymap nxml-outline-hiding-tag-map) 733(put 'nxml-outline-display-hiding-tag 'keymap nxml-outline-hiding-tag-map)
740(put 'nxml-outline-display-hiding-tag 'help-echo nxml-outline-hiding-tag-help) 734(put 'nxml-outline-display-hiding-tag 'help-echo nxml-outline-hiding-tag-help)
741 735
742(defvar nxml-outline-showing-tag-map 736(defvar-keymap nxml-outline-showing-tag-map
743 (let ((map (make-sparse-keymap))) 737 "<mouse-1>" #'nxml-mouse-hide-subheadings
744 (define-key map [mouse-1] 'nxml-mouse-hide-subheadings) 738 "<mouse-2>" #'nxml-mouse-show-direct-text-content
745 (define-key map [mouse-2] 'nxml-mouse-show-direct-text-content) 739 "RET" #'nxml-show-direct-text-content)
746 (define-key map "\C-m" 'nxml-show-direct-text-content)
747 map))
748 740
749(defvar nxml-outline-showing-tag-help 741(defvar nxml-outline-showing-tag-help
750 "mouse-1: hide subheadings, mouse-2: show text content") 742 "mouse-1: hide subheadings, mouse-2: show text content")