diff options
author | jao <jao@gnu.org> | 2022-04-21 23:13:22 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-04-21 23:13:22 +0100 |
commit | 27df72073e2955db9c8698402b56fd1e7c9e3ab8 (patch) | |
tree | da4262f75ffd10e3c9b2b090f564e73289237cc7 /lib/net | |
parent | 1591300f7079a51067b5bcdb2b6756897d82f4bc (diff) | |
download | elibs-27df72073e2955db9c8698402b56fd1e7c9e3ab8.tar.gz elibs-27df72073e2955db9c8698402b56fd1e7c9e3ab8.tar.bz2 |
tmr
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/jao-notmuch-gnus.el | 27 |
1 files changed, 16 insertions, 11 deletions
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." |