On Thu, Mar 29 2012, Mark Anderson <MarkR.Anderson@amd.com> wrote: > On Tue, 27 Mar 2012 14:24:36 -0600, Mark Anderson <MarkR.Anderson@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.