Skip to content

Commit f615058

Browse files
committed
Use keymap- forms and defvar-keymap inside code
1 parent 300f430 commit f615058

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

god-mode-isearch.el

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
;; Author: Chris Done <chrisdone@gmail.com>
77
;; URL: https://github.com/emacsorphanage/god-mode
88
;; Version: 2.19.0
9-
;; Package-Requires: ((emacs "26.3"))
9+
;; Package-Requires: ((emacs "29"))
1010

1111
;; This file is free software; you can redistribute it and/or modify
1212
;; it under the terms of the GNU General Public License as published by
@@ -29,16 +29,16 @@
2929

3030
;; Recommended use:
3131

32-
;; (define-key isearch-mode-map (kbd "<escape>") 'god-mode-isearch-activate)
33-
;; (define-key god-mode-isearch-map (kbd "<escape>") 'god-mode-isearch-disable)
32+
;; (keymap-set isearch-mode-map "<escape>" 'god-mode-isearch-activate)
33+
;; (keymap-set god-mode-isearch-map "<escape>" 'god-mode-isearch-disable)
3434

35-
(defvar god-mode-isearch-map
36-
(let ((map (copy-keymap isearch-mode-map)))
37-
(define-key map (kbd "s") 'isearch-repeat-forward)
38-
(define-key map (kbd "r") 'isearch-repeat-backward)
39-
(define-key map (kbd "w") 'isearch-yank-word-or-char)
40-
map)
41-
"Keymap for modal isearch.")
35+
(defvar-keymap god-mode-isearch-map
36+
:parent isearch-mode-map
37+
:doc
38+
"Keymap for modal isearch."
39+
"s" #'isearch-repeat-forward
40+
"r" #'isearch-repeat-backward
41+
"w" #'isearch-yank-word-or-char)
4242

4343
(defun god-mode-isearch-activate ()
4444
"Activate God mode in the isearch buffer."

god-mode.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,17 @@ For example, calling with arguments 5 and t yields the symbol `S-f5'."
127127
(defvar god-local-mode-map
128128
(let ((map (make-sparse-keymap)))
129129
(suppress-keymap map t)
130-
(define-key map [remap self-insert-command] 'god-mode-self-insert)
130+
(keymap-set map "<remap> <self-insert-command>" #'god-mode-self-insert)
131131
(let ((i ?\s))
132132
(while (< i 256)
133-
(define-key map (vector i) 'god-mode-self-insert)
133+
(keymap-set map (single-key-description i) 'god-mode-self-insert)
134134
(setq i (1+ i))))
135135
(when god-mode-enable-function-key-translation
136136
(dotimes (i 35)
137-
(define-key map (vector (god-mode-make-f-key (1+ i))) 'god-mode-self-insert)
138-
(define-key map (vector (god-mode-make-f-key (1+ i) t)) 'god-mode-self-insert)))
139-
(define-key map (kbd "DEL") nil)
140-
(define-key map (kbd "C-h k") #'god-mode-describe-key)
137+
(keymap-set map (single-key-description (god-mode-make-f-key (1+ i))) 'god-mode-self-insert)
138+
(keymap-set map (single-key-description (god-mode-make-f-key (1+ i) t)) 'god-mode-self-insert)))
139+
(keymap-set map "DEL" nil)
140+
(keymap-set map "C-h k" #'god-mode-describe-key)
141141
map))
142142

143143
;;;###autoload
@@ -211,7 +211,7 @@ is a negative number."
211211
(call-interactively binding)
212212
(execute-kbd-macro binding)))))
213213

214-
(define-key universal-argument-map (kbd "u")
214+
(keymap-set universal-argument-map "u"
215215
#'god-mode-maybe-universal-argument-more)
216216

217217
(defun god-mode-self-insert ()

0 commit comments

Comments
 (0)