unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] emacs: tag-jump: make k binding for the reverse tag change map
@ 2016-10-06 14:59 Mark Walters
  2016-10-06 14:59 ` [PATCH 2/2] emacs: tag-jump: make the same binding do " Mark Walters
  2016-10-06 18:23 ` [PATCH 1/2] emacs: tag-jump: make k binding for " Tomi Ollila
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Walters @ 2016-10-06 14:59 UTC (permalink / raw)
  To: notmuch

Currently, by default k invokes the tag-jump menu, and following it by
r invokes the reverse tag change jump menu. This is awkward to type
(e.g. k r u for undoing a -unread change). This changes it so that k
followed by k invokes the reverse menu.
---

There has been discussion on irc and reasonable agreement that this is
more convenient.

This patch can be applied on its own, or with the second patch. Since
it is relatively hard to configure the internal binding to jump to the
reverse tag changes it might be worth applying. Alternatively we could
have a defvar variable that specifies the key, so a user can configure
it if they want.

Since the first patch changes default keybindigs it is probably worth
applying that one soon, and then considering what, if anything, to do
about the second.

Best wishes

Mark





emacs/notmuch-tag.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 49662c2..36a498d 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -523,7 +523,7 @@ and vice versa."
 	(push (list key name-string
 		     `(lambda () (,tag-function ',tag-change)))
 	      action-map)))
-    (push (list "r" (if reverse
+    (push (list "k" (if reverse
 			"Forward tag changes "
 		      "Reverse tag changes")
 		(apply-partially 'notmuch-tag-jump (not reverse)))
-- 
2.1.4

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

* [PATCH 2/2] emacs: tag-jump: make the same binding do the reverse tag change map
  2016-10-06 14:59 [PATCH 1/2] emacs: tag-jump: make k binding for the reverse tag change map Mark Walters
@ 2016-10-06 14:59 ` Mark Walters
  2016-10-06 18:23 ` [PATCH 1/2] emacs: tag-jump: make k binding for " Tomi Ollila
  1 sibling, 0 replies; 7+ messages in thread
From: Mark Walters @ 2016-10-06 14:59 UTC (permalink / raw)
  To: notmuch

Make the binding for going to the reverse tag change jump menu the
same as the binding to enter the tag-jump menu.

From the way the tag-jump menu is setup it is relatively hard for the
user to configure this otherwise.
---
 emacs/notmuch-tag.el | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 36a498d..3cdff9b 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -485,6 +485,8 @@ begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
 		s)))
 	  tags))
 
+(defvar notmuch-search-mode-map)
+
 (defun notmuch-tag-jump (reverse)
   "Create a jump menu for tagging operations.
 
@@ -523,11 +525,17 @@ and vice versa."
 	(push (list key name-string
 		     `(lambda () (,tag-function ',tag-change)))
 	      action-map)))
-    (push (list "k" (if reverse
-			"Forward tag changes "
-		      "Reverse tag changes")
-		(apply-partially 'notmuch-tag-jump (not reverse)))
-	  action-map)
+
+    (let* ((binding (where-is-internal 'notmuch-tag-jump notmuch-search-mode-map 't))
+	   (key (if (and (vectorp binding) (= (length binding) 1))
+		    (string (elt binding 0))
+		  "k")))
+      (push (list key
+		  (if reverse
+		      "Forward tag changes "
+		    "Reverse tag changes")
+		  (apply-partially 'notmuch-tag-jump (not reverse)))
+	    action-map))
     (setq action-map (nreverse action-map))
     (notmuch-jump action-map "Tag: ")))
 
-- 
2.1.4

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

* Re: [PATCH 1/2] emacs: tag-jump: make k binding for the reverse tag change map
  2016-10-06 14:59 [PATCH 1/2] emacs: tag-jump: make k binding for the reverse tag change map Mark Walters
  2016-10-06 14:59 ` [PATCH 2/2] emacs: tag-jump: make the same binding do " Mark Walters
@ 2016-10-06 18:23 ` Tomi Ollila
  2016-10-06 21:59   ` [PATCH] " Mark Walters
  1 sibling, 1 reply; 7+ messages in thread
From: Tomi Ollila @ 2016-10-06 18:23 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Thu, Oct 06 2016, Mark Walters <markwalters1009@gmail.com> wrote:

> Currently, by default k invokes the tag-jump menu, and following it by
> r invokes the reverse tag change jump menu. This is awkward to type
> (e.g. k r u for undoing a -unread change). This changes it so that k
> followed by k invokes the reverse menu.
> ---
>
> There has been discussion on irc and reasonable agreement that this is
> more convenient.
>
> This patch can be applied on its own, or with the second patch. Since
> it is relatively hard to configure the internal binding to jump to the
> reverse tag changes it might be worth applying. Alternatively we could
> have a defvar variable that specifies the key, so a user can configure
> it if they want.
>
> Since the first patch changes default keybindigs it is probably worth
> applying that one soon, and then considering what, if anything, to do
> about the second.

Agreed -- and putting the "k" into a variable can also be applied
separately.



>
> Best wishes
>
> Mark
>
>
>
>
>
> emacs/notmuch-tag.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 49662c2..36a498d 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -523,7 +523,7 @@ and vice versa."
>  	(push (list key name-string
>  		     `(lambda () (,tag-function ',tag-change)))
>  	      action-map)))
> -    (push (list "r" (if reverse
> +    (push (list "k" (if reverse
>  			"Forward tag changes "
>  		      "Reverse tag changes")
>  		(apply-partially 'notmuch-tag-jump (not reverse)))
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* [PATCH] emacs: tag-jump: make k binding for the reverse tag change map
  2016-10-06 18:23 ` [PATCH 1/2] emacs: tag-jump: make k binding for " Tomi Ollila
@ 2016-10-06 21:59   ` Mark Walters
  2016-10-07 20:21     ` Tomi Ollila
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mark Walters @ 2016-10-06 21:59 UTC (permalink / raw)
  To: notmuch

Currently, by default k invokes the tag-jump menu, and following it by
r invokes the reverse tag change jump menu. This is awkward to type
(e.g. k r u for undoing a -unread change). This changes it so that k
followed by k invokes the reverse menu. We make the key for the
reverse map a variable as that makes it possible for a user to
change it by editing their .emacs file.
---

I think this is the right solution (suggested by Tomi on
irc). Previously it was not possible for the user to configure this
binding without some substantial lisp, or patching the source.

Best wishes

Mark



id:1475765990-15031-1-git-send-email-markwalters1009@gmail.com


emacs/notmuch-tag.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 49662c2..c03027f 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -485,6 +485,9 @@ begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
 		s)))
 	  tags))
 
+(defvar notmuch-tag-jump-reverse-key "k"
+  "The key in tag-jump to switch to the reverse tag changes.")
+
 (defun notmuch-tag-jump (reverse)
   "Create a jump menu for tagging operations.
 
@@ -523,9 +526,10 @@ and vice versa."
 	(push (list key name-string
 		     `(lambda () (,tag-function ',tag-change)))
 	      action-map)))
-    (push (list "r" (if reverse
-			"Forward tag changes "
-		      "Reverse tag changes")
+    (push (list notmuch-tag-jump-reverse-key
+		(if reverse
+		    "Forward tag changes "
+		  "Reverse tag changes")
 		(apply-partially 'notmuch-tag-jump (not reverse)))
 	  action-map)
     (setq action-map (nreverse action-map))
-- 
2.1.4

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

* Re: [PATCH] emacs: tag-jump: make k binding for the reverse tag change map
  2016-10-06 21:59   ` [PATCH] " Mark Walters
@ 2016-10-07 20:21     ` Tomi Ollila
  2016-10-08  1:41     ` David Bremner
  2016-10-08 15:05     ` David Bremner
  2 siblings, 0 replies; 7+ messages in thread
From: Tomi Ollila @ 2016-10-07 20:21 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Fri, Oct 07 2016, Mark Walters <markwalters1009@gmail.com> wrote:

> Currently, by default k invokes the tag-jump menu, and following it by
> r invokes the reverse tag change jump menu. This is awkward to type
> (e.g. k r u for undoing a -unread change). This changes it so that k
> followed by k invokes the reverse menu. We make the key for the
> reverse map a variable as that makes it possible for a user to
> change it by editing their .emacs file.
> ---

LGTM.

>
> I think this is the right solution (suggested by Tomi on
> irc). Previously it was not possible for the user to configure this
> binding without some substantial lisp, or patching the source.
>
> Best wishes
>
> Mark
>
>
>
> id:1475765990-15031-1-git-send-email-markwalters1009@gmail.com
>
>
> emacs/notmuch-tag.el | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index 49662c2..c03027f 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -485,6 +485,9 @@ begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
>  		s)))
>  	  tags))
>  
> +(defvar notmuch-tag-jump-reverse-key "k"
> +  "The key in tag-jump to switch to the reverse tag changes.")
> +
>  (defun notmuch-tag-jump (reverse)
>    "Create a jump menu for tagging operations.
>  
> @@ -523,9 +526,10 @@ and vice versa."
>  	(push (list key name-string
>  		     `(lambda () (,tag-function ',tag-change)))
>  	      action-map)))
> -    (push (list "r" (if reverse
> -			"Forward tag changes "
> -		      "Reverse tag changes")
> +    (push (list notmuch-tag-jump-reverse-key
> +		(if reverse
> +		    "Forward tag changes "
> +		  "Reverse tag changes")
>  		(apply-partially 'notmuch-tag-jump (not reverse)))
>  	  action-map)
>      (setq action-map (nreverse action-map))
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] emacs: tag-jump: make k binding for the reverse tag change map
  2016-10-06 21:59   ` [PATCH] " Mark Walters
  2016-10-07 20:21     ` Tomi Ollila
@ 2016-10-08  1:41     ` David Bremner
  2016-10-08 15:05     ` David Bremner
  2 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2016-10-08  1:41 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> Currently, by default k invokes the tag-jump menu, and following it by
> r invokes the reverse tag change jump menu. This is awkward to type
> (e.g. k r u for undoing a -unread change). This changes it so that k
> followed by k invokes the reverse menu. We make the key for the
> reverse map a variable as that makes it possible for a user to
> change it by editing their .emacs file.
> ---

pushed to master

d

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

* Re: [PATCH] emacs: tag-jump: make k binding for the reverse tag change map
  2016-10-06 21:59   ` [PATCH] " Mark Walters
  2016-10-07 20:21     ` Tomi Ollila
  2016-10-08  1:41     ` David Bremner
@ 2016-10-08 15:05     ` David Bremner
  2 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2016-10-08 15:05 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> Currently, by default k invokes the tag-jump menu, and following it by
> r invokes the reverse tag change jump menu. This is awkward to type
> (e.g. k r u for undoing a -unread change). This changes it so that k
> followed by k invokes the reverse menu. We make the key for the
> reverse map a variable as that makes it possible for a user to
> change it by editing their .emacs file.

One potential footgun is that users can bind sequences that start with k
(of course _I_ would never do such a silly thing). These sequences then
won't work. I'm not sure if this is worth checking in the customize or
at least documenting.

d

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

end of thread, other threads:[~2016-10-08 15:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 14:59 [PATCH 1/2] emacs: tag-jump: make k binding for the reverse tag change map Mark Walters
2016-10-06 14:59 ` [PATCH 2/2] emacs: tag-jump: make the same binding do " Mark Walters
2016-10-06 18:23 ` [PATCH 1/2] emacs: tag-jump: make k binding for " Tomi Ollila
2016-10-06 21:59   ` [PATCH] " Mark Walters
2016-10-07 20:21     ` Tomi Ollila
2016-10-08  1:41     ` David Bremner
2016-10-08 15:05     ` David Bremner

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).