unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC] [PATCH] emacs: Add support for saved search accelerators.
@ 2014-05-06 14:16 David Edmondson
  2014-05-06 16:41 ` Mark Walters
  2014-05-07 11:21 ` [PATCH v2] emacs: Add support for saved search accelerator keys David Edmondson
  0 siblings, 2 replies; 13+ messages in thread
From: David Edmondson @ 2014-05-06 14:16 UTC (permalink / raw)
  To: notmuch

Extended the saved search definition to allow the inclusion of an
accelerator key for the search. Bind 'j' in the common mode map as a
leader for such accelerator keys.
---

This arose out a conversation in #notmuch and Mark's patch to extend
the saved search custom specification based on requirements for an
external package (Austin's notmuch-go.el).

Re-organising the layout of the saved searches is missing (as it's
lots of fiddling about with absolute numbers and I didn't want to
waste time on it if this is going nowhere), so the saved searches may
not all line up correctly in notmuch-hello.

 emacs/notmuch-hello.el |  8 ++++++--
 emacs/notmuch-lib.el   | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3de5238..56379ef 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -85,6 +85,7 @@ searches so they still work in customize."
 		(group :format "%v" :inline t (const :format "  Query: " :query) (string :format "%v")))
 	  (checklist :inline t
 		     :format "%v"
+		     (group :format "%v" :inline t (const :format "    Key: " :key) (string :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"
@@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'."
 	    (when elem
 	      (if (> column-indent 0)
 		  (widget-insert (make-string column-indent ? )))
-	      (let* ((name (plist-get elem :name))
+	      (let* ((key (plist-get elem :key))
+		     (name (plist-get elem :name))
 		     (query (plist-get elem :query))
 		     (oldest-first (case (plist-get elem :sort-order)
 				     (newest-first nil)
@@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'."
 			       :notify #'notmuch-hello-widget-search
 			       :notmuch-search-terms query
 			       :notmuch-search-oldest-first oldest-first
-			       name)
+			       (if key
+				   (concat name " (" key ")")
+				 name))
 		(setq column-indent
 		      (1+ (max 0 (- column-width (length name)))))))
 	    (setq count (1+ count))
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 2941da3..9aa7ba7 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -130,6 +130,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
     (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "=" 'notmuch-refresh-this-buffer)
     (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
+    (define-key map "j" 'notmuch-jump)
     map)
   "Keymap shared by all notmuch modes.")
 
@@ -845,6 +846,32 @@ status."
 (defvar notmuch-show-process-crypto nil)
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 
+;; Jump key support:
+
+(defvar notmuch-jump-search nil)
+(defun notmuch-jump-map ()
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map nil)
+    (suppress-keymap map)
+    (dolist (saved-search notmuch-saved-searches)
+      (let ((key (plist-get saved-search :key)))
+	(when key
+	  (define-key map key `(lambda ()
+				 (interactive)
+				 (setq notmuch-jump-search ',saved-search)
+				 (exit-minibuffer)
+				 )))))
+    map))
+
+(defun notmuch-jump ()
+  "Read a saved search accelerator key and perform the associated
+search."
+  (interactive)
+  (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))
+  (when notmuch-jump-search
+    (notmuch-search (plist-get notmuch-jump-search :query)
+		    (plist-get notmuch-jump-search :oldest-first))))
+
 (provide 'notmuch-lib)
 
 ;; Local Variables:
-- 
2.0.0.rc0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC] [PATCH] emacs: Add support for saved search accelerators.
  2014-05-06 14:16 [RFC] [PATCH] emacs: Add support for saved search accelerators David Edmondson
@ 2014-05-06 16:41 ` Mark Walters
  2014-05-07 11:21 ` [PATCH v2] emacs: Add support for saved search accelerator keys David Edmondson
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Walters @ 2014-05-06 16:41 UTC (permalink / raw)
  To: David Edmondson, notmuch


Hi

Yes this looks nice modulo polishing. I think the nifty window-splitting
Austin's notmuch-go does is moderately orthogonal to the keyboard
shortcuts (since shortcuts can be used without it, and it could be used
for other things too)

On Tue, 06 May 2014, David Edmondson <dme@dme.org> wrote:
> Extended the saved search definition to allow the inclusion of an
> accelerator key for the search. Bind 'j' in the common mode map as a
> leader for such accelerator keys.
> ---
>
> This arose out a conversation in #notmuch and Mark's patch to extend
> the saved search custom specification based on requirements for an
> external package (Austin's notmuch-go.el).
>
> Re-organising the layout of the saved searches is missing (as it's
> lots of fiddling about with absolute numbers and I didn't want to
> waste time on it if this is going nowhere), so the saved searches may
> not all line up correctly in notmuch-hello.
>
>  emacs/notmuch-hello.el |  8 ++++++--
>  emacs/notmuch-lib.el   | 27 +++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 3de5238..56379ef 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -85,6 +85,7 @@ searches so they still work in customize."
>  		(group :format "%v" :inline t (const :format "  Query: " :query) (string :format "%v")))
>  	  (checklist :inline t
>  		     :format "%v"
> +		     (group :format "%v" :inline t (const :format "    Key: " :key) (string :format "%v"))

if you use key-sequence rather than string then this is a bit nicer. It
allows a multiple key press binding: eg  "n i" or "C-n".

>  		     (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"
> @@ -551,7 +552,8 @@ with `notmuch-hello-query-counts'."
>  	    (when elem
>  	      (if (> column-indent 0)
>  		  (widget-insert (make-string column-indent ? )))
> -	      (let* ((name (plist-get elem :name))
> +	      (let* ((key (plist-get elem :key))
> +		     (name (plist-get elem :name))
>  		     (query (plist-get elem :query))
>  		     (oldest-first (case (plist-get elem :sort-order)
>  				     (newest-first nil)
> @@ -564,7 +566,9 @@ with `notmuch-hello-query-counts'."
>  			       :notify #'notmuch-hello-widget-search
>  			       :notmuch-search-terms query
>  			       :notmuch-search-oldest-first oldest-first
> -			       name)
> +			       (if key
> +				   (concat name " (" key ")")
> +				 name))

I think it might be worth having an option to suppress the display of
the binding: I think inbox (i) would annoy me, but it is good for discoverability.
I, personally, would be completely happy without the displayed binding.

Actually just a thought: could ? in jump-mode-map be bound to something
that displayed the bindings?

>  		(setq column-indent
>  		      (1+ (max 0 (- column-width (length name)))))))
>  	    (setq count (1+ count))
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 2941da3..9aa7ba7 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -130,6 +130,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
>      (define-key map "m" 'notmuch-mua-new-mail)
>      (define-key map "=" 'notmuch-refresh-this-buffer)
>      (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
> +    (define-key map "j" 'notmuch-jump)
>      map)
>    "Keymap shared by all notmuch modes.")
>  
> @@ -845,6 +846,32 @@ status."
>  (defvar notmuch-show-process-crypto nil)
>  (make-variable-buffer-local 'notmuch-show-process-crypto)
>  
> +;; Jump key support:
> +
> +(defvar notmuch-jump-search nil)
> +(defun notmuch-jump-map ()
> +  (let ((map (make-sparse-keymap)))
> +    (set-keymap-parent map nil)

if you make the parent keymap the minibuffer-local-map then the various
exits from the minibuffer work (ctrl-g and return for example)

> +    (suppress-keymap map)
> +    (dolist (saved-search notmuch-saved-searches)
> +      (let ((key (plist-get saved-search :key)))
> +	(when key
> +	  (define-key map key `(lambda ()
> +				 (interactive)
> +				 (setq notmuch-jump-search ',saved-search)
> +				 (exit-minibuffer)
> +				 )))))
> +    map))
> +
> +(defun notmuch-jump ()
> +  "Read a saved search accelerator key and perform the associated
> +search."
> +  (interactive)
> +  (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))
> +  (when notmuch-jump-search
> +    (notmuch-search (plist-get notmuch-jump-search :query)
> +		    (plist-get notmuch-jump-search :oldest-first))))

These two plist-gets should be notmuch-saved-search-get. That is a
helper so that people with old style saved searches (a cons cell of name
and query) don't get errors.

(There were also a couple of "not yet declared" things.)

Best wishes

Mark

> +
>  (provide 'notmuch-lib)
>  
>  ;; Local Variables:
> -- 
> 2.0.0.rc0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] emacs: Add support for saved search accelerator keys
  2014-05-06 14:16 [RFC] [PATCH] emacs: Add support for saved search accelerators David Edmondson
  2014-05-06 16:41 ` Mark Walters
@ 2014-05-07 11:21 ` David Edmondson
  2014-05-07 11:21   ` [PATCH v2] emacs: Add support for saved search accelerators David Edmondson
  1 sibling, 1 reply; 13+ messages in thread
From: David Edmondson @ 2014-05-07 11:21 UTC (permalink / raw)
  To: notmuch

emacs: Add support for saved search accelerator keys

This arose out a conversation in #notmuch and Mark's patch to extend
the saved search custom specification based on requirements for an
external package (Austin's notmuch-go.el).

v2:
- Comments from Mark Walters:
  - Use `notmuch-saved-search-get'.
  - Use key-sequence rather than string in the custom definition.
  - Add a ? binding to display the accelerators.
  - Use the minibuffer-local-map as parent for the new keymap.
  - Fix external declarations.
  - Remove the display of the accelerators in notmuch-hello.


David Edmondson (1):
  emacs: Add support for saved search accelerators

 emacs/notmuch-hello.el |  5 ++++-
 emacs/notmuch-lib.el   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)

-- 
2.0.0.rc0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2] emacs: Add support for saved search accelerators
  2014-05-07 11:21 ` [PATCH v2] emacs: Add support for saved search accelerator keys David Edmondson
@ 2014-05-07 11:21   ` David Edmondson
  2014-05-08  9:14     ` Mark Walters
  2014-07-12 19:31     ` David Bremner
  0 siblings, 2 replies; 13+ messages in thread
From: David Edmondson @ 2014-05-07 11:21 UTC (permalink / raw)
  To: notmuch

Extended the saved search definition to allow the inclusion of an
accelerator key for the search. Bind 'j' in the common mode map as a
leader for such accelerator keys.
---
 emacs/notmuch-hello.el |  5 ++++-
 emacs/notmuch-lib.el   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3de5238..64d5aa1 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -85,6 +85,7 @@ searches so they still work in customize."
 		(group :format "%v" :inline t (const :format "  Query: " :query) (string :format "%v")))
 	  (checklist :inline t
 		     :format "%v"
+		     (group :format "%v" :inline t (const :format "    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 @@ a plist. Supported properties are
 
   :name            Name of the search (required).
   :query           Search to run (required).
+  :key             Optional accelerator key.
   :count-query     Optional extra query to generate the count
                    shown. If not present then the :query property
                    is used.
@@ -551,7 +553,8 @@ with `notmuch-hello-query-counts'."
 	    (when elem
 	      (if (> column-indent 0)
 		  (widget-insert (make-string column-indent ? )))
-	      (let* ((name (plist-get elem :name))
+	      (let* ((key (plist-get elem :key))
+		     (name (plist-get elem :name))
 		     (query (plist-get elem :query))
 		     (oldest-first (case (plist-get elem :sort-order)
 				     (newest-first nil)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 2941da3..f8c5f96 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -25,6 +25,10 @@
 (require 'mm-decode)
 (require 'cl)
 
+(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
+(declare-function notmuch-saved-search-get "notmuch-hello" (saved-search field))
+(defvar notmuch-saved-searches) ;; In `notmuch-hello.el'.
+
 (defvar notmuch-command "notmuch"
   "Command to run the notmuch binary.")
 
@@ -130,6 +134,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
     (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "=" 'notmuch-refresh-this-buffer)
     (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
+    (define-key map "j" 'notmuch-jump)
     map)
   "Keymap shared by all notmuch modes.")
 
@@ -845,6 +850,47 @@ status."
 (defvar notmuch-show-process-crypto nil)
 (make-variable-buffer-local 'notmuch-show-process-crypto)
 
+;; Jump key support:
+
+(defvar notmuch-jump-search nil)
+(defun notmuch-jump-map ()
+  (let ((map (make-sparse-keymap))
+	help)
+    (set-keymap-parent map minibuffer-local-map)
+    (suppress-keymap map)
+    (dolist (saved-search notmuch-saved-searches)
+      (let ((key (notmuch-saved-search-get saved-search :key)))
+	(when key
+	  (define-key map key `(lambda ()
+				 (interactive)
+				 (setq notmuch-jump-search ',saved-search)
+				 (exit-minibuffer)))
+	  (push (format "%s: %s"
+			(propertize key 'face 'minibuffer-prompt)
+			(notmuch-saved-search-get saved-search :name))
+		help))))
+    ;; Hitting ? displays a quick hint of the accelerators.
+    (define-key map "?" `(lambda ()
+			   (interactive)
+			   (message "%s"
+				    (mapconcat #'identity
+					       ;; Reverse the list so
+					       ;; that elements appear
+					       ;; in the same order as
+					       ;; `notmuch-saved-searches'.
+					       (reverse ',help)
+					       " "))))
+    map))
+
+(defun notmuch-jump ()
+  "Read a saved search accelerator key and perform the search."
+  (interactive)
+  (setq notmuch-jump-search nil)
+  (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))
+  (when notmuch-jump-search
+    (notmuch-search (notmuch-saved-search-get notmuch-jump-search :query)
+		    (notmuch-saved-search-get notmuch-jump-search :oldest-first))))
+
 (provide 'notmuch-lib)
 
 ;; Local Variables:
-- 
2.0.0.rc0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-05-07 11:21   ` [PATCH v2] emacs: Add support for saved search accelerators David Edmondson
@ 2014-05-08  9:14     ` Mark Walters
  2014-05-10 21:04       ` Aaron Ecay
  2014-07-12 19:31     ` David Bremner
  1 sibling, 1 reply; 13+ messages in thread
From: Mark Walters @ 2014-05-08  9:14 UTC (permalink / raw)
  To: David Edmondson, notmuch


Hi

This version looks good to me.

The only slight query I have is which key to bind it to: Austin used g
in notmuch-go and this uses j. Austin said on irc that he chose g
because it wasn't bound and matched gmail's shortcut.

Personally I like j (as it starts fewer words than g) and given that we
don't match any of gmail's other bindings I don't think there is much
advantage to doing so in this case.

In any case that's all bikeshedding: I like this patch with either
binding.

Best wishes

Mark



On Wed, 07 May 2014, David Edmondson <dme@dme.org> wrote:
> Extended the saved search definition to allow the inclusion of an
> accelerator key for the search. Bind 'j' in the common mode map as a
> leader for such accelerator keys.
> ---
>  emacs/notmuch-hello.el |  5 ++++-
>  emacs/notmuch-lib.el   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 3de5238..64d5aa1 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -85,6 +85,7 @@ searches so they still work in customize."
>  		(group :format "%v" :inline t (const :format "  Query: " :query) (string :format "%v")))
>  	  (checklist :inline t
>  		     :format "%v"
> +		     (group :format "%v" :inline t (const :format "    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 @@ a plist. Supported properties are
>  
>    :name            Name of the search (required).
>    :query           Search to run (required).
> +  :key             Optional accelerator key.
>    :count-query     Optional extra query to generate the count
>                     shown. If not present then the :query property
>                     is used.
> @@ -551,7 +553,8 @@ with `notmuch-hello-query-counts'."
>  	    (when elem
>  	      (if (> column-indent 0)
>  		  (widget-insert (make-string column-indent ? )))
> -	      (let* ((name (plist-get elem :name))
> +	      (let* ((key (plist-get elem :key))
> +		     (name (plist-get elem :name))
>  		     (query (plist-get elem :query))
>  		     (oldest-first (case (plist-get elem :sort-order)
>  				     (newest-first nil)
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 2941da3..f8c5f96 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -25,6 +25,10 @@
>  (require 'mm-decode)
>  (require 'cl)
>  
> +(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
> +(declare-function notmuch-saved-search-get "notmuch-hello" (saved-search field))
> +(defvar notmuch-saved-searches) ;; In `notmuch-hello.el'.
> +
>  (defvar notmuch-command "notmuch"
>    "Command to run the notmuch binary.")
>  
> @@ -130,6 +134,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
>      (define-key map "m" 'notmuch-mua-new-mail)
>      (define-key map "=" 'notmuch-refresh-this-buffer)
>      (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
> +    (define-key map "j" 'notmuch-jump)
>      map)
>    "Keymap shared by all notmuch modes.")
>  
> @@ -845,6 +850,47 @@ status."
>  (defvar notmuch-show-process-crypto nil)
>  (make-variable-buffer-local 'notmuch-show-process-crypto)
>  
> +;; Jump key support:
> +
> +(defvar notmuch-jump-search nil)
> +(defun notmuch-jump-map ()
> +  (let ((map (make-sparse-keymap))
> +	help)
> +    (set-keymap-parent map minibuffer-local-map)
> +    (suppress-keymap map)
> +    (dolist (saved-search notmuch-saved-searches)
> +      (let ((key (notmuch-saved-search-get saved-search :key)))
> +	(when key
> +	  (define-key map key `(lambda ()
> +				 (interactive)
> +				 (setq notmuch-jump-search ',saved-search)
> +				 (exit-minibuffer)))
> +	  (push (format "%s: %s"
> +			(propertize key 'face 'minibuffer-prompt)
> +			(notmuch-saved-search-get saved-search :name))
> +		help))))
> +    ;; Hitting ? displays a quick hint of the accelerators.
> +    (define-key map "?" `(lambda ()
> +			   (interactive)
> +			   (message "%s"
> +				    (mapconcat #'identity
> +					       ;; Reverse the list so
> +					       ;; that elements appear
> +					       ;; in the same order as
> +					       ;; `notmuch-saved-searches'.
> +					       (reverse ',help)
> +					       " "))))
> +    map))
> +
> +(defun notmuch-jump ()
> +  "Read a saved search accelerator key and perform the search."
> +  (interactive)
> +  (setq notmuch-jump-search nil)
> +  (read-from-minibuffer "Jump to saved search: " nil (notmuch-jump-map))
> +  (when notmuch-jump-search
> +    (notmuch-search (notmuch-saved-search-get notmuch-jump-search :query)
> +		    (notmuch-saved-search-get notmuch-jump-search :oldest-first))))
> +
>  (provide 'notmuch-lib)
>  
>  ;; Local Variables:
> -- 
> 2.0.0.rc0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-05-08  9:14     ` Mark Walters
@ 2014-05-10 21:04       ` Aaron Ecay
  2014-05-12  6:07         ` David Edmondson
  0 siblings, 1 reply; 13+ messages in thread
From: Aaron Ecay @ 2014-05-10 21:04 UTC (permalink / raw)
  To: Mark Walters, David Edmondson, notmuch

Hello,

2014ko maiatzak 8an, Mark Walters-ek idatzi zuen:
>
> Hi
>
> This version looks good to me.
>
> The only slight query I have is which key to bind it to: Austin used g
> in notmuch-go and this uses j. Austin said on irc that he chose g
> because it wasn't bound and matched gmail's shortcut.
>
> Personally I like j (as it starts fewer words than g) and given that we
> don't match any of gmail's other bindings I don't think there is much
> advantage to doing so in this case.

All other things being equal, I’d prefer “j” here, but for different
reasons.  “g” is the emacs-standard key to refresh or revert a buffer.
In my personal customization file I bound “g” to
notmuch-refresh-this-buffer in notmuch-(show/search)-mode-map long ago
(and forgot this binding was not standard until reading above that g is
not bound).  It’s probably better emacs citizenship to not use such a
standard key for a different purpose.

--
Aaron Ecay

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-05-10 21:04       ` Aaron Ecay
@ 2014-05-12  6:07         ` David Edmondson
  2014-06-06 13:12           ` Mark Walters
  0 siblings, 1 reply; 13+ messages in thread
From: David Edmondson @ 2014-05-12  6:07 UTC (permalink / raw)
  To: Aaron Ecay, Mark Walters, notmuch

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

On Sat, May 10 2014, Aaron Ecay wrote:
> 2014ko maiatzak 8an, Mark Walters-ek idatzi zuen:
>>
>> Hi
>>
>> This version looks good to me.
>>
>> The only slight query I have is which key to bind it to: Austin used g
>> in notmuch-go and this uses j. Austin said on irc that he chose g
>> because it wasn't bound and matched gmail's shortcut.
>>
>> Personally I like j (as it starts fewer words than g) and given that we
>> don't match any of gmail's other bindings I don't think there is much
>> advantage to doing so in this case.
>
> All other things being equal, I’d prefer “j” here, but for different
> reasons.  “g” is the emacs-standard key to refresh or revert a buffer.
> In my personal customization file I bound “g” to
> notmuch-refresh-this-buffer in notmuch-(show/search)-mode-map long ago
> (and forgot this binding was not standard until reading above that g is
> not bound).  It’s probably better emacs citizenship to not use such a
> standard key for a different purpose.

+1, though I won't lose sleep.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 310 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-05-12  6:07         ` David Edmondson
@ 2014-06-06 13:12           ` Mark Walters
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2014-06-06 13:12 UTC (permalink / raw)
  To: David Edmondson, Aaron Ecay, notmuch

On Mon, 12 May 2014, David Edmondson <dme@dme.org> wrote:
> On Sat, May 10 2014, Aaron Ecay wrote:
>> 2014ko maiatzak 8an, Mark Walters-ek idatzi zuen:
>>>
>>> Hi
>>>
>>> This version looks good to me.
>>>
>>> The only slight query I have is which key to bind it to: Austin used g
>>> in notmuch-go and this uses j. Austin said on irc that he chose g
>>> because it wasn't bound and matched gmail's shortcut.
>>>
>>> Personally I like j (as it starts fewer words than g) and given that we
>>> don't match any of gmail's other bindings I don't think there is much
>>> advantage to doing so in this case.
>>
>> All other things being equal, I’d prefer “j” here, but for different
>> reasons.  “g” is the emacs-standard key to refresh or revert a buffer.
>> In my personal customization file I bound “g” to
>> notmuch-refresh-this-buffer in notmuch-(show/search)-mode-map long ago
>> (and forgot this binding was not standard until reading above that g is
>> not bound).  It’s probably better emacs citizenship to not use such a
>> standard key for a different purpose.
>
> +1, though I won't lose sleep.

That sounds like a consensus so +1 from me.

Best wishes

Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-05-07 11:21   ` [PATCH v2] emacs: Add support for saved search accelerators David Edmondson
  2014-05-08  9:14     ` Mark Walters
@ 2014-07-12 19:31     ` David Bremner
  2014-07-13  3:50       ` Austin Clements
  1 sibling, 1 reply; 13+ messages in thread
From: David Bremner @ 2014-07-12 19:31 UTC (permalink / raw)
  To: David Edmondson, notmuch

David Edmondson <dme@dme.org> writes:

> Extended the saved search definition to allow the inclusion of an
> accelerator key for the search. Bind 'j' in the common mode map as a
> leader for such accelerator keys.

I was trying this out without configuring any accelerators and it seemed
a bit unfriendly. After hitting 'j' I more or less get stuck until I hit
C-g. Even hitting ? did not produce any output. I think at minimum the
user who hits j by mistake should not get stuck in a state she needs to
C-g out of.

d

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-07-12 19:31     ` David Bremner
@ 2014-07-13  3:50       ` Austin Clements
  2014-07-13 14:20         ` David Bremner
  0 siblings, 1 reply; 13+ messages in thread
From: Austin Clements @ 2014-07-13  3:50 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch

Quoth David Bremner on Jul 12 at  4:31 pm:
> David Edmondson <dme@dme.org> writes:
> 
> > Extended the saved search definition to allow the inclusion of an
> > accelerator key for the search. Bind 'j' in the common mode map as a
> > leader for such accelerator keys.
> 
> I was trying this out without configuring any accelerators and it seemed
> a bit unfriendly. After hitting 'j' I more or less get stuck until I hit
> C-g. Even hitting ? did not produce any output. I think at minimum the
> user who hits j by mistake should not get stuck in a state she needs to
> C-g out of.

Have you tried notmuch-go?

  https://github.com/aclements/notmuch/blob/go-hack/emacs/notmuch-go.el

Once you load it, it's bound to 'g' everywhere.  It shows all of the
available bindings/searches above the minibuffer as soon as you hit
'g'.  I've been using notmuch-go happily for months (it's completely
supplanted hello for me).

The right answer might be something between notmuch-go and dme's
patch.  Currently notmuch-go uses a hard-coded set of searches, while
dme's patch derives them from the saved searches.  notmuch-go may also
be more complicated than necessary; I had originally intended to do
some other things with it that never materialized and, now that I've
used it, I don't think they're necessary.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-07-13  3:50       ` Austin Clements
@ 2014-07-13 14:20         ` David Bremner
  2014-07-13 14:32           ` Austin Clements
  0 siblings, 1 reply; 13+ messages in thread
From: David Bremner @ 2014-07-13 14:20 UTC (permalink / raw)
  To: Austin Clements; +Cc: notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> The right answer might be something between notmuch-go and dme's
> patch.  Currently notmuch-go uses a hard-coded set of searches, while
> dme's patch derives them from the saved searches.

I'm not really looking for a solution for my own use, just wearing my
integration manager hat. In that context, a second set of hard coded
saved searches would be a blocker.

d

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-07-13 14:20         ` David Bremner
@ 2014-07-13 14:32           ` Austin Clements
  2014-07-13 15:06             ` Mark Walters
  0 siblings, 1 reply; 13+ messages in thread
From: Austin Clements @ 2014-07-13 14:32 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch

Quoth David Bremner on Jul 13 at 11:20 am:
> Austin Clements <amdragon@MIT.EDU> writes:
> 
> > The right answer might be something between notmuch-go and dme's
> > patch.  Currently notmuch-go uses a hard-coded set of searches, while
> > dme's patch derives them from the saved searches.
> 
> I'm not really looking for a solution for my own use, just wearing my
> integration manager hat. In that context, a second set of hard coded
> saved searches would be a blocker.

Sorry, it seems my email wasn't clear.  Does notmuch-go address your
user unfriendliness concerns with dme's patch?

If so, we should combine notmuch-go's UI with dme's customizable key
bindings and think about pushing that (clearly we wouldn't push
notmuch-go as it is).

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2] emacs: Add support for saved search accelerators
  2014-07-13 14:32           ` Austin Clements
@ 2014-07-13 15:06             ` Mark Walters
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Walters @ 2014-07-13 15:06 UTC (permalink / raw)
  To: Austin Clements, David Bremner; +Cc: notmuch


> Quoth David Bremner on Jul 13 at 11:20 am:
>> Austin Clements <amdragon@MIT.EDU> writes:
>> 
>> > The right answer might be something between notmuch-go and dme's
>> > patch.  Currently notmuch-go uses a hard-coded set of searches, while
>> > dme's patch derives them from the saved searches.
>> 
>> I'm not really looking for a solution for my own use, just wearing my
>> integration manager hat. In that context, a second set of hard coded
>> saved searches would be a blocker.
>
> Sorry, it seems my email wasn't clear.  Does notmuch-go address your
> user unfriendliness concerns with dme's patch?
>
> If so, we should combine notmuch-go's UI with dme's customizable key
> bindings and think about pushing that (clearly we wouldn't push
> notmuch-go as it is).

I think dme's patch is only user unfriendly if there are no saved
searches configured: if there are some then ? shows them. The problem is
that ? does nothing if there aren't any.

I don't know whether always showing the bindings (like notmuch-go) or
only showing them after ? is pressed (like this series) is better.

Best wishes

Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-07-13 15:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06 14:16 [RFC] [PATCH] emacs: Add support for saved search accelerators David Edmondson
2014-05-06 16:41 ` Mark Walters
2014-05-07 11:21 ` [PATCH v2] emacs: Add support for saved search accelerator keys David Edmondson
2014-05-07 11:21   ` [PATCH v2] emacs: Add support for saved search accelerators David Edmondson
2014-05-08  9:14     ` Mark Walters
2014-05-10 21:04       ` Aaron Ecay
2014-05-12  6:07         ` David Edmondson
2014-06-06 13:12           ` Mark Walters
2014-07-12 19:31     ` David Bremner
2014-07-13  3:50       ` Austin Clements
2014-07-13 14:20         ` David Bremner
2014-07-13 14:32           ` Austin Clements
2014-07-13 15:06             ` Mark Walters

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).