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

Pieter Praet pieter at praet.org
Wed Jan 18 02:03:09 PST 2012


On Mon, 16 Jan 2012 17:03:44 +0000, David Edmondson <dme at dme.org> wrote:
> On Mon, 16 Jan 2012 17:46:55 +0100, Pieter Praet <pieter at 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. [...]

True.  I simply re-implemented `delete-if-not' in order to
prevent having to require the `cl' package at runtime.
(why on Earth isn't there an equivalent function in plain Elisp ?!?)

  $ sed -e "s/C\?Lisp\(y\|'ier\)/Elispy/" $COMMIT_MSG


> [...] Any occurrences of '(delq nil ...)' strike me
> as odd. [...]

How so?  Lacking a flexible way to conditionally remove elements from a
list (that doesn't require the `cl' package in some way or another),
a combination of `mapcar' and `delq' seemed like the easiest approach.

(AFAIK;  Please correct me if (when) I'm wrong!)


> [...] What's wrong with '(loop ... collect ...)'?
> 

Nothing at all.  I was fixing my own patch [1] without resorting to
requiring the `cl' package at runtime :)  Would be nice if we could
get rid of the compile-time dependency as well, though.

Fresh patch to that effect follows.

Feel free to disregard it, just bikesheddin'...


> > +    (if next-buffer
> > +    	(progn
> > +    	  (switch-to-buffer next-buffer)
> > +    	  (bury-buffer old-buffer))
> > +      (notmuch-hello))))
> 
> Integrating with `notmuch' is fine with me.


Peace

-- 
Pieter

[1] id:"1326710551-23122-1-git-send-email-pieter at praet.org"


More information about the notmuch mailing list