aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-09-04 16:03:38 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-09-04 17:07:54 +0200
commit0eecea083e23f85d3a987b1cf4f8956c7d3a6dda (patch)
tree007f01b9186ab6937c488106cf0b69283e899f68
parent80028848e808382a6eaf98f6a66128b7da6e3fc7 (diff)
emacs/bqn-input.el: fix reliance on undefined vars und functions
bqn--make-bqn-mode-map depended on the value of bqn-mode-map-prefix, but bqn-mode-map-prefix's set function also used bqn--make-bqn-mode-map. To break this cycle which made emacs' warnings act up a bit, we remove bqn--make-bqn-mode-map and defvar bqn--mode-map to nil initially, trusting that it'll be correctly re-defined by the initialization of bqn-mode-map-prefix via its set function. I verified that this works correctly both in the case of the initial value (although I swapped out the value for "M-" beforehand since in my setup Super doesn't seem to work at all) and redefining it using costumize-variable.
-rw-r--r--editors/emacs/bqn-input.el15
1 files changed, 7 insertions, 8 deletions
diff --git a/editors/emacs/bqn-input.el b/editors/emacs/bqn-input.el
index a0230245..82c0184b 100644
--- a/editors/emacs/bqn-input.el
+++ b/editors/emacs/bqn-input.el
@@ -30,23 +30,22 @@
(define-key map [menu-bar bqn] (cons "BQN" (make-sparse-keymap "BQN")))
map))
-(defun bqn--make-bqn-mode-map ()
- (bqn--make-base-mode-map bqn-mode-map-prefix))
+;; value gets updated by initialization of bqn-mode-map-prefix
+(defvar bqn--mode-map nil
+ "The keymap for ‘bqn-mode’.")
(defun bqn--set-mode-map-prefix (symbol new)
"Recreate the prefix and the keymap."
(set-default symbol new)
- (setq bqn--mode-map (bqn--make-bqn-mode-map)))
+ (setq bqn--mode-map (bqn--make-base-mode-map new)))
(defcustom bqn-mode-map-prefix "s-"
"The keymap prefix for ‘bqn--mode-map’ used both to store the new value using
- ‘set-create’ and to update ‘bqn--mode-map’ using `bqn--make-bqn-mode-map'.
+ ‘set-create’ and to update ‘bqn--mode-map’ using `bqn--make-base-mode-map'.
Kill and re-start your BQN buffers to reflect the change."
:type 'string
:group 'bqn
- :set 'bqn--set-mode-map-prefix)
-
-(defvar bqn--mode-map (bqn--make-bqn-mode-map)
- "The keymap for ‘bqn-mode’.")
+ :set 'bqn--set-mode-map-prefix
+ :initialize 'custom-initialize-set)
(provide 'bqn-input)