From b8ab65a70a9d4900b54cce807981d8fdcb6b38dc Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sat, 4 Sep 2021 14:55:28 +0200 Subject: emacs/bqn-input.el: define bqn--make-key-command-sym at compile time When byte compiling bqn--make-key-command-sym wouldn't be defined when it's used in make-insert-functions directly below. This can be fixed by forcing the defun to be evaluated at compile-time using eval-and-compile while still making sure it is also available when loaded normally. --- editors/emacs/bqn-input.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/editors/emacs/bqn-input.el b/editors/emacs/bqn-input.el index 4e847094..8ec5c4f7 100644 --- a/editors/emacs/bqn-input.el +++ b/editors/emacs/bqn-input.el @@ -3,8 +3,9 @@ (require 'cl-lib) (require 'bqn-symbols) -(defun bqn--make-key-command-sym (n) - (intern (concat "insert-sym-bqn-" n))) +(eval-and-compile + (defun bqn--make-key-command-sym (n) + (intern (concat "insert-sym-bqn-" n)))) (cl-macrolet ((make-insert-functions () `(progn -- cgit v1.2.3 From 80028848e808382a6eaf98f6a66128b7da6e3fc7 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sat, 4 Sep 2021 15:01:50 +0200 Subject: emacs/bqn-input.el: make defcustom docstring max-width happy A docstring wider than 80 characters causes a warning when compiling which isn't too much trouble to clean up. --- editors/emacs/bqn-input.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/editors/emacs/bqn-input.el b/editors/emacs/bqn-input.el index 8ec5c4f7..a0230245 100644 --- a/editors/emacs/bqn-input.el +++ b/editors/emacs/bqn-input.el @@ -39,9 +39,9 @@ (setq bqn--mode-map (bqn--make-bqn-mode-map))) (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'. Kill and re-start your BQN buffers to reflect the change." + "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'. + Kill and re-start your BQN buffers to reflect the change." :type 'string :group 'bqn :set 'bqn--set-mode-map-prefix) -- cgit v1.2.3 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