* Loading a notmuch email buffer in Emacs from the command line
@ 2016-02-20 4:19 Neeum Zawan
2016-02-20 10:16 ` Tomi Ollila
0 siblings, 1 reply; 3+ messages in thread
From: Neeum Zawan @ 2016-02-20 4:19 UTC (permalink / raw)
To: notmuch
Hi,
Is there a way (e.g. with emacsclient) to load up a particular email
thread or email message buffer from the command line?
Also, for those familiar with Org mode, I'd like to do something
similar: Suppose I have the ID of an email. Can I, from the command
line, launch a capture template with a prepopulated link to the notmuch
message?
The rationale: I'd like to switch to using alot for reading emails as
opposed to the Emacs interface. However, there will be times where I'd
like to make Org mode notes about an email or view it within Emacs. So
I'd like to set up a command from alot to open it in Emacs.
--
A neutrino walks into a bar. The bartender asks him if he wants
anything to drink. "No thanks, just passing through."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Loading a notmuch email buffer in Emacs from the command line
2016-02-20 4:19 Loading a notmuch email buffer in Emacs from the command line Neeum Zawan
@ 2016-02-20 10:16 ` Tomi Ollila
2016-02-24 17:21 ` Suvayu Ali
0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2016-02-20 10:16 UTC (permalink / raw)
To: Neeum Zawan, notmuch
On Sat, Feb 20 2016, Neeum Zawan <mailinglists@nawaz.org> wrote:
> Hi,
>
> Is there a way (e.g. with emacsclient) to load up a particular email
> thread or email message buffer from the command line?
quick test yields that at least
emacs -f notmuch --eval '(notmuch-search "id:87egc8nhdh.fsf@nawaz.org")'
works (maybe not exactly as desired, but based on that more should
be able to be achieved with moderate ease...)
>
> Also, for those familiar with Org mode, I'd like to do something
> similar: Suppose I have the ID of an email. Can I, from the command
> line, launch a capture template with a prepopulated link to the notmuch
> message?
>
> The rationale: I'd like to switch to using alot for reading emails as
> opposed to the Emacs interface. However, there will be times where I'd
> like to make Org mode notes about an email or view it within Emacs. So
> I'd like to set up a command from alot to open it in Emacs.
>
> --
> A neutrino walks into a bar. The bartender asks him if he wants
> anything to drink. "No thanks, just passing through."
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Loading a notmuch email buffer in Emacs from the command line
2016-02-20 10:16 ` Tomi Ollila
@ 2016-02-24 17:21 ` Suvayu Ali
0 siblings, 0 replies; 3+ messages in thread
From: Suvayu Ali @ 2016-02-24 17:21 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 930 bytes --]
On Sat, Feb 20, 2016 at 12:16:33PM +0200, Tomi Ollila wrote:
> On Sat, Feb 20 2016, Neeum Zawan <mailinglists@nawaz.org> wrote:
> >
> > Is there a way (e.g. with emacsclient) to load up a particular email
> > thread or email message buffer from the command line?
>
> quick test yields that at least
>
> emacs -f notmuch --eval '(notmuch-search "id:87egc8nhdh.fsf@nawaz.org")'
>
> works (maybe not exactly as desired, but based on that more should
> be able to be achieved with moderate ease...)
I use the attached script to open the mail I'm reading in Mutt in Emacs
so that I can link to it in my Org mode notes, etc. You could write a
function that calls the required capture templates and use it in place
of the call to notmuch-show. Probably you also want to remove the GNU
Screen related stuff (call to screen select and the check for $STY).
Hope this helps,
--
Suvayu
Open source is the future. It sets us free.
[-- Attachment #2: notmuch-emacs --]
[-- Type: text/plain, Size: 771 bytes --]
#!/bin/bash
# set -o xtrace
# FIXME: handle cases when not invoked from within screen
declare -a emacsen=(/tmp/emacs$UID/*) screens=(/var/run/screen/S-$USER/*)
# NOTE: look at screen -Q for querying
# FIXME: cleaner way of switching to threads (something like mutt-search)
declare thread=$1
[[ -n $STY ]] && { \
screen -X select nwc; # emacsclient window name for me
# NB: reading from PIPE; and it's ok to remove all <, >, or
# spaces, they are not allowed in a Message-ID
msgid=$(formail -c -x Message-ID | sed -e 's/[<> ]//g')
if [[ -n $thread ]]; then
query=$(notmuch search --output=threads -- "id:$msgid")
emacsclient --eval "(notmuch-tree \"$query\")"
else
query="id:$msgid"
emacsclient --eval "(notmuch-show \"$query\")"
fi
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-24 17:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-20 4:19 Loading a notmuch email buffer in Emacs from the command line Neeum Zawan
2016-02-20 10:16 ` Tomi Ollila
2016-02-24 17:21 ` Suvayu Ali
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).