From 63035cff73b0f93ceb3785cda1cd4a1f068ec58c Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 14 Jun 2026 15:47:55 -0500 Subject: fix(slack): autoload w/@/# commands, guard close-all, register the prefix Three lifecycle gaps that bit before slack loads. The w / @ / # keys bound slack-message-write-another-buffer, slack-message-embed-mention, and slack-message-embed-channel, none autoloaded or in :commands, so they void-function'd before slack started; added them to :commands. cj/slack-close-all-buffers read slack-current-buffer via buffer-local-value on every buffer, which signals void-variable on buffers without the local binding; it now guards with buffer-local-boundp like its sibling. And C-; S was bound with a raw global-set-key, invisible to the keybindings registry; it now registers through cj/register-prefix-map like the signal and erc prefixes. --- modules/slack-config.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/slack-config.el b/modules/slack-config.el index 0902ef35c..adf38804c 100644 --- a/modules/slack-config.el +++ b/modules/slack-config.el @@ -45,6 +45,7 @@ (require 'system-lib) ;; provides cj/auth-source-secret-value (require 'cl-lib) +(require 'keybindings) ;; provides cj/register-prefix-map (defvar slack-current-buffer) (defvar slack-message-compose-buffer-mode-map) @@ -120,7 +121,9 @@ or more panes; this pins the choice to any non-selected window." :defer t :commands (slack-start slack-select-rooms slack-select-unread-rooms slack-im-select slack-thread-show-or-create - slack-insert-emoji slack-register-team) + slack-insert-emoji slack-register-team + slack-message-write-another-buffer + slack-message-embed-mention slack-message-embed-channel) :custom ;; Disabled: emojify-mode in lui buffers causes (wrong-type-argument listp) ;; errors on emoji characters during lui-scroll-post-command's recenter call. @@ -243,7 +246,8 @@ swallows exceptions via `websocket-try-callback'." (interactive) (let ((count 0)) (dolist (buf (buffer-list)) - (when (buffer-local-value 'slack-current-buffer buf) + (when (and (buffer-local-boundp 'slack-current-buffer buf) + (buffer-local-value 'slack-current-buffer buf)) (let ((win (get-buffer-window buf t))) (when (and win (not (window-dedicated-p win))) (delete-window win))) @@ -256,7 +260,7 @@ swallows exceptions via `websocket-try-callback'." (defvar cj/slack-keymap (make-sparse-keymap) "Keymap for Slack commands under C-; S.") -(global-set-key (kbd "C-; S") cj/slack-keymap) +(cj/register-prefix-map "S" cj/slack-keymap "slack") (define-key cj/slack-keymap (kbd "s") #'cj/slack-start) (define-key cj/slack-keymap (kbd "c") #'slack-select-unread-rooms) -- cgit v1.2.3