]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer defvar-keymap in two-column.el
authorStefan Kangas <stefankangas@gmail.com>
Fri, 27 Dec 2024 04:21:36 +0000 (05:21 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:45:07 +0000 (16:45 +0100)
* lisp/textmodes/two-column.el (2C-mode-map, 2C-minor-mode-map):
Convert to defvar-keymap.

(cherry picked from commit 43b81b7ecaf465eef268dd2cd94f00a0c4da87ea)

lisp/textmodes/two-column.el

index 41cd82ce728c82727261708a7396441762f70736..e4cbbbec95f5bd23cf40fcc886558f82cd1699c0 100644 (file)
@@ -162,14 +162,12 @@ minus this value."
   :type 'boolean)
 
 \f
-(defvar 2C-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "2" #'2C-two-columns)
-    (define-key map [f2] #'2C-two-columns)
-    (define-key map "b" #'2C-associate-buffer)
-    (define-key map "s" #'2C-split)
-    map)
-  "Keymap for commands for setting up two-column mode.")
+(defvar-keymap 2C-mode-map
+  :doc "Keymap for commands for setting up two-column mode."
+  "2"    #'2C-two-columns
+  "<f2>" #'2C-two-columns
+  "b"    #'2C-associate-buffer
+  "s"    #'2C-split)
 
 ;;;###autoload (autoload '2C-command "two-column" () t 'keymap)
 (fset '2C-command 2C-mode-map)
@@ -177,21 +175,19 @@ minus this value."
 ;; This one is for historical reasons and simple keyboards, it is not
 ;; at all mnemonic.  All usual sequences containing 2 were used, and
 ;; f2 could not be set up in a standard way under Emacs 18.
-;;;###autoload (global-set-key "\C-x6" #'2C-command)
-
-;;;###autoload (global-set-key [f2] #'2C-command)
-
-(defvar 2C-minor-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "1" #'2C-merge)
-    (define-key map "d" #'2C-dissociate)
-    (define-key map "o" #'2C-associated-buffer)
-    (define-key map "\^m" #'2C-newline)
-    (define-key map "|" #'2C-toggle-autoscroll)
-    (define-key map "{" #'2C-shrink-window-horizontally)
-    (define-key map "}" #'2C-enlarge-window-horizontally)
-    map)
-  "Keymap for commands for use in two-column mode.")
+;;;###autoload (keymap-global-set "C-x 6" #'2C-command)
+
+;;;###autoload (keymap-global-set "<f2>" #'2C-command)
+
+(defvar-keymap 2C-minor-mode-map
+  :doc "Keymap for commands for use in two-column mode."
+  "1"   #'2C-merge
+  "d"   #'2C-dissociate
+  "o"   #'2C-associated-buffer
+  "RET" #'2C-newline
+  "|"   #'2C-toggle-autoscroll
+  "{"   #'2C-shrink-window-horizontally
+  "}"   #'2C-enlarge-window-horizontally)
 
 (setq minor-mode-map-alist
       (cons (cons '2C-mode