diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-12 00:42:52 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-12 00:42:52 -0500 |
| commit | 686c7a09fa89c0c6e619de20ed6051230c545896 (patch) | |
| tree | 79d4189a2c15cba740daf6e5bc0b626e386c7552 /modules/slack-config.el | |
| parent | 5b5a7c2926377d4563a5b52286f537489492a470 (diff) | |
| download | dotemacs-686c7a09fa89c0c6e619de20ed6051230c545896.tar.gz dotemacs-686c7a09fa89c0c6e619de20ed6051230c545896.zip | |
fix(slack): error when adding a reaction outside a Slack buffer
`cj/slack-message-add-reaction' wrapped its whole body in `when-let*' on `slack-current-buffer', so invoking C-; S ! outside a Slack message view did nothing at all, and with no message it looked like the key wasn't even bound. It now `user-error's "Not in a Slack buffer". A test covers the case.
Diffstat (limited to 'modules/slack-config.el')
| -rw-r--r-- | modules/slack-config.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/slack-config.el b/modules/slack-config.el index 14d15ecf5..3e9ae283a 100644 --- a/modules/slack-config.el +++ b/modules/slack-config.el @@ -171,14 +171,14 @@ so the Slack buffer stays usable." reaction))) (defun cj/slack-message-add-reaction () - "Add a reaction to the current Slack message using a curated shortlist." + "Add a reaction to the current Slack message using a curated shortlist. +Errors if called outside a Slack message buffer." (interactive) - (when-let* ((buf slack-current-buffer) - (team (slack-buffer-team buf)) - (reaction (cj/slack-select-reaction team))) - (slack-buffer-add-reaction-to-message buf - reaction - (slack-get-ts)))) + (let ((buf (or slack-current-buffer + (user-error "Not in a Slack buffer")))) + (when-let* ((team (slack-buffer-team buf)) + (reaction (cj/slack-select-reaction team))) + (slack-buffer-add-reaction-to-message buf reaction (slack-get-ts))))) (with-eval-after-load 'slack-buffer (advice-add 'slack-reaction-echo-description |
