info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot


From: Rainer M Krug
Subject: Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot
Date: Tue, 27 Sep 2016 09:27:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin)

Arkady Grudzinsky <agrudzinsky@gmail.com> writes:

> 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.

Correct. 

>
> I got it working.  The code from https://goo.gl/VAXWxk works
> perfectly.

Could you please post the un-shortened URL as it has been disabled by
google?

> 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.
>

Yup - correct.

> 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)

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]