unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: Cycle through notmuch buffers rather than jumping to the last.
Date: Tue, 27 Dec 2011 21:23:25 +0200	[thread overview]
Message-ID: <87vcp1es42.fsf@nikula.org> (raw)
In-Reply-To: <1324983044-29249-1-git-send-email-dme@dme.org>

On Tue, 27 Dec 2011 10:50:44 +0000, David Edmondson <dme@dme.org> wrote:
> As suggested by j4ni in #notmuch, rename
> `notmuch-jump-to-recent-buffer' as `notmuch-cycle-notmuch-buffers' and
> have it behave accordingly.

Hi David, thanks for submitting this. It works nicely, and IMHO it's
*much* more useful than notmuch-jump-to-recent-buffer.

I'm wondering whether message-mode should be included. I tried it, and
it's useful in my interrupted-more-often-than-I'd-like-to workflow...

BR,
Jani.



> ---
>  emacs/notmuch.el |   39 +++++++++++++++++++++++++++------------
>  1 files changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index c678c93..4844385 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -1056,20 +1056,35 @@ current search results AND that are tagged with the given tag."
>    (notmuch-hello))
>  
>  ;;;###autoload
> -(defun notmuch-jump-to-recent-buffer ()
> -  "Jump to the most recent notmuch buffer (search, show or hello).
> +(defun notmuch-cycle-notmuch-buffers ()
> +  "Cycle through any existing notmuch buffers (search, show or hello).
>  
> -If no recent buffer is found, run `notmuch'."
> +If the current buffer is the only notmuch buffer, bury it. If no
> +notmuch buffers exist, run `notmuch'."
>    (interactive)
> -  (let ((last
> -	 (loop for buffer in (buffer-list)
> -	       if (with-current-buffer buffer
> -		    (memq major-mode '(notmuch-show-mode
> -				       notmuch-search-mode
> -				       notmuch-hello-mode)))
> -	       return buffer)))
> -    (if last
> -	(switch-to-buffer last)
> +
> +  (let (start first)
> +    ;; If the current buffer is a notmuch buffer, remember it and then
> +    ;; bury it.
> +    (when (memq major-mode '(notmuch-show-mode
> +			     notmuch-search-mode
> +			     notmuch-hello-mode))
> +      (setq start (current-buffer))
> +      (bury-buffer))
> +
> +    ;; Find the first notmuch buffer.
> +    (setq first (loop for buffer in (buffer-list)
> +		     if (with-current-buffer buffer
> +			  (memq major-mode '(notmuch-show-mode
> +					     notmuch-search-mode
> +					     notmuch-hello-mode)))
> +		     return buffer))
> +
> +    (if first
> +	;; If the first one we found is any other than the starting
> +	;; buffer, switch to it.
> +	(unless (eq first start)
> +	  (switch-to-buffer first))
>        (notmuch))))
>  
>  (setq mail-user-agent 'notmuch-user-agent)
> -- 
> 1.7.7.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  parent reply	other threads:[~2011-12-27 19:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 10:50 [PATCH] emacs: Cycle through notmuch buffers rather than jumping to the last David Edmondson
2011-12-27 11:02 ` David Edmondson
2011-12-27 19:23 ` Jani Nikula [this message]
2011-12-28  8:20   ` David Edmondson
2011-12-28  8:29 ` [PATCH v2] " David Edmondson
2012-01-10 16:55   ` David Edmondson
2012-01-10 20:15     ` Jani Nikula
2012-01-14  9:32       ` Pieter Praet
2012-01-14  9:29   ` Pieter Praet
2012-01-15 11:55     ` David Edmondson
2012-01-16  3:01       ` Austin Clements
2012-01-16  8:43         ` David Edmondson
2012-01-16 10:42           ` [PATCH] [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch' Pieter Praet
2012-01-16 11:06             ` David Edmondson
2012-01-16 11:28               ` Pieter Praet
2012-01-16 11:32                 ` Pieter Praet
2012-01-16 11:47                 ` David Edmondson
2012-01-16 16:45                   ` Pieter Praet
2012-01-16 16:46                     ` [PATCH] v2 " Pieter Praet
2012-01-16 17:03                       ` David Edmondson
2012-01-18 10:03                         ` Pieter Praet
2012-01-18 10:04                           ` [RFC] [PATCH v3] emacs: rewrite `notmuch-cycle-notmuch-buffers' Pieter Praet
2012-01-18 10:13                           ` [PATCH] v2 [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch' David Edmondson
2012-01-18 12:15                             ` Pieter Praet
2012-01-18 12:57                               ` David Edmondson
     [not found]                                 ` <cunboq1mad1.fsf@hotblack-desiato.hh.sledj.net>
2012-01-18 13:48                                   ` Pieter Praet
2012-01-18 22:18                                     ` Aaron Ecay
2012-01-19  0:48                                       ` Austin Clements
2012-01-19  8:19                                       ` David Edmondson
2012-01-19 19:13                                       ` Pieter Praet
2012-01-16 21:10                       ` Jani Nikula
2012-01-18 10:07                         ` Pieter Praet
2012-01-16  2:45   ` [PATCH v2] emacs: Cycle through notmuch buffers rather than jumping to the last David Bremner

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=87vcp1es42.fsf@nikula.org \
    --to=jani@nikula.org \
    --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).