]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/rect.el (rectangle-mark-mode-map): Prefer defvar-keymap.
authorStefan Kangas <stefan@marxist.se>
Mon, 18 Jul 2022 13:21:15 +0000 (15:21 +0200)
committerStefan Kangas <stefan@marxist.se>
Mon, 18 Jul 2022 13:21:15 +0000 (15:21 +0200)
lisp/rect.el

index e717d2ac7e1ac6d1939324205cc6eaeccafcd2f8..47df95b04e4459016312aa176efe2531a7d6def4 100644 (file)
@@ -634,18 +634,17 @@ with a prefix argument, prompt for START-AT and FORMAT."
 (add-function :around region-insert-function
               #'rectangle--insert-region)
 
-(defvar rectangle-mark-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [?\C-o] 'open-rectangle)
-    (define-key map [?\C-t] 'string-rectangle)
-    (define-key map [remap exchange-point-and-mark]
-      'rectangle-exchange-point-and-mark)
-    (dolist (cmd '(right-char left-char forward-char backward-char
-                   next-line previous-line))
-      (define-key map (vector 'remap cmd)
-        (intern (format "rectangle-%s" cmd))))
-    map)
-  "Keymap used while marking a rectangular region.")
+(defvar-keymap rectangle-mark-mode-map
+  :doc "Keymap used while marking a rectangular region."
+  "C-o" #'open-rectangle
+  "C-t" #'string-rectangle
+  "<remap> <exchange-point-and-mark>" #'rectangle-exchange-point-and-mark
+  "<remap> <right-char>"              #'rectangle-right-char
+  "<remap> <left-char>"               #'rectangle-left-char
+  "<remap> <forward-char>"            #'rectangle-forward-char
+  "<remap> <backward-char>"           #'rectangle-backward-char
+  "<remap> <next-line>"               #'rectangle-next-line
+  "<remap> <previous-line>"           #'rectangle-previous-line)
 
 ;;;###autoload
 (define-minor-mode rectangle-mark-mode