[PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-15 Thread Mark Walters
On Tue, 15 Jul 2014, Austin Clements  wrote:
> Quoth Mark Walters on Jul 14 at 10:22 pm:
>> 
>> On Mon, 14 Jul 2014, Austin Clements  wrote:
>> > This introduces notmuch-jump, which is like a user-friendly,
>> > user-configurable global prefix map for saved searches.  This provides
>> > a non-modal and much faster way to access saved searches than
>> > notmuch-hello.
>> >
>> > A user configures shortcut keys in notmuch-saved-searches, which are
>> > immediately accessible from anywhere in Notmuch under the "j" key (for
>> > "jump").  When the user hits "j", the minibuffer immediately shows a
>> > helpful table of bindings reminiscent of a completions buffer.
>> 
>> I am basically happy with this: the only downside compared to dme's
>> patch is that this is quite substantially bigger. However, since this is
>> all in it's own file that is not really a problem.
>> 
>> I have a few comments below. In all cases I am happy to go with the
>> current code if you think it's better than my suggestion.
>> 
>> > This code is a combination of work from myself (originally,
>> > "notmuch-go"), David Edmondson, and modifications from Mark Walters.
>> > ---
>> >  emacs/Makefile.local   |   3 +-
>> >  emacs/notmuch-hello.el |   2 +
>> >  emacs/notmuch-jump.el  | 189 
>> > +
>> >  emacs/notmuch-lib.el   |   3 +
>> >  4 files changed, 196 insertions(+), 1 deletion(-)
>> >  create mode 100644 emacs/notmuch-jump.el
>> >
>> > diff --git a/emacs/Makefile.local b/emacs/Makefile.local
>> > index c0d6b19..1109cfa 100644
>> > --- a/emacs/Makefile.local
>> > +++ b/emacs/Makefile.local
>> > @@ -18,7 +18,8 @@ emacs_sources := \
>> >$(dir)/notmuch-tag.el \
>> >$(dir)/coolj.el \
>> >$(dir)/notmuch-print.el \
>> > -  $(dir)/notmuch-version.el
>> > +  $(dir)/notmuch-version.el \
>> > +  $(dir)/notmuch-jump.el \
>> >  
>> >  $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
>> >  $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
>> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
>> > index 3de5238..061b27d 100644
>> > --- a/emacs/notmuch-hello.el
>> > +++ b/emacs/notmuch-hello.el
>> > @@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
>> >(group :format "%v" :inline t (const :format "  Query: " 
>> > :query) (string :format "%v")))
>> >  (checklist :inline t
>> > :format "%v"
>> > +   (group :format "%v" :inline t (const :format "Shortcut 
>> > key: " :key) (key-sequence :format "%v"))
>> > (group :format "%v" :inline t (const :format "Count-Query: 
>> > " :count-query) (string :format "%v"))
>> > (group :format "%v" :inline t (const :format "" 
>> > :sort-order)
>> >(choice :tag " Sort Order"
>> > @@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name "inbox" 
>> > :query "tag:inbox")
>> >  
>> >:nameName of the search (required).
>> >:query   Search to run (required).
>> > +  :key Optional shortcut key for `notmuch-jump-search'.
>> >:count-query Optional extra query to generate the count
>> > shown. If not present then the :query property
>> > is used.
>> > diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
>> > new file mode 100644
>> > index 000..cb1ae10
>> > --- /dev/null
>> > +++ b/emacs/notmuch-jump.el
>> > @@ -0,0 +1,189 @@
>> > +;; notmuch-jump.el --- User-friendly shortcut keys
>> > +;;
>> > +;; Copyright ? Austin Clements
>> > +;;
>> > +;; This file is part of Notmuch.
>> > +;;
>> > +;; Notmuch is free software: you can redistribute it and/or modify it
>> > +;; under the terms of the GNU General Public License as published by
>> > +;; the Free Software Foundation, either version 3 of the License, or
>> > +;; (at your option) any later version.
>> > +;;
>> > +;; Notmuch is distributed in the hope that it will be useful, but
>> > +;; WITHOUT ANY WARRANTY; without even the implied warranty of
>> > +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> > +;; General Public License for more details.
>> > +;;
>> > +;; You should have received a copy of the GNU General Public License
>> > +;; along with Notmuch.  If not, see .
>> > +;;
>> > +;; Authors: Austin Clements 
>> > +;;  David Edmondson 
>> > +
>> > +(eval-when-compile (require 'cl))
>> > +
>> > +(require 'notmuch-hello)
>> > +
>> > +;;;###autoload
>> > +(defun notmuch-jump-search ()
>> > +  "Jump to a saved search by shortcut key.
>> > +
>> > +This prompts for and performs a saved search using the shortcut
>> > +keys configured in the :key property of `notmuch-saved-searches'.
>> > +Typically these shortcuts are a single key long, so this is a
>> > +fast way to jump to a saved search from anywhere in Notmuch."
>> > +  (interactive)
>> > +
>> > +  ;; Build the action map
>> > +  (let (action-map)

[PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-15 Thread Austin Clements
Quoth Mark Walters on Jul 14 at 10:22 pm:
> 
> On Mon, 14 Jul 2014, Austin Clements  wrote:
> > This introduces notmuch-jump, which is like a user-friendly,
> > user-configurable global prefix map for saved searches.  This provides
> > a non-modal and much faster way to access saved searches than
> > notmuch-hello.
> >
> > A user configures shortcut keys in notmuch-saved-searches, which are
> > immediately accessible from anywhere in Notmuch under the "j" key (for
> > "jump").  When the user hits "j", the minibuffer immediately shows a
> > helpful table of bindings reminiscent of a completions buffer.
> 
> I am basically happy with this: the only downside compared to dme's
> patch is that this is quite substantially bigger. However, since this is
> all in it's own file that is not really a problem.
> 
> I have a few comments below. In all cases I am happy to go with the
> current code if you think it's better than my suggestion.
> 
> > This code is a combination of work from myself (originally,
> > "notmuch-go"), David Edmondson, and modifications from Mark Walters.
> > ---
> >  emacs/Makefile.local   |   3 +-
> >  emacs/notmuch-hello.el |   2 +
> >  emacs/notmuch-jump.el  | 189 
> > +
> >  emacs/notmuch-lib.el   |   3 +
> >  4 files changed, 196 insertions(+), 1 deletion(-)
> >  create mode 100644 emacs/notmuch-jump.el
> >
> > diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> > index c0d6b19..1109cfa 100644
> > --- a/emacs/Makefile.local
> > +++ b/emacs/Makefile.local
> > @@ -18,7 +18,8 @@ emacs_sources := \
> > $(dir)/notmuch-tag.el \
> > $(dir)/coolj.el \
> > $(dir)/notmuch-print.el \
> > -   $(dir)/notmuch-version.el
> > +   $(dir)/notmuch-version.el \
> > +   $(dir)/notmuch-jump.el \
> >  
> >  $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
> >  $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> > index 3de5238..061b27d 100644
> > --- a/emacs/notmuch-hello.el
> > +++ b/emacs/notmuch-hello.el
> > @@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
> > (group :format "%v" :inline t (const :format "  Query: " 
> > :query) (string :format "%v")))
> >   (checklist :inline t
> >  :format "%v"
> > +(group :format "%v" :inline t (const :format "Shortcut 
> > key: " :key) (key-sequence :format "%v"))
> >  (group :format "%v" :inline t (const :format "Count-Query: 
> > " :count-query) (string :format "%v"))
> >  (group :format "%v" :inline t (const :format "" 
> > :sort-order)
> > (choice :tag " Sort Order"
> > @@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name "inbox" 
> > :query "tag:inbox")
> >  
> >:nameName of the search (required).
> >:query   Search to run (required).
> > +  :key Optional shortcut key for `notmuch-jump-search'.
> >:count-query Optional extra query to generate the count
> > shown. If not present then the :query property
> > is used.
> > diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
> > new file mode 100644
> > index 000..cb1ae10
> > --- /dev/null
> > +++ b/emacs/notmuch-jump.el
> > @@ -0,0 +1,189 @@
> > +;; notmuch-jump.el --- User-friendly shortcut keys
> > +;;
> > +;; Copyright ? Austin Clements
> > +;;
> > +;; This file is part of Notmuch.
> > +;;
> > +;; Notmuch is free software: you can redistribute it and/or modify it
> > +;; under the terms of the GNU General Public License as published by
> > +;; the Free Software Foundation, either version 3 of the License, or
> > +;; (at your option) any later version.
> > +;;
> > +;; Notmuch is distributed in the hope that it will be useful, but
> > +;; WITHOUT ANY WARRANTY; without even the implied warranty of
> > +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > +;; General Public License for more details.
> > +;;
> > +;; You should have received a copy of the GNU General Public License
> > +;; along with Notmuch.  If not, see .
> > +;;
> > +;; Authors: Austin Clements 
> > +;;  David Edmondson 
> > +
> > +(eval-when-compile (require 'cl))
> > +
> > +(require 'notmuch-hello)
> > +
> > +;;;###autoload
> > +(defun notmuch-jump-search ()
> > +  "Jump to a saved search by shortcut key.
> > +
> > +This prompts for and performs a saved search using the shortcut
> > +keys configured in the :key property of `notmuch-saved-searches'.
> > +Typically these shortcuts are a single key long, so this is a
> > +fast way to jump to a saved search from anywhere in Notmuch."
> > +  (interactive)
> > +
> > +  ;; Build the action map
> > +  (let (action-map)
> > +(dolist (saved-search notmuch-saved-searches)
> > +  (let* ((saved-search (notmuch-hello-saved-search-to-plist 
> > saved-search))
> > 

Re: [PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-15 Thread Mark Walters
On Tue, 15 Jul 2014, Austin Clements amdra...@mit.edu wrote:
 Quoth Mark Walters on Jul 14 at 10:22 pm:
 
 On Mon, 14 Jul 2014, Austin Clements amdra...@mit.edu wrote:
  This introduces notmuch-jump, which is like a user-friendly,
  user-configurable global prefix map for saved searches.  This provides
  a non-modal and much faster way to access saved searches than
  notmuch-hello.
 
  A user configures shortcut keys in notmuch-saved-searches, which are
  immediately accessible from anywhere in Notmuch under the j key (for
  jump).  When the user hits j, the minibuffer immediately shows a
  helpful table of bindings reminiscent of a completions buffer.
 
 I am basically happy with this: the only downside compared to dme's
 patch is that this is quite substantially bigger. However, since this is
 all in it's own file that is not really a problem.
 
 I have a few comments below. In all cases I am happy to go with the
 current code if you think it's better than my suggestion.
 
  This code is a combination of work from myself (originally,
  notmuch-go), David Edmondson, and modifications from Mark Walters.
  ---
   emacs/Makefile.local   |   3 +-
   emacs/notmuch-hello.el |   2 +
   emacs/notmuch-jump.el  | 189 
  +
   emacs/notmuch-lib.el   |   3 +
   4 files changed, 196 insertions(+), 1 deletion(-)
   create mode 100644 emacs/notmuch-jump.el
 
  diff --git a/emacs/Makefile.local b/emacs/Makefile.local
  index c0d6b19..1109cfa 100644
  --- a/emacs/Makefile.local
  +++ b/emacs/Makefile.local
  @@ -18,7 +18,8 @@ emacs_sources := \
 $(dir)/notmuch-tag.el \
 $(dir)/coolj.el \
 $(dir)/notmuch-print.el \
  -  $(dir)/notmuch-version.el
  +  $(dir)/notmuch-version.el \
  +  $(dir)/notmuch-jump.el \
   
   $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
   $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
  diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
  index 3de5238..061b27d 100644
  --- a/emacs/notmuch-hello.el
  +++ b/emacs/notmuch-hello.el
  @@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
 (group :format %v :inline t (const :format   Query:  
  :query) (string :format %v)))
   (checklist :inline t
  :format %v
  +   (group :format %v :inline t (const :format Shortcut 
  key:  :key) (key-sequence :format %v))
  (group :format %v :inline t (const :format Count-Query: 
   :count-query) (string :format %v))
  (group :format %v :inline t (const :format  
  :sort-order)
 (choice :tag  Sort Order
  @@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name inbox 
  :query tag:inbox)
   
 :nameName of the search (required).
 :query   Search to run (required).
  +  :key Optional shortcut key for `notmuch-jump-search'.
 :count-query Optional extra query to generate the count
  shown. If not present then the :query property
  is used.
  diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
  new file mode 100644
  index 000..cb1ae10
  --- /dev/null
  +++ b/emacs/notmuch-jump.el
  @@ -0,0 +1,189 @@
  +;; notmuch-jump.el --- User-friendly shortcut keys
  +;;
  +;; Copyright © Austin Clements
  +;;
  +;; This file is part of Notmuch.
  +;;
  +;; Notmuch is free software: you can redistribute it and/or modify it
  +;; under the terms of the GNU General Public License as published by
  +;; the Free Software Foundation, either version 3 of the License, or
  +;; (at your option) any later version.
  +;;
  +;; Notmuch is distributed in the hope that it will be useful, but
  +;; WITHOUT ANY WARRANTY; without even the implied warranty of
  +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  +;; General Public License for more details.
  +;;
  +;; You should have received a copy of the GNU General Public License
  +;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
  +;;
  +;; Authors: Austin Clements acleme...@csail.mit.edu
  +;;  David Edmondson d...@dme.org
  +
  +(eval-when-compile (require 'cl))
  +
  +(require 'notmuch-hello)
  +
  +;;;###autoload
  +(defun notmuch-jump-search ()
  +  Jump to a saved search by shortcut key.
  +
  +This prompts for and performs a saved search using the shortcut
  +keys configured in the :key property of `notmuch-saved-searches'.
  +Typically these shortcuts are a single key long, so this is a
  +fast way to jump to a saved search from anywhere in Notmuch.
  +  (interactive)
  +
  +  ;; Build the action map
  +  (let (action-map)
  +(dolist (saved-search notmuch-saved-searches)
  +  (let* ((saved-search (notmuch-hello-saved-search-to-plist 
  saved-search))
  +   (key (plist-get saved-search :key)))
  +  (when key
  +(let ((name (plist-get saved-search :name))
  +  (query (plist-get saved-search :query))
  

[PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-14 Thread Mark Walters

On Mon, 14 Jul 2014, Austin Clements  wrote:
> This introduces notmuch-jump, which is like a user-friendly,
> user-configurable global prefix map for saved searches.  This provides
> a non-modal and much faster way to access saved searches than
> notmuch-hello.
>
> A user configures shortcut keys in notmuch-saved-searches, which are
> immediately accessible from anywhere in Notmuch under the "j" key (for
> "jump").  When the user hits "j", the minibuffer immediately shows a
> helpful table of bindings reminiscent of a completions buffer.

I am basically happy with this: the only downside compared to dme's
patch is that this is quite substantially bigger. However, since this is
all in it's own file that is not really a problem.

I have a few comments below. In all cases I am happy to go with the
current code if you think it's better than my suggestion.

> This code is a combination of work from myself (originally,
> "notmuch-go"), David Edmondson, and modifications from Mark Walters.
> ---
>  emacs/Makefile.local   |   3 +-
>  emacs/notmuch-hello.el |   2 +
>  emacs/notmuch-jump.el  | 189 
> +
>  emacs/notmuch-lib.el   |   3 +
>  4 files changed, 196 insertions(+), 1 deletion(-)
>  create mode 100644 emacs/notmuch-jump.el
>
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index c0d6b19..1109cfa 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -18,7 +18,8 @@ emacs_sources := \
>   $(dir)/notmuch-tag.el \
>   $(dir)/coolj.el \
>   $(dir)/notmuch-print.el \
> - $(dir)/notmuch-version.el
> + $(dir)/notmuch-version.el \
> + $(dir)/notmuch-jump.el \
>  
>  $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
>  $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 3de5238..061b27d 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
>   (group :format "%v" :inline t (const :format "  Query: " 
> :query) (string :format "%v")))
> (checklist :inline t
>:format "%v"
> +  (group :format "%v" :inline t (const :format "Shortcut 
> key: " :key) (key-sequence :format "%v"))
>(group :format "%v" :inline t (const :format "Count-Query: 
> " :count-query) (string :format "%v"))
>(group :format "%v" :inline t (const :format "" 
> :sort-order)
>   (choice :tag " Sort Order"
> @@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name "inbox" :query 
> "tag:inbox")
>  
>:nameName of the search (required).
>:query   Search to run (required).
> +  :key Optional shortcut key for `notmuch-jump-search'.
>:count-query Optional extra query to generate the count
> shown. If not present then the :query property
> is used.
> diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
> new file mode 100644
> index 000..cb1ae10
> --- /dev/null
> +++ b/emacs/notmuch-jump.el
> @@ -0,0 +1,189 @@
> +;; notmuch-jump.el --- User-friendly shortcut keys
> +;;
> +;; Copyright ? Austin Clements
> +;;
> +;; This file is part of Notmuch.
> +;;
> +;; Notmuch is free software: you can redistribute it and/or modify it
> +;; under the terms of the GNU General Public License as published by
> +;; the Free Software Foundation, either version 3 of the License, or
> +;; (at your option) any later version.
> +;;
> +;; Notmuch is distributed in the hope that it will be useful, but
> +;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +;; General Public License for more details.
> +;;
> +;; You should have received a copy of the GNU General Public License
> +;; along with Notmuch.  If not, see .
> +;;
> +;; Authors: Austin Clements 
> +;;  David Edmondson 
> +
> +(eval-when-compile (require 'cl))
> +
> +(require 'notmuch-hello)
> +
> +;;;###autoload
> +(defun notmuch-jump-search ()
> +  "Jump to a saved search by shortcut key.
> +
> +This prompts for and performs a saved search using the shortcut
> +keys configured in the :key property of `notmuch-saved-searches'.
> +Typically these shortcuts are a single key long, so this is a
> +fast way to jump to a saved search from anywhere in Notmuch."
> +  (interactive)
> +
> +  ;; Build the action map
> +  (let (action-map)
> +(dolist (saved-search notmuch-saved-searches)
> +  (let* ((saved-search (notmuch-hello-saved-search-to-plist 
> saved-search))
> +  (key (plist-get saved-search :key)))
> + (when key
> +   (let ((name (plist-get saved-search :name))
> + (query (plist-get saved-search :query))
> + (oldest-first
> +  (case (plist-get 

[PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-14 Thread Austin Clements
This introduces notmuch-jump, which is like a user-friendly,
user-configurable global prefix map for saved searches.  This provides
a non-modal and much faster way to access saved searches than
notmuch-hello.

A user configures shortcut keys in notmuch-saved-searches, which are
immediately accessible from anywhere in Notmuch under the "j" key (for
"jump").  When the user hits "j", the minibuffer immediately shows a
helpful table of bindings reminiscent of a completions buffer.

This code is a combination of work from myself (originally,
"notmuch-go"), David Edmondson, and modifications from Mark Walters.
---
 emacs/Makefile.local   |   3 +-
 emacs/notmuch-hello.el |   2 +
 emacs/notmuch-jump.el  | 189 +
 emacs/notmuch-lib.el   |   3 +
 4 files changed, 196 insertions(+), 1 deletion(-)
 create mode 100644 emacs/notmuch-jump.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index c0d6b19..1109cfa 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -18,7 +18,8 @@ emacs_sources := \
$(dir)/notmuch-tag.el \
$(dir)/coolj.el \
$(dir)/notmuch-print.el \
-   $(dir)/notmuch-version.el
+   $(dir)/notmuch-version.el \
+   $(dir)/notmuch-jump.el \

 $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
 $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3de5238..061b27d 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
(group :format "%v" :inline t (const :format "  Query: " 
:query) (string :format "%v")))
  (checklist :inline t
 :format "%v"
+(group :format "%v" :inline t (const :format "Shortcut 
key: " :key) (key-sequence :format "%v"))
 (group :format "%v" :inline t (const :format "Count-Query: 
" :count-query) (string :format "%v"))
 (group :format "%v" :inline t (const :format "" 
:sort-order)
(choice :tag " Sort Order"
@@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name "inbox" :query 
"tag:inbox")

   :nameName of the search (required).
   :query   Search to run (required).
+  :key Optional shortcut key for `notmuch-jump-search'.
   :count-query Optional extra query to generate the count
shown. If not present then the :query property
is used.
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
new file mode 100644
index 000..cb1ae10
--- /dev/null
+++ b/emacs/notmuch-jump.el
@@ -0,0 +1,189 @@
+;; notmuch-jump.el --- User-friendly shortcut keys
+;;
+;; Copyright ? Austin Clements
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see .
+;;
+;; Authors: Austin Clements 
+;;  David Edmondson 
+
+(eval-when-compile (require 'cl))
+
+(require 'notmuch-hello)
+
+;;;###autoload
+(defun notmuch-jump-search ()
+  "Jump to a saved search by shortcut key.
+
+This prompts for and performs a saved search using the shortcut
+keys configured in the :key property of `notmuch-saved-searches'.
+Typically these shortcuts are a single key long, so this is a
+fast way to jump to a saved search from anywhere in Notmuch."
+  (interactive)
+
+  ;; Build the action map
+  (let (action-map)
+(dolist (saved-search notmuch-saved-searches)
+  (let* ((saved-search (notmuch-hello-saved-search-to-plist saved-search))
+(key (plist-get saved-search :key)))
+   (when key
+ (let ((name (plist-get saved-search :name))
+   (query (plist-get saved-search :query))
+   (oldest-first
+(case (plist-get saved-search :sort-order)
+  (newest-first nil)
+  (oldest-first t)
+  (otherwise (default-value notmuch-search-oldest-first)
+   (push (list key name
+   `(lambda () (notmuch-search ',query ',oldest-first)))
+ action-map)
+(setq action-map (nreverse action-map))
+
+(if action-map
+   (notmuch-jump action-map "Search ")
+  (error "No shortcut keys for saved searches.  Please customize 
notmuch-saved-searches."
+
+(defvar 

[PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-14 Thread Austin Clements
This introduces notmuch-jump, which is like a user-friendly,
user-configurable global prefix map for saved searches.  This provides
a non-modal and much faster way to access saved searches than
notmuch-hello.

A user configures shortcut keys in notmuch-saved-searches, which are
immediately accessible from anywhere in Notmuch under the j key (for
jump).  When the user hits j, the minibuffer immediately shows a
helpful table of bindings reminiscent of a completions buffer.

This code is a combination of work from myself (originally,
notmuch-go), David Edmondson, and modifications from Mark Walters.
---
 emacs/Makefile.local   |   3 +-
 emacs/notmuch-hello.el |   2 +
 emacs/notmuch-jump.el  | 189 +
 emacs/notmuch-lib.el   |   3 +
 4 files changed, 196 insertions(+), 1 deletion(-)
 create mode 100644 emacs/notmuch-jump.el

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index c0d6b19..1109cfa 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -18,7 +18,8 @@ emacs_sources := \
$(dir)/notmuch-tag.el \
$(dir)/coolj.el \
$(dir)/notmuch-print.el \
-   $(dir)/notmuch-version.el
+   $(dir)/notmuch-version.el \
+   $(dir)/notmuch-jump.el \
 
 $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
 $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3de5238..061b27d 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
(group :format %v :inline t (const :format   Query:  
:query) (string :format %v)))
  (checklist :inline t
 :format %v
+(group :format %v :inline t (const :format Shortcut 
key:  :key) (key-sequence :format %v))
 (group :format %v :inline t (const :format Count-Query: 
 :count-query) (string :format %v))
 (group :format %v :inline t (const :format  
:sort-order)
(choice :tag  Sort Order
@@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name inbox :query 
tag:inbox)
 
   :nameName of the search (required).
   :query   Search to run (required).
+  :key Optional shortcut key for `notmuch-jump-search'.
   :count-query Optional extra query to generate the count
shown. If not present then the :query property
is used.
diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
new file mode 100644
index 000..cb1ae10
--- /dev/null
+++ b/emacs/notmuch-jump.el
@@ -0,0 +1,189 @@
+;; notmuch-jump.el --- User-friendly shortcut keys
+;;
+;; Copyright © Austin Clements
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
+;;
+;; Authors: Austin Clements acleme...@csail.mit.edu
+;;  David Edmondson d...@dme.org
+
+(eval-when-compile (require 'cl))
+
+(require 'notmuch-hello)
+
+;;;###autoload
+(defun notmuch-jump-search ()
+  Jump to a saved search by shortcut key.
+
+This prompts for and performs a saved search using the shortcut
+keys configured in the :key property of `notmuch-saved-searches'.
+Typically these shortcuts are a single key long, so this is a
+fast way to jump to a saved search from anywhere in Notmuch.
+  (interactive)
+
+  ;; Build the action map
+  (let (action-map)
+(dolist (saved-search notmuch-saved-searches)
+  (let* ((saved-search (notmuch-hello-saved-search-to-plist saved-search))
+(key (plist-get saved-search :key)))
+   (when key
+ (let ((name (plist-get saved-search :name))
+   (query (plist-get saved-search :query))
+   (oldest-first
+(case (plist-get saved-search :sort-order)
+  (newest-first nil)
+  (oldest-first t)
+  (otherwise (default-value notmuch-search-oldest-first)
+   (push (list key name
+   `(lambda () (notmuch-search ',query ',oldest-first)))
+ action-map)
+(setq action-map (nreverse action-map))
+
+(if action-map
+   (notmuch-jump action-map Search )
+  (error No shortcut keys for saved searches.  Please customize 
notmuch-saved-searches.
+
+(defvar notmuch-jump--action nil)
+

Re: [PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-14 Thread Mark Walters

On Mon, 14 Jul 2014, Austin Clements amdra...@mit.edu wrote:
 This introduces notmuch-jump, which is like a user-friendly,
 user-configurable global prefix map for saved searches.  This provides
 a non-modal and much faster way to access saved searches than
 notmuch-hello.

 A user configures shortcut keys in notmuch-saved-searches, which are
 immediately accessible from anywhere in Notmuch under the j key (for
 jump).  When the user hits j, the minibuffer immediately shows a
 helpful table of bindings reminiscent of a completions buffer.

I am basically happy with this: the only downside compared to dme's
patch is that this is quite substantially bigger. However, since this is
all in it's own file that is not really a problem.

I have a few comments below. In all cases I am happy to go with the
current code if you think it's better than my suggestion.

 This code is a combination of work from myself (originally,
 notmuch-go), David Edmondson, and modifications from Mark Walters.
 ---
  emacs/Makefile.local   |   3 +-
  emacs/notmuch-hello.el |   2 +
  emacs/notmuch-jump.el  | 189 
 +
  emacs/notmuch-lib.el   |   3 +
  4 files changed, 196 insertions(+), 1 deletion(-)
  create mode 100644 emacs/notmuch-jump.el

 diff --git a/emacs/Makefile.local b/emacs/Makefile.local
 index c0d6b19..1109cfa 100644
 --- a/emacs/Makefile.local
 +++ b/emacs/Makefile.local
 @@ -18,7 +18,8 @@ emacs_sources := \
   $(dir)/notmuch-tag.el \
   $(dir)/coolj.el \
   $(dir)/notmuch-print.el \
 - $(dir)/notmuch-version.el
 + $(dir)/notmuch-version.el \
 + $(dir)/notmuch-jump.el \
  
  $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
  $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
 index 3de5238..061b27d 100644
 --- a/emacs/notmuch-hello.el
 +++ b/emacs/notmuch-hello.el
 @@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
   (group :format %v :inline t (const :format   Query:  
 :query) (string :format %v)))
 (checklist :inline t
:format %v
 +  (group :format %v :inline t (const :format Shortcut 
 key:  :key) (key-sequence :format %v))
(group :format %v :inline t (const :format Count-Query: 
  :count-query) (string :format %v))
(group :format %v :inline t (const :format  
 :sort-order)
   (choice :tag  Sort Order
 @@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name inbox :query 
 tag:inbox)
  
:nameName of the search (required).
:query   Search to run (required).
 +  :key Optional shortcut key for `notmuch-jump-search'.
:count-query Optional extra query to generate the count
 shown. If not present then the :query property
 is used.
 diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
 new file mode 100644
 index 000..cb1ae10
 --- /dev/null
 +++ b/emacs/notmuch-jump.el
 @@ -0,0 +1,189 @@
 +;; notmuch-jump.el --- User-friendly shortcut keys
 +;;
 +;; Copyright © Austin Clements
 +;;
 +;; This file is part of Notmuch.
 +;;
 +;; Notmuch is free software: you can redistribute it and/or modify it
 +;; under the terms of the GNU General Public License as published by
 +;; the Free Software Foundation, either version 3 of the License, or
 +;; (at your option) any later version.
 +;;
 +;; Notmuch is distributed in the hope that it will be useful, but
 +;; WITHOUT ANY WARRANTY; without even the implied warranty of
 +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +;; General Public License for more details.
 +;;
 +;; You should have received a copy of the GNU General Public License
 +;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
 +;;
 +;; Authors: Austin Clements acleme...@csail.mit.edu
 +;;  David Edmondson d...@dme.org
 +
 +(eval-when-compile (require 'cl))
 +
 +(require 'notmuch-hello)
 +
 +;;;###autoload
 +(defun notmuch-jump-search ()
 +  Jump to a saved search by shortcut key.
 +
 +This prompts for and performs a saved search using the shortcut
 +keys configured in the :key property of `notmuch-saved-searches'.
 +Typically these shortcuts are a single key long, so this is a
 +fast way to jump to a saved search from anywhere in Notmuch.
 +  (interactive)
 +
 +  ;; Build the action map
 +  (let (action-map)
 +(dolist (saved-search notmuch-saved-searches)
 +  (let* ((saved-search (notmuch-hello-saved-search-to-plist 
 saved-search))
 +  (key (plist-get saved-search :key)))
 + (when key
 +   (let ((name (plist-get saved-search :name))
 + (query (plist-get saved-search :query))
 + (oldest-first
 +  (case (plist-get saved-search :sort-order)

I would probably not do the saved-search-to-plist bit and just use

Re: [PATCH 1/2] emacs: Introduce notmuch-jump: shortcut keys to saved searches

2014-07-14 Thread Austin Clements
Quoth Mark Walters on Jul 14 at 10:22 pm:
 
 On Mon, 14 Jul 2014, Austin Clements amdra...@mit.edu wrote:
  This introduces notmuch-jump, which is like a user-friendly,
  user-configurable global prefix map for saved searches.  This provides
  a non-modal and much faster way to access saved searches than
  notmuch-hello.
 
  A user configures shortcut keys in notmuch-saved-searches, which are
  immediately accessible from anywhere in Notmuch under the j key (for
  jump).  When the user hits j, the minibuffer immediately shows a
  helpful table of bindings reminiscent of a completions buffer.
 
 I am basically happy with this: the only downside compared to dme's
 patch is that this is quite substantially bigger. However, since this is
 all in it's own file that is not really a problem.
 
 I have a few comments below. In all cases I am happy to go with the
 current code if you think it's better than my suggestion.
 
  This code is a combination of work from myself (originally,
  notmuch-go), David Edmondson, and modifications from Mark Walters.
  ---
   emacs/Makefile.local   |   3 +-
   emacs/notmuch-hello.el |   2 +
   emacs/notmuch-jump.el  | 189 
  +
   emacs/notmuch-lib.el   |   3 +
   4 files changed, 196 insertions(+), 1 deletion(-)
   create mode 100644 emacs/notmuch-jump.el
 
  diff --git a/emacs/Makefile.local b/emacs/Makefile.local
  index c0d6b19..1109cfa 100644
  --- a/emacs/Makefile.local
  +++ b/emacs/Makefile.local
  @@ -18,7 +18,8 @@ emacs_sources := \
  $(dir)/notmuch-tag.el \
  $(dir)/coolj.el \
  $(dir)/notmuch-print.el \
  -   $(dir)/notmuch-version.el
  +   $(dir)/notmuch-version.el \
  +   $(dir)/notmuch-jump.el \
   
   $(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
   $(dir)/notmuch-version.el: $(srcdir)/$(dir)/notmuch-version.el.tmpl
  diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
  index 3de5238..061b27d 100644
  --- a/emacs/notmuch-hello.el
  +++ b/emacs/notmuch-hello.el
  @@ -85,6 +85,7 @@ (define-widget 'notmuch-saved-search-plist 'list
  (group :format %v :inline t (const :format   Query:  
  :query) (string :format %v)))
(checklist :inline t
   :format %v
  +(group :format %v :inline t (const :format Shortcut 
  key:  :key) (key-sequence :format %v))
   (group :format %v :inline t (const :format Count-Query: 
   :count-query) (string :format %v))
   (group :format %v :inline t (const :format  
  :sort-order)
  (choice :tag  Sort Order
  @@ -101,6 +102,7 @@ (defcustom notmuch-saved-searches '((:name inbox 
  :query tag:inbox)
   
 :nameName of the search (required).
 :query   Search to run (required).
  +  :key Optional shortcut key for `notmuch-jump-search'.
 :count-query Optional extra query to generate the count
  shown. If not present then the :query property
  is used.
  diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el
  new file mode 100644
  index 000..cb1ae10
  --- /dev/null
  +++ b/emacs/notmuch-jump.el
  @@ -0,0 +1,189 @@
  +;; notmuch-jump.el --- User-friendly shortcut keys
  +;;
  +;; Copyright © Austin Clements
  +;;
  +;; This file is part of Notmuch.
  +;;
  +;; Notmuch is free software: you can redistribute it and/or modify it
  +;; under the terms of the GNU General Public License as published by
  +;; the Free Software Foundation, either version 3 of the License, or
  +;; (at your option) any later version.
  +;;
  +;; Notmuch is distributed in the hope that it will be useful, but
  +;; WITHOUT ANY WARRANTY; without even the implied warranty of
  +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  +;; General Public License for more details.
  +;;
  +;; You should have received a copy of the GNU General Public License
  +;; along with Notmuch.  If not, see http://www.gnu.org/licenses/.
  +;;
  +;; Authors: Austin Clements acleme...@csail.mit.edu
  +;;  David Edmondson d...@dme.org
  +
  +(eval-when-compile (require 'cl))
  +
  +(require 'notmuch-hello)
  +
  +;;;###autoload
  +(defun notmuch-jump-search ()
  +  Jump to a saved search by shortcut key.
  +
  +This prompts for and performs a saved search using the shortcut
  +keys configured in the :key property of `notmuch-saved-searches'.
  +Typically these shortcuts are a single key long, so this is a
  +fast way to jump to a saved search from anywhere in Notmuch.
  +  (interactive)
  +
  +  ;; Build the action map
  +  (let (action-map)
  +(dolist (saved-search notmuch-saved-searches)
  +  (let* ((saved-search (notmuch-hello-saved-search-to-plist 
  saved-search))
  +(key (plist-get saved-search :key)))
  +   (when key
  + (let ((name (plist-get saved-search :name))
  +   (query (plist-get saved-search :query))
  +   (oldest-first
  +