Re: [PATCH] v2 [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch'

Subject: Re: [PATCH] v2 [RFC] emacs: merge overhauled `notmuch-cycle-notmuch-buffers' into `notmuch'

Date: Mon, 16 Jan 2012 17:03:44 +0000

To: Pieter Praet, notmuch

Cc:

From: David Edmondson


On Mon, 16 Jan 2012 17:46:55 +0100, Pieter Praet <pieter@praet.org> wrote:
> Make `notmuch-cycle-notmuch-buffers' more Lispy and merge into `notmuch',
> eliminating the need to hog yet another keybind.
...
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index ef4dcc7..539b3a0 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -1067,7 +1067,20 @@ current search results AND that are tagged with the given tag."
>  (defun notmuch ()
>    "Run notmuch and display saved searches, known tags, etc."
>    (interactive)
> -  (notmuch-hello))
> +  (let* ((old-buffer (current-buffer))
> +	 (interesting-buffers
> +	  (delq nil (mapcar (lambda (b)
> +			      (if (notmuch-interesting-buffer b) b))
> +			    (buffer-list))))
> +	 (next-buffer (first
> +	  (delq nil (mapcar (lambda (b)
> +			      (unless (eq old-buffer b) b))
> +			    interesting-buffers)))))

This feels _less_ lispy. Any occurrences of '(delq nil ...)' strike me
as odd. What's wrong with '(loop ... collect ...)'?

> +    (if next-buffer
> +    	(progn
> +    	  (switch-to-buffer next-buffer)
> +    	  (bury-buffer old-buffer))
> +      (notmuch-hello))))

Integrating with `notmuch' is fine with me.
part-000.sig (application/pgp-signature)

Thread: