Goto command for existing search windows

Jameson Graef Rollins jrollins at finestructure.net
Thu Mar 29 13:27:36 PDT 2012


On Thu, Mar 29 2012, Mark Anderson <MarkR.Anderson at amd.com> wrote:
> On Tue, 27 Mar 2012 14:24:36 -0600, Mark Anderson <MarkR.Anderson at amd.com> wrote:
>> I was looking for a function which would find a buffer based on one of
>> my saved searches, and perform the search if it didn't exist.
>> 
>> I've gotten it a bit closer, if I perform the search that matches a
>> saved search, then this routine will find it because of the magic in
>> notmuch-search-buffer-title, but perhaps someone else feels up to
>> searching through the saved searches directly?

Hey, Mark.  I think you can be a little simpler.  The title for search
buffers is based on the search, so a buffer will always be reused for an
identical search.  You don't need to do any fancy buffer searching.  For
instance, the following works perfectly for me, and I believe produces
the same results as your technique:

(defun jnotmuch-inbox ()
  "Search: inbox"
  (interactive)
  (notmuch-search "tag:inbox" t))
(define-key notmuch-hello-mode-map "2" 'jnotmuch-inbox)
(define-key notmuch-search-mode-map "2" 'jnotmuch-inbox)
(define-key notmuch-show-mode-map "2" 'jnotmuch-inbox)

jamie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120329/1712a7c6/attachment.pgp>


More information about the notmuch mailing list