emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 25d80e4f81 1/2: Prefer defvar-keymap in nxml/*.el


From: Stefan Kangas
Subject: master 25d80e4f81 1/2: Prefer defvar-keymap in nxml/*.el
Date: Sat, 2 Jul 2022 10:43:56 -0400 (EDT)

branch: master
commit 25d80e4f8115bc297ebe99bc698e8257bb0d29b3
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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.
---
 lisp/nxml/nxml-mode.el  | 48 +++++++++++++++++++++----------------------
 lisp/nxml/nxml-outln.el | 54 +++++++++++++++++++++----------------------------
 2 files changed, 46 insertions(+), 56 deletions(-)

diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index 171b7088c1..dfe5c369e2 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
 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)
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index 928338a6af..1518122a79 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."
 (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")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]