From 0eecea083e23f85d3a987b1cf4f8956c7d3a6dda Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sat, 4 Sep 2021 16:03:38 +0200 Subject: 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. --- editors/emacs/bqn-input.el | 15 +++++++-------- 1 file 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) -- cgit v1.2.3