Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Arkady Grudzinsky <agrudzinsky@gmail.com>
To: info-gnus-english@gnu.org
Subject: Re: nnir-notmuch-engine setup with gnus/offlineimap/dovecot
Date: Mon, 26 Sep 2016 16:51:35 -0700	[thread overview]
Message-ID: <s5ozimujk3c.fsf@avnera.com> (raw)
In-Reply-To: <87mviyz4qg.fsf@tullinup.koldfront.dk>

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


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

  reply	other threads:[~2016-09-26 23:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 23:00 Arkady Grudzinsky
2016-09-23  5:21 ` Dmitry Alexandrov
2016-09-23  7:56   ` Rainer M Krug
2016-09-29 21:06     ` Dave Abrahams
2016-09-30  1:33       ` myglc2
2016-09-30  7:04         ` Rainer M Krug
2016-09-30 14:01           ` myglc2
2016-09-30 15:04             ` Rainer M Krug
2016-09-30 17:13             ` Dave Abrahams
2016-09-30 12:02         ` Dave Abrahams
2016-09-30 14:28           ` myglc2
2016-09-30 15:06             ` Rainer M Krug
2016-09-30  6:59       ` Rainer M Krug
2016-09-30  9:51         ` Alan Schmitt
2016-09-30 10:33           ` Rainer M Krug
2016-09-30 11:50           ` Dave Abrahams
2016-09-30 11:44         ` Dave Abrahams
2016-09-30 12:56           ` Rainer M Krug
2016-09-30 17:13             ` Dave Abrahams
2016-09-23  7:58 ` Rainer M Krug
2016-09-23 21:27   ` Adam Sjøgren
2016-09-26 23:51     ` Arkady Grudzinsky [this message]
2016-09-27  2:54       ` Adam Sjøgren
2016-09-27  7:27       ` Rainer M Krug
2016-09-28 22:10         ` Arkady Grudzinsky
2016-09-29  6:57           ` Rainer M Krug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5ozimujk3c.fsf@avnera.com \
    --to=agrudzinsky@gmail.com \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).