diff options
| author | Craig Jennings <c@cjennings.net> | 2026-03-06 14:50:31 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-03-06 14:50:31 -0600 |
| commit | 786171248678dc1769be1f24d4bc875761f8a451 (patch) | |
| tree | 2c24a590a6da158f977b8a31fd0e7949c84a82be | |
| parent | fc271461ac3b16ec161750335b5cb0bc81660639 (diff) | |
fix(slack): fix notification and mark-as-read bugs
Notifications silently failed: slack-room-im-p (nonexistent) replaced
with slack-im-p; slack-message-to-string replaced with slack-message-body.
Mark-as-read bound to nonexistent function; added cj/slack-mark-read-and-bury.
| -rw-r--r-- | modules/slack-config.el | 15 | ||||
| -rw-r--r-- | todo.org | 43 |
2 files changed, 55 insertions, 3 deletions
diff --git a/modules/slack-config.el b/modules/slack-config.el index 5ff33917..067c94ff 100644 --- a/modules/slack-config.el +++ b/modules/slack-config.el @@ -93,13 +93,22 @@ MESSAGE is the incoming slack message, ROOM is the channel/DM, TEAM is the slack team object." (when (and (not (slack-message-minep message team)) - (or (slack-room-im-p room) + (or (slack-im-p room) (slack-message-mentioned-p message))) (let ((title (format "Slack: %s" (slack-room-display-name room team))) - (body (slack-message-to-string message team))) + (body (slack-message-body message team))) (start-process "slack-notify" nil "notify" "info" title body)))) +(defun cj/slack-mark-read-and-bury () + "Mark the current Slack channel as read and bury the buffer." + (interactive) + (when (and (boundp 'slack-current-buffer) slack-current-buffer) + (let ((ts (slack-buffer-latest-ts slack-current-buffer))) + (when ts + (slack-buffer-update-mark-request slack-current-buffer ts)))) + (bury-buffer)) + ;; ------------------------------ Keybindings ---------------------------------- (defvar cj/slack-keymap (make-sparse-keymap) @@ -117,7 +126,7 @@ TEAM is the slack team object." (define-key cj/slack-keymap (kbd "!") #'slack-message-add-reaction) (define-key cj/slack-keymap (kbd "@") #'slack-message-embed-mention) (define-key cj/slack-keymap (kbd "#") #'slack-message-embed-channel) -(define-key cj/slack-keymap (kbd "q") #'slack-buffer-mark-as-read-and-bury) +(define-key cj/slack-keymap (kbd "q") #'cj/slack-mark-read-and-bury) (define-key cj/slack-keymap (kbd "S") #'cj/slack-stop) (which-key-add-keymap-based-replacements cj/slack-keymap @@ -71,6 +71,49 @@ to better defaults via org-reveal-head-preamble CSS or custom theme. Create a custom reveal.js CSS theme using colors from themes/dupre-palette.el. Install into reveal.js/css/theme/ for use with #+REVEAL_THEME: dupre. +** Slack + +*** VERIFY [#B] Test Slack desktop notifications (DM and @mention) + +Notifications were silently failing due to two bugs in cj/slack-notify: +1. ~slack-room-im-p~ (nonexistent) → ~slack-im-p~ (correct EIEIO predicate) +2. ~slack-message-to-string~ (propertized) → ~slack-message-body~ (plain text) + +**Testing Steps:** + +1. Open slack-config.el and run ~M-x eval-buffer~ +2. Connect to Slack: ~C-; S s~ +3. In any Slack channel, type ~/remind me in 1 minute test notification~ +4. Wait for Slackbot DM — a desktop notification should appear +5. Verify notification shows "Slack: DM: Slackbot" as title with message body + +**If notification does NOT appear:** +- Check ~*Messages*~ buffer for errors mentioning ~cj/slack-notify~ +- Verify ~notify~ command works standalone: run ~notify info "Test" "Hello"~ in a terminal + +**Files Modified:** +- modules/slack-config.el (cj/slack-notify function) + +*** VERIFY [#B] Test Slack mark-as-read and bury buffer (C-; S q) + +~C-; S q~ was bound to ~slack-buffer-mark-as-read-and-bury~ which doesn't exist +in the emacs-slack package. Replaced with ~cj/slack-mark-read-and-bury~. + +**Testing Steps:** + +1. Open slack-config.el and run ~M-x eval-buffer~ +2. Connect to Slack: ~C-; S s~ +3. Open any channel with unread messages: ~C-; S c~ +4. Press ~C-; S q~ — buffer should bury without error +5. Reopen the same channel: ~C-; S c~ — it should no longer appear as unread + +**If it errors:** +- Check ~*Messages*~ buffer for the specific error +- Verify ~slack-current-buffer~ is bound in the Slack buffer: ~C-h v slack-current-buffer~ + +**Files Modified:** +- modules/slack-config.el (new cj/slack-mark-read-and-bury function + keybinding) + ** Mail *** VERIFY [#B] Fix mail attachment workflow (currently awkward) |
