diff options
-rw-r--r-- | init.org | 8 | ||||
-rw-r--r-- | lib/net/jao-notmuch-gnus.el | 27 |
2 files changed, 24 insertions, 11 deletions
@@ -810,6 +810,14 @@ :init (setq jao-tracking-bkg (if (jao-colors-scheme-dark-p) "grey20" "grey93"))) #+end_src +*** tmr + #+begin_src emacs-lisp + (use-package tmr + :ensure t + :init + (setq tmr-sound-file "/usr/share/sounds/freedesktop/stereo/message.oga" + tmr-descriptions-list '("tea is ready"))) + #+end_src * Calendar, diary, weather *** Diary #+BEGIN_SRC emacs-lisp diff --git a/lib/net/jao-notmuch-gnus.el b/lib/net/jao-notmuch-gnus.el index 79c8af3..c64b9f0 100644 --- a/lib/net/jao-notmuch-gnus.el +++ b/lib/net/jao-notmuch-gnus.el @@ -145,15 +145,22 @@ Example: (nntp g) (t (replace-regexp-in-string ":\\." ":" g))))) -(defun jao-notmuch-gnus-goto-message () +(defun jao-notmuch-gnus-id-to-file (id) + (when id + (let ((cmd (format "notmuch search --output=files %s" id))) + (string-trim (shell-command-to-string cmd))))) + +(defun jao-notmuch-gnus-goto-message (&optional msg-id filename) "Open a summary buffer containing the current notmuch article." (interactive) - (let ((group (jao-notmuch-gnus-file-to-group (notmuch-show-get-filename))) - (message-id (replace-regexp-in-string "^id:" - "" - (notmuch-show-get-message-id)))) - (if (and group message-id) - (org-gnus-follow-link group message-id) + (let* ((filename (or filename + (jao-notmuch-gnus-id-to-file msg-id) + (notmuch-show-get-filename))) + (group (when filename (jao-notmuch-gnus-file-to-group filename))) + (msg-id (or msg-id (notmuch-show-get-message-id))) + (msg-id (when msg-id (replace-regexp-in-string "^id:" "" msg-id)))) + (if (and group msg-id) + (org-gnus-follow-link group msg-id) (message "Couldn't get relevant infos for switching to Gnus.")))) @@ -191,10 +198,8 @@ Example: (with-eval-after-load "consult-notmuch" (defun jao-notmuch-gnus--open-candidate (candidate) "Open a notmuch-search completion candidate email in Gnus." - (consult-notmuch--preview candidate nil) - (with-current-buffer consult-notmuch--buffer-name - (jao-notmuch-gnus-goto-message) - (save-window-excursion (consult-notmuch--close-preview)))) + (message "candidate: %S" candidate) + (jao-notmuch-gnus-goto-message (consult-notmuch--thread-id candidate))) (defun jao-gnus-consult-notmuch () "Run a consult-notmuch query that opens candidates in Gnus." |