* Snippet to jump to message in Gnus from notmuch-show buffer @ 2009-11-24 8:02 Tassilo Horn 2009-11-27 12:54 ` Carl Worth ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Tassilo Horn @ 2009-11-24 8:02 UTC (permalink / raw) To: notmuch Hi all, I'm a Gnus user and use notmuch mostly for searching. When I want to reply to a message, I need to get back to Gnus, so that my Gnus posting styles (gcc into that group, right email address, correct signature,...) are applied. Therefore, I created this small snippet. Now C-c C-c inside some message in the *notmuch-show* buffer opens this article in a Gnus *Summary* buffer, where I can reply to it, forward it, ... Of course, the translation from file name to Gnus group name is something that is different for any user. The essence of this code is the call to the org-gnus.el function `org-gnus-follow-link', which takes the group name and the message-id. It's included in Emacsen >= 23. --8<---------------cut here---------------start------------->8--- (require 'notmuch) (defun th-notmuch-file-to-group (file) "Calculate the Gnus group name from the given file name. Example: IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075 OUT: nnimap+Uni:INBOX" (concat "nnimap+" (replace-regexp-in-string "^\\([^/]+\\)/" "\\1:" (replace-regexp-in-string "/dbox-Mails/.*" "" (replace-regexp-in-string "/home/horn/Mail/Dovecot/" "" file))))) (defun th-notmuch-goto-message-in-gnus () "Open a summary buffer containing the current notmuch article." (interactive) (let ((group (th-notmuch-file-to-group (notmuch-show-get-filename))) (message-id (replace-regexp-in-string "^id:" "" (notmuch-show-get-message-id)))) (message "G: %s, mid: %s" group message-id) (if (and group message-id) (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") 'th-notmuch-goto-message-in-gnus) --8<---------------cut here---------------end--------------->8--- BTW, why does `notmuch-show-get-message-id' prefix the message-id with "id:"? Bye, Tassilo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-24 8:02 Snippet to jump to message in Gnus from notmuch-show buffer Tassilo Horn @ 2009-11-27 12:54 ` Carl Worth 2009-11-27 17:29 ` Kan-Ru Chen 2009-11-27 13:31 ` Carl Worth 2010-11-21 1:12 ` Brett Viren 2 siblings, 1 reply; 9+ messages in thread From: Carl Worth @ 2009-11-27 12:54 UTC (permalink / raw) To: Tassilo Horn, notmuch On Tue, 24 Nov 2009 09:02:46 +0100, Tassilo Horn <tassilo@member.fsf.org> wrote: > I'm a Gnus user and use notmuch mostly for searching. When I want to > reply to a message, I need to get back to Gnus, so that my Gnus posting > styles (gcc into that group, right email address, correct signature,...) > are applied. Oh, good. I've been hoping to be able to get some advice from gnus users. I want to figure out how to get gnus support for viewing encrypted messages, etc. Do you happen to know some good documentation for how to get started with gnus for reading mail? I'd be happy even with the bare minimum to just get gnus to view one single message from out of my mail store. (Which is something I tried to figure out from the gnus manual, but I neve succeeded.) > Therefore, I created this small snippet. Now C-c C-c inside some > message in the *notmuch-show* buffer opens this article in a Gnus > *Summary* buffer, where I can reply to it, forward it, ... > > Of course, the translation from file name to Gnus group name is > something that is different for any user. The essence of this code is > the call to the org-gnus.el function `org-gnus-follow-link', which takes > the group name and the message-id. It's included in Emacsen >= 23. > > --8<---------------cut here---------------start------------->8--- > (require 'notmuch) > > (defun th-notmuch-file-to-group (file) > "Calculate the Gnus group name from the given file name. > > Example: > > IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075 > OUT: nnimap+Uni:INBOX" > (concat "nnimap+" > (replace-regexp-in-string > "^\\([^/]+\\)/" "\\1:" > (replace-regexp-in-string > "/dbox-Mails/.*" "" > (replace-regexp-in-string > "/home/horn/Mail/Dovecot/" "" file))))) > > (defun th-notmuch-goto-message-in-gnus () > "Open a summary buffer containing the current notmuch > article." > (interactive) > (let ((group (th-notmuch-file-to-group (notmuch-show-get-filename))) > (message-id (replace-regexp-in-string > "^id:" "" (notmuch-show-get-message-id)))) > (message "G: %s, mid: %s" group message-id) > (if (and group message-id) > (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") 'th-notmuch-goto-message-in-gnus) > --8<---------------cut here---------------end--------------->8--- > > BTW, why does `notmuch-show-get-message-id' prefix the message-id with > "id:"? > > Bye, > Tassilo > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-27 12:54 ` Carl Worth @ 2009-11-27 17:29 ` Kan-Ru Chen 0 siblings, 0 replies; 9+ messages in thread From: Kan-Ru Chen @ 2009-11-27 17:29 UTC (permalink / raw) To: notmuch [-- Attachment #1: Type: text/plain, Size: 638 bytes --] On Fri, 27 Nov 2009 04:54:17 -0800, Carl Worth <cworth@cworth.org> wrote: > Do you happen to know some good documentation for how to get started > with gnus for reading mail? I'd be happy even with the bare minimum to > just get gnus to view one single message from out of my mail > store. (Which is something I tried to figure out from the gnus manual, > but I neve succeeded.) The easiest way to view a mbox in gnus is using Foreign Group, IMO. Start gnus then type C-u Gf, it will ask the file location and file type. You can also use Gm to add other foreign groups, but they still need some basic settings. Cheers, Kanru [-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-24 8:02 Snippet to jump to message in Gnus from notmuch-show buffer Tassilo Horn 2009-11-27 12:54 ` Carl Worth @ 2009-11-27 13:31 ` Carl Worth 2009-11-27 22:10 ` Tassilo Horn 2010-11-21 1:12 ` Brett Viren 2 siblings, 1 reply; 9+ messages in thread From: Carl Worth @ 2009-11-27 13:31 UTC (permalink / raw) To: Tassilo Horn, notmuch [Sorry for the previous abbreviated reply---I suppose an early send is bound to happen when you give me a new function with a "C-c C-c" binding. ;-)] On Tue, 24 Nov 2009 09:02:46 +0100, Tassilo Horn <tassilo@member.fsf.org> wrote: > I'm a Gnus user and use notmuch mostly for searching. When I want to > reply to a message, I need to get back to Gnus, so that my Gnus posting > styles (gcc into that group, right email address, correct signature,...) > are applied. Oh, good. I've been hoping to be able to get some advice from gnus users. I want to figure out how to get gnus support for viewing encrypted messages, etc. Do you happen to know some good documentation for how to get started with gnus for reading mail? I'd be happy even with the bare minimum to just get gnus to view one single message from out of my mail store. (Which is something I tried to figure out from the gnus manual, but I never succeeded at.) > Therefore, I created this small snippet. Now C-c C-c inside some > message in the *notmuch-show* buffer opens this article in a Gnus > *Summary* buffer, where I can reply to it, forward it, ... And this would be exactly the thing I would want for exploring gnus, if only I could get it working. If I just try to run it, I get: Symbol's function definition is void: org-gnus-follow-link And I suppose that's expected since I don't have gnus "running". If I try to start gnus with "M-x gnus", I get: Unable to open server nntp+news, go offline? (y or n) What's the simplest way for me to tell gnus that I won't be using it in any other way than with the "nnimap+" folder I can tell you're using in your snippet? > BTW, why does `notmuch-show-get-message-id' prefix the message-id with > "id:"? That's to make the returned value a valid search string for sake of "notmuch search". Compare to the way `notmuch-search-find-thread-id' includes a "thread:" prefix. -Carl ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-27 13:31 ` Carl Worth @ 2009-11-27 22:10 ` Tassilo Horn 2009-11-28 14:55 ` Adam Sjøgren 2009-12-02 20:51 ` Carl Worth 0 siblings, 2 replies; 9+ messages in thread From: Tassilo Horn @ 2009-11-27 22:10 UTC (permalink / raw) To: Carl Worth; +Cc: notmuch Carl Worth <cworth@cworth.org> writes: Hi Carl, > On Tue, 24 Nov 2009 09:02:46 +0100, Tassilo Horn <tassilo@member.fsf.org> wrote: >> I'm a Gnus user and use notmuch mostly for searching. When I want to >> reply to a message, I need to get back to Gnus, so that my Gnus >> posting styles (gcc into that group, right email address, correct >> signature,...) are applied. > > Oh, good. I've been hoping to be able to get some advice from gnus > users. I want to figure out how to get gnus support for viewing > encrypted messages, etc. Oh, I don't have any clue about encryption. EasyPG is a keyword, that I can provide, though. > Do you happen to know some good documentation for how to get started > with gnus for reading mail? I'd be happy even with the bare minimum to > just get gnus to view one single message from out of my mail > store. (Which is something I tried to figure out from the gnus manual, > but I never succeeded at.) Well, if you only want to have a look at a maildir or mbox, and don't want to make the group permanent and let gnus fetch mail, then this should do the trick. M-x gnus RET ;; brings you into the *Group* buffer, and then ,----[ (info "(gnus)Foreign Groups") ] | `G m' | Make a new group (`gnus-group-make-group'). Gnus will prompt you | for a name, a method and possibly an "address". For an easier way | to subscribe to NNTP groups (*note Browse Foreign Server::). `---- >> Therefore, I created this small snippet. Now C-c C-c inside some >> message in the *notmuch-show* buffer opens this article in a Gnus >> *Summary* buffer, where I can reply to it, forward it, ... > > And this would be exactly the thing I would want for exploring gnus, > if only I could get it working. This does only work if the group already exists inside Gnus. So you might consider setting it up properly, although it's a bit first-time effort. > If I just try to run it, I get: > > Symbol's function definition is void: org-gnus-follow-link Do you use Emacs 23? If yes, put a (require 'org-gnus) before the call. If not, you have to install org-mode manually. > And I suppose that's expected since I don't have gnus "running". If I > try to start gnus with "M-x gnus", I get: > > Unable to open server nntp+news, go offline? (y or n) Hm, I can reproduce that with "emacs -Q". Looks wrong to me, probably a bug... Normally, an unconfigured Gnus should start having one nndoc server providing some groups with static Gnus infos (FAQ and stuff). > What's the simplest way for me to tell gnus that I won't be using it > in any other way than with the "nnimap+" folder I can tell you're > using in your snippet? Here's a quick walkthrough my .gnus.el with only the basics (getting mail/news). --8<---------------cut here---------------start------------->8--- ;; Gnus has the concept of one select method, and a list of so-called ;; secondary select methods. I set the former to a do-nothing backend ;; and only use the secondary ones, so that it's a bit more uniformly. (setq gnus-select-method '(nnnil)) ;; Fetch news from my university's nntp server (add-to-list 'gnus-secondary-select-methods '(nntp "Uni" (nntp-address "news.uni-koblenz.de") (nntp-open-connection-function nntp-open-tls-stream) (nntp-port-number 563))) ;; Fetch mail from some POP3 accounts and split them according to ;; address ;; The mails are stored in an nnml group at the given directory (add-to-list 'gnus-secondary-select-methods '(nnml "Popmail" (nnml-directory "~/Mail/Popmail") (nnml-active-file "~/Mail/Popmail/active"))) ;; Here the mails are fetched (setq mail-sources `((pop :server "pop.gmx.de" :user "xxxxx@gmx.de" :password ,th-gnus-gmx-password) (pop :server "pop3.freenet.de" :user "xxxxx@freenet.de" :password ,th-gnus-freenet-password))) ;; Split them into the groups nnml+Popmail:gmx, freenet, and misc (setq nnmail-split-methods 'nnmail-split-fancy nnmail-split-fancy '(| (any "xxxxx@gmx.de" "gmx") (any "xxxxx@freenet.de" "freenet") "misc")) ;; Get mail from my local Dovecot IMAP server which I sync with my ;; different accounts using OfflineIMAP (add-to-list 'gnus-secondary-select-methods '(nnimap "Fastmail" (nnimap-address "localhost") (nnimap-stream network) (nnimap-authenticator login))) (add-to-list 'gnus-secondary-select-methods '(nnimap "Uni" (nnimap-address "localhost") (nnimap-stream network) (nnimap-authenticator login))) --8<---------------cut here---------------end--------------->8--- HTH, Tassilo ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-27 22:10 ` Tassilo Horn @ 2009-11-28 14:55 ` Adam Sjøgren 2009-12-02 20:51 ` Carl Worth 1 sibling, 0 replies; 9+ messages in thread From: Adam Sjøgren @ 2009-11-28 14:55 UTC (permalink / raw) To: notmuch On Fri, 27 Nov 2009 23:10:30 +0100, Tassilo wrote: >> Unable to open server nntp+news, go offline? (y or n) > Hm, I can reproduce that with "emacs -Q". Looks wrong to me, probably a > bug... Normally, an unconfigured Gnus should start having one nndoc > server providing some groups with static Gnus infos (FAQ and stuff). I don't think that is a bug, Gnus defaults to connecting to a news-server (more info in "Finding the News" in the manual¹.) I think the minimal way to configure Gnus to start up without contacting a news-server is: (setq gnus-select-method '(nnnil "")) Best regards, Adam ¹ http://gnus.org/manual/gnus_2.html -- "I'll dye without my hair!" Adam Sjøgren asjo@koldfront.dk ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-27 22:10 ` Tassilo Horn 2009-11-28 14:55 ` Adam Sjøgren @ 2009-12-02 20:51 ` Carl Worth 2009-12-02 21:12 ` Adam Sjøgren 1 sibling, 1 reply; 9+ messages in thread From: Carl Worth @ 2009-12-02 20:51 UTC (permalink / raw) To: Tassilo Horn; +Cc: notmuch [-- Attachment #1: Type: text/plain, Size: 4169 bytes --] On Fri, 27 Nov 2009 23:10:30 +0100, Tassilo Horn <tassilo@member.fsf.org> wrote: > Well, if you only want to have a look at a maildir or mbox, and don't > want to make the group permanent and let gnus fetch mail, then this > should do the trick. > > M-x gnus RET ;; brings you into the *Group* buffer, and then ... > | `G m' > | Make a new group (`gnus-group-make-group'). Gnus will prompt you For viewing an mbox, I successfully used "C-u G f" that you mentioned earlier. So I've at least now seen gnus in action, thanks! What I'd really to view is a maildir though, but I haven't gotten "G m" to work with that yet. It prompts me for a "group name", (which I assume is just an arbitrary string), then a "from method" which offers tab completion for things that look promising (such as "nnmh" and "nnmaildir") but I can't get anything to work past that. I never see anything prompting for an actual directory, and it either ends up creating an empty directory, (such as ${HOME}/Mail/<groupname>), or complaining "Wrong type argument: stringp, nil". I even guessthat that maybe it wants "nnmaildir:/path/to/maildir" or maybe "nnmaildir+/path/to/maildir" but the prompt won't accept either of these (just says "[No match]"). And now I've got an entry in the *Group* buffer for each of my attempts, which variously complain ("Couldn't open server" for nnmaildir:foo, "Group nnmh:bar contains no messages", and "Couldn't activate group test: No such group"---I can't remember how I created that one). Where are all of these groups stored now? (I couldn't find anything matching ~/.gnus* nor any changes to my .emacs file.) Yet I still see these broken groups even with "emacs -q -f gnus". And how do I delete these? Update: It looks like I've got stuff in ~/.newsrc, ~/.newsrc-dribble, and ~/.newsrc.eld from my various thrashing here. Still not clear how to delete things---.newsrc.eld says I shouldn't delete it but should touch ~/.newsrc instead, but that doesn't seem to have any effect. I went ahead and deleted ~/.newsrc* and most of this stuff does seem to be nicely cleaned up. All that's left is that I now get a warning on starting gnus of "Gnus auto-save file exits. Do you want to read it? (y or n)". If I do read it, then I get some of the junk groups back. I can't figure out where this auto-save file exists, (it's even hiding From my attempt with strace). > This does only work if the group already exists inside Gnus. So you > might consider setting it up properly, although it's a bit first-time > effort. I'll keep trying... > (setq gnus-select-method '(nnnil)) Thanks for this! This allows me to start gnus without the annoying "go offline?" errors. And what's more, when I put this in my .emacs, delete all of ~/.newsrc*, *and* answer "no" to the prompt to read the gnus auto-save file---if I do all of that then I *finally* get the "gnus-help" group that I'm certain I was supposed to get the first time I ran "M-x gnus". So maybe I'll be able to find something in there. Hrm... still seeing the same inscrutable stuff that I find every time I try to read gnus documentation. The "I want to read my mail!" post describes "nnml" as "a one-file-one-mail backend" but then the closest it gets to how to use it is: So if you want to go with nnmbox, you can simply say: (setq gnus-secondary-select-methods '((nnmbox ""))) (The same for the other methods, kind of.) And I'm lost. Besides the "kind of", which just makes me uneasy, how does it make sense to configure an mbox backend with just an empty string? Surely something needs to be told where to find an actual mbox file? Or is this just selecting a backend for how GNUS should store mail that it fetches? Is there any hope for someone like me that doesn't want GNUS involved in fetching mail, but just wants to use GNUS to read mail files that I have in a big hierarchy of directories? I keep feeling there must be a simple document somewhere that explains how to do that---but I just can't find it. -Carl (hoping that notmuch will eventually be more approachable than gnus) [-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-12-02 20:51 ` Carl Worth @ 2009-12-02 21:12 ` Adam Sjøgren 0 siblings, 0 replies; 9+ messages in thread From: Adam Sjøgren @ 2009-12-02 21:12 UTC (permalink / raw) To: notmuch On Wed, 02 Dec 2009 12:51:41 -0800, Carl wrote: > Hrm... still seeing the same inscrutable stuff that I find every time I > try to read gnus documentation. The "I want to read my mail!" post > describes "nnml" as "a one-file-one-mail backend" but then the closest > it gets to how to use it is: > So if you want to go with nnmbox, you can simply say: > (setq gnus-secondary-select-methods '((nnmbox ""))) > (The same for the other methods, kind of.) > And I'm lost. Besides the "kind of", which just makes me uneasy, how > does it make sense to configure an mbox backend with just an empty > string? Surely something needs to be told where to find an actual mbox > file? It uses its defaults. I use nnml to store my email (I like the one-file per email, indexed). To do that, I've simply added: ; Get email, and store in nnml: (setq gnus-secondary-select-methods '((nnml ""))) to my .gnus. Note that this makes Gnus fetch your email and store it in nnml-"format" under ~/Mail/ I would expect that setting mail-sources to an empty list will make Gnus not fetch your email for you. If you store your maildirs somewhere Gnus doesn't expect, you can configure the select-method further - see the nnmaildir node in the manual for instance, you can set 'directory' etc. > Or is this just selecting a backend for how GNUS should store mail that > it fetches? Yes, exactly. > Is there any hope for someone like me that doesn't want GNUS involved in > fetching mail, but just wants to use GNUS to read mail files that I have > in a big hierarchy of directories? Mail files in what format? I think the quickest way to do that is using foreign groups (but I've usually only used that to view mbox and RMAIL-files, maybe configuring a secondary select method is better with maildir). (It's "Gnus" by the way - "GNUS" was the predecessor of Gnus). > I keep feeling there must be a simple document somewhere that explains > how to do that---but I just can't find it. Simple and Gnus isn't always compatible :-) Best regards, Adam -- "Favours for the ungrateful Adam Sjøgren Unqualified & hateful" asjo@koldfront.dk ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Snippet to jump to message in Gnus from notmuch-show buffer 2009-11-24 8:02 Snippet to jump to message in Gnus from notmuch-show buffer Tassilo Horn 2009-11-27 12:54 ` Carl Worth 2009-11-27 13:31 ` Carl Worth @ 2010-11-21 1:12 ` Brett Viren 2 siblings, 0 replies; 9+ messages in thread From: Brett Viren @ 2010-11-21 1:12 UTC (permalink / raw) To: notmuch Hi Tassilo, I adapted your code for my use and found it was failing due to some stray double-quotes. I'm using notmuch from git so maybe these quotes were added in the year since you first posted your idea. See below for the simple fix: On Tue, Nov 24, 2009 at 3:02 AM, Tassilo Horn <tassilo@member.fsf.org> wrote: > --8<---------------cut here---------------start------------->8--- > (require 'notmuch) > > (defun th-notmuch-file-to-group (file) > "Calculate the Gnus group name from the given file name. > > Example: > > IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075 > OUT: nnimap+Uni:INBOX" > (concat "nnimap+" > (replace-regexp-in-string > "^\\([^/]+\\)/" "\\1:" > (replace-regexp-in-string > "/dbox-Mails/.*" "" > (replace-regexp-in-string > "/home/horn/Mail/Dovecot/" "" file))))) > > (defun th-notmuch-goto-message-in-gnus () > "Open a summary buffer containing the current notmuch > article." > (interactive) > (let ((group (th-notmuch-file-to-group (notmuch-show-get-filename))) > (message-id (replace-regexp-in-string > "^id:" "" (notmuch-show-get-message-id)))) I needed to define the message-id like: (message-id (replace-regexp-in-string "\"" "" (replace-regexp-in-string "^id:" "" (notmuch-show-get-message-id))))) > (message "G: %s, mid: %s" group message-id) > (if (and group message-id) > (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") 'th-notmuch-goto-message-in-gnus) > --8<---------------cut here---------------end--------------->8--- Regards and thanks for this handy code! -Brett. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-11-21 1:12 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-11-24 8:02 Snippet to jump to message in Gnus from notmuch-show buffer Tassilo Horn 2009-11-27 12:54 ` Carl Worth 2009-11-27 17:29 ` Kan-Ru Chen 2009-11-27 13:31 ` Carl Worth 2009-11-27 22:10 ` Tassilo Horn 2009-11-28 14:55 ` Adam Sjøgren 2009-12-02 20:51 ` Carl Worth 2009-12-02 21:12 ` Adam Sjøgren 2010-11-21 1:12 ` Brett Viren
Code repositories for project(s) associated with this public inbox https://yhetil.org/notmuch.git/ 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 read-only IMAP folder(s) and NNTP newsgroup(s).