[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot
From: |
Arkady Grudzinsky |
Subject: |
Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot |
Date: |
Mon, 26 Sep 2016 16:51:35 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
On Fri, Sep 23 2016, Adam Sjøgren wrote:
> Rainer writes:
>
>> As far as I understand, the notmuch search only works on a maildir
>> (nnmaildir I think?) and not nnimap.
>
> Side note: notmuch search also works with nnml.
Notmuch works on any local maildir directory. So, if mail is
retrieved by offlineimap and stored locally in maildir, notmuch
will work even though Gnus is accessing the maildir through
Dovecot and nnimap backend. Notmuch is separate from Gnus.
I got it working. The code from https://goo.gl/VAXWxk works
perfectly. The idea is to map GG to notmuch-search. Notmuch
does its job and shows the messages in its own buffer. Then in
notmuch view buffer, I can press C-c C-c and go to that message
in Gnus. The trick is to replace the file name with Gnus news
group name. This is what replace-regexp-in-string code does.
Notmuch searches all groups regardless of their status in Gnus
and shows the whole message thread. The C-c C-c combination
opens the message in Gnus even if the message is located in a
killed group.
> (require 'notmuch)
> (add-hook 'gnus-group-mode-hook 'lld-notmuch-shortcut)
> (require 'org-gnus)
> (defun lld-notmuch-shortcut ()
> (define-key gnus-group-mode-map "GG" 'notmuch-search)
> )
> (defun lld-notmuch-file-to-group (file)
> "Calculate the Gnus group name from the given file name.
> "
> (let ((group (file-name-directory (directory-file-name (file-name-directory
> file)))))
> (setq group (replace-regexp-in-string ".*/Maildir/" "nnimap+local:"
> group))
> (setq group (replace-regexp-in-string "/$" "" group))
> (if (string-match ":$" group)
> (concat group "INBOX")
> (replace-regexp-in-string ":\\." ":" group))))
> (defun lld-notmuch-goto-message-in-gnus ()
> "Open a summary buffer containing the current notmuch
> article."
> (interactive)
> (let ((group (lld-notmuch-file-to-group (notmuch-show-get-filename)))
> (message-id (replace-regexp-in-string
> "^id:" "" (notmuch-show-get-message-id))))
> (setq message-id (replace-regexp-in-string "\"" "" message-id))
> (if (and group message-id)
> (progn
> (switch-to-buffer "*Group*")
> (org-gnus-follow-link group message-id))
> (message "Couldn't get relevant infos for switching to Gnus."))))
> (define-key notmuch-show-mode-map (kbd "C-c C-c")
> 'lld-notmuch-goto-message-in-gnus)
--
Arkady
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, (continued)
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Rainer M Krug, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Rainer M Krug, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Alan Schmitt, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Rainer M Krug, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Dave Abrahams, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Dave Abrahams, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Rainer M Krug, 2016/09/30
- Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Dave Abrahams, 2016/09/30
Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot, Rainer M Krug, 2016/09/23