From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: Add `notmuch-jump-to-recent-buffer'.
Date: Tue, 20 Dec 2011 10:02:11 +0200 [thread overview]
Message-ID: <yf662hb1xj0.fsf@taco2.nixu.fi> (raw)
In-Reply-To: <1290426664-15745-1-git-send-email-dme@dme.org>
On Mon, 22 Nov 2010 11:51:04 +0000, David Edmondson <dme@dme.org> wrote:
> >From a Carl Worth idea: Add `notmuch-jump-to-recent-buffer', which
> will select the most recently used notmuch buffer (search, show or
> hello). If no recent buffer is found, run `notmuch'.
>
> It is expected that the user will global bind this command to a key
> sequence.
> ---
See comments inline below.
> emacs/notmuch.el | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index e8d4d98..67271d1 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -962,6 +962,24 @@ current search results AND that are tagged with the given tag."
> (interactive)
> (notmuch-hello))
>
> +;;;###autoload
> +(defun notmuch-jump-to-recent-buffer ()
> + "Jump to the most recent notmuch buffer (search, show or hello).
> +
> +If no recent buffer is found, run `notmuch'."
> + (interactive)
> + (let ((last
> + (loop for buffer in (buffer-list)
> + if (progn
Are the last few lines above working... if without '(' and no
loop (nor for) function in my emacs (where notmuch loaded).
> + (set-buffer buffer)
I really like Aaron's comment about with-current-buffer...
> + (or (eq major-mode 'notmuch-show-mode)
> + (eq major-mode 'notmuch-search-mode)
> + (eq major-mode 'notmuch-hello-mode)))
... memq is also nice; in case used the list should be done beforehand with
(let* ...
> + return buffer)))
> + (if last
> + (switch-to-buffer last)
> + (notmuch))))
> +
> (setq mail-user-agent 'notmuch-user-agent)
>
> (provide 'notmuch)
> --
> 1.7.2.3
>
Tomi
next prev parent reply other threads:[~2011-12-20 8:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 11:51 [PATCH] emacs: Add `notmuch-jump-to-recent-buffer' David Edmondson
2011-12-19 15:57 ` David Edmondson
2011-12-19 17:58 ` Aaron Ecay
2011-12-20 8:02 ` David Edmondson
2011-12-20 8:02 ` Tomi Ollila [this message]
2011-12-20 8:12 ` Aaron Ecay
2011-12-20 8:15 ` David Edmondson
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yf662hb1xj0.fsf@taco2.nixu.fi \
--to=tomi.ollila@iki.fi \
--cc=dme@dme.org \
--cc=notmuch@notmuchmail.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.
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).