* [PATCH] emacs: add tag jump menu
@ 2016-09-17 21:09 Mark Walters
2016-09-18 7:00 ` Ioan-Adrian Ratiu
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Mark Walters @ 2016-09-17 21:09 UTC (permalink / raw)
To: notmuch
Add a "jump" style menu for doing tagging operations.
---
Jani suggested something like this on irc today. This is a first cut
to see if people like it. By default the tagging jump menu is bound to
k (which works in search/show/tree mode), and has the following options
a (Archive) -inbox -unread
u (Mark Read) -unread
d (Delete) +deleted
If you do ctrl-u k the it will do the reverse operation.
To customize you want the variable notmuch-tagging-keys in the group
notmuch-tag. It is only very lightly tested but seems to work. And the
docstrings will definitely need some work.
Best wishes
Mark
emacs/notmuch-lib.el | 4 ++++
emacs/notmuch-show.el | 1 +
emacs/notmuch-tag.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
emacs/notmuch-tree.el | 1 +
emacs/notmuch.el | 1 +
5 files changed, 58 insertions(+)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 2f015b0..b2cdace 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -57,6 +57,10 @@
(custom-add-to-group 'notmuch-send 'message 'custom-group)
+(defgroup notmuch-tag nil
+ "Tags and tagging in Notmuch."
+ :group 'notmuch)
+
(defgroup notmuch-crypto nil
"Processing and display of cryptographic MIME parts."
:group 'notmuch)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5a585f3..756c7dd 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1428,6 +1428,7 @@ reset based on the original query."
(define-key map "V" 'notmuch-show-view-raw-message)
(define-key map "c" 'notmuch-show-stash-map)
(define-key map "h" 'notmuch-show-toggle-visibility-headers)
+ (define-key map "k" 'notmuch-tag-jump)
(define-key map "*" 'notmuch-show-tag-all)
(define-key map "-" 'notmuch-show-remove-tag)
(define-key map "+" 'notmuch-show-add-tag)
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index ec3c964..4d2feef 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -28,6 +28,37 @@
(require 'crm)
(require 'notmuch-lib)
+(declare-function notmuch-search-tag "notmuch" tag-changes)
+(declare-function notmuch-show-tag "notmuch-show" tag-changes)
+(declare-function notmuch-tree-tag "notmuch-tree" tag-changes)
+
+(autoload 'notmuch-jump "notmuch-jump")
+
+
+(define-widget 'notmuch-tag-key-type 'list
+ "A single key tagging binding"
+ :format "%v"
+ :args '((list :inline t
+ :format "%v"
+ (key-sequence :tag "Key")
+ (repeat :tag "Tag operations" (string :format "%v" :tag "change"))
+ (checklist :inline t
+ (string :tag "Short Name")))))
+
+(defcustom notmuch-tagging-keys
+ `((,(kbd "a") ("-inbox" "-unread") "Archive")
+ (,(kbd "u") ("-unread") "Mark read")
+ (,(kbd "d") ("+deleted") "Delete"))
+ "A list of keys and corresponding tagging operations
+
+For each key you can specify a sequence of tagging operations to
+apply. By default they will appear in the tagging buffer just as
+this sequence of tags, but you can specify a short name if you
+prefer."
+ :tag "List of tagging bindings"
+ :type '(repeat notmuch-tag-key-type)
+ :group 'notmuch-tag)
+
(define-widget 'notmuch-tag-format-type 'lazy
"Customize widget for notmuch-tag-format and friends"
:type '(alist :key-type (regexp :tag "Tag")
@@ -437,6 +468,26 @@ begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
s)))
tags))
+(defun notmuch-tag-jump (reverse)
+ (interactive "P")
+ (let (action-map)
+ (dolist (binding notmuch-tagging-keys)
+ (let* ((tag-function (case major-mode
+ (notmuch-search-mode #'notmuch-search-tag)
+ (notmuch-show-mode #'notmuch-show-tag)
+ (notmuch-tree-mode #'notmuch-tree-tag)))
+ (key (first binding))
+ (tag-change (if reverse
+ (notmuch-tag-change-list (second binding) 't)
+ (second binding)))
+ (name (if (third binding)
+ (if reverse (concat "Undo " (third binding))
+ (third binding))
+ (mapconcat #'identity tag-change " "))))
+ (push (list key name
+ `(lambda () (,tag-function ',tag-change)))
+ action-map)))
+ (notmuch-jump action-map "Tag: ")))
;;
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index d864e6d..5431384 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -276,6 +276,7 @@ FUNC."
(define-key map "P" 'notmuch-tree-prev-message)
(define-key map (kbd "M-p") 'notmuch-tree-prev-thread)
(define-key map (kbd "M-n") 'notmuch-tree-next-thread)
+ (define-key map "k" 'notmuch-tag-jump)
(define-key map "-" 'notmuch-tree-remove-tag)
(define-key map "+" 'notmuch-tree-add-tag)
(define-key map "*" 'notmuch-tree-tag-thread)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 8e14692..888672b 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -169,6 +169,7 @@ there will be called at other points of notmuch execution."
(define-key map "t" 'notmuch-search-filter-by-tag)
(define-key map "l" 'notmuch-search-filter)
(define-key map [mouse-1] 'notmuch-search-show-thread)
+ (define-key map "k" 'notmuch-tag-jump)
(define-key map "*" 'notmuch-search-tag-all)
(define-key map "a" 'notmuch-search-archive-thread)
(define-key map "-" 'notmuch-search-remove-tag)
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-17 21:09 [PATCH] emacs: add tag jump menu Mark Walters
@ 2016-09-18 7:00 ` Ioan-Adrian Ratiu
2016-09-18 9:08 ` Mark Walters
2016-09-20 17:28 ` Amadeusz Żołnowski
2016-09-18 13:31 ` David Bremner
2016-09-18 14:06 ` Amadeusz Żołnowski
2 siblings, 2 replies; 12+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-09-18 7:00 UTC (permalink / raw)
To: Mark Walters, notmuch
Hi
I have implemented something similar in my tree and I really like the
idea. I have one issue though.
On Sat, 17 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
> Add a "jump" style menu for doing tagging operations.
> ---
>
> Jani suggested something like this on irc today. This is a first cut
> to see if people like it. By default the tagging jump menu is bound to
> k (which works in search/show/tree mode), and has the following options
>
> a (Archive) -inbox -unread
> u (Mark Read) -unread
> d (Delete) +deleted
>
> If you do ctrl-u k the it will do the reverse operation.
I know C-u is default emacs behaviour but I find very cumbersone to do
C-u for unapplying the tag. What I do and want is to simply apply the
tag when pressing "d" then unapply it when pressing "d" again if the
mail/thread already contains the deleted tag (basically it's a toggle).
Here's an example of code I'm using:
(define-key notmuch-show-mode-map "d"
(lambda ()
"toggle deleted tag for message"
(interactive)
(if (member "deleted" (notmuch-show-get-tags))
(notmuch-show-tag (list "-deleted"))
(notmuch-show-tag (list "+deleted")))))
(define-key notmuch-search-mode-map "d"
(lambda (&optional beg end)
"toggle deleted tag for message"
(interactive (notmuch-search-interactive-region))
(if (member "deleted" (notmuch-search-get-tags))
(notmuch-search-tag (list "-deleted") beg end)
(notmuch-search-tag (list "+deleted") beg end))))
It works really well for me :). "inbox" and other tags work similarly.
>
> To customize you want the variable notmuch-tagging-keys in the group
> notmuch-tag. It is only very lightly tested but seems to work. And the
> docstrings will definitely need some work.
>
> Best wishes
>
> Mark
>
>
>
>
>
>
>
> emacs/notmuch-lib.el | 4 ++++
> emacs/notmuch-show.el | 1 +
> emacs/notmuch-tag.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> emacs/notmuch-tree.el | 1 +
> emacs/notmuch.el | 1 +
> 5 files changed, 58 insertions(+)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 2f015b0..b2cdace 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -57,6 +57,10 @@
>
> (custom-add-to-group 'notmuch-send 'message 'custom-group)
>
> +(defgroup notmuch-tag nil
> + "Tags and tagging in Notmuch."
> + :group 'notmuch)
> +
> (defgroup notmuch-crypto nil
> "Processing and display of cryptographic MIME parts."
> :group 'notmuch)
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 5a585f3..756c7dd 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1428,6 +1428,7 @@ reset based on the original query."
> (define-key map "V" 'notmuch-show-view-raw-message)
> (define-key map "c" 'notmuch-show-stash-map)
> (define-key map "h" 'notmuch-show-toggle-visibility-headers)
> + (define-key map "k" 'notmuch-tag-jump)
> (define-key map "*" 'notmuch-show-tag-all)
> (define-key map "-" 'notmuch-show-remove-tag)
> (define-key map "+" 'notmuch-show-add-tag)
> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
> index ec3c964..4d2feef 100644
> --- a/emacs/notmuch-tag.el
> +++ b/emacs/notmuch-tag.el
> @@ -28,6 +28,37 @@
> (require 'crm)
> (require 'notmuch-lib)
>
> +(declare-function notmuch-search-tag "notmuch" tag-changes)
> +(declare-function notmuch-show-tag "notmuch-show" tag-changes)
> +(declare-function notmuch-tree-tag "notmuch-tree" tag-changes)
> +
> +(autoload 'notmuch-jump "notmuch-jump")
> +
> +
> +(define-widget 'notmuch-tag-key-type 'list
> + "A single key tagging binding"
> + :format "%v"
> + :args '((list :inline t
> + :format "%v"
> + (key-sequence :tag "Key")
> + (repeat :tag "Tag operations" (string :format "%v" :tag "change"))
> + (checklist :inline t
> + (string :tag "Short Name")))))
> +
> +(defcustom notmuch-tagging-keys
> + `((,(kbd "a") ("-inbox" "-unread") "Archive")
> + (,(kbd "u") ("-unread") "Mark read")
> + (,(kbd "d") ("+deleted") "Delete"))
> + "A list of keys and corresponding tagging operations
> +
> +For each key you can specify a sequence of tagging operations to
> +apply. By default they will appear in the tagging buffer just as
> +this sequence of tags, but you can specify a short name if you
> +prefer."
> + :tag "List of tagging bindings"
> + :type '(repeat notmuch-tag-key-type)
> + :group 'notmuch-tag)
> +
> (define-widget 'notmuch-tag-format-type 'lazy
> "Customize widget for notmuch-tag-format and friends"
> :type '(alist :key-type (regexp :tag "Tag")
> @@ -437,6 +468,26 @@ begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
> s)))
> tags))
>
> +(defun notmuch-tag-jump (reverse)
> + (interactive "P")
> + (let (action-map)
> + (dolist (binding notmuch-tagging-keys)
> + (let* ((tag-function (case major-mode
> + (notmuch-search-mode #'notmuch-search-tag)
> + (notmuch-show-mode #'notmuch-show-tag)
> + (notmuch-tree-mode #'notmuch-tree-tag)))
> + (key (first binding))
> + (tag-change (if reverse
> + (notmuch-tag-change-list (second binding) 't)
> + (second binding)))
> + (name (if (third binding)
> + (if reverse (concat "Undo " (third binding))
> + (third binding))
> + (mapconcat #'identity tag-change " "))))
> + (push (list key name
> + `(lambda () (,tag-function ',tag-change)))
> + action-map)))
> + (notmuch-jump action-map "Tag: ")))
>
> ;;
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index d864e6d..5431384 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -276,6 +276,7 @@ FUNC."
> (define-key map "P" 'notmuch-tree-prev-message)
> (define-key map (kbd "M-p") 'notmuch-tree-prev-thread)
> (define-key map (kbd "M-n") 'notmuch-tree-next-thread)
> + (define-key map "k" 'notmuch-tag-jump)
> (define-key map "-" 'notmuch-tree-remove-tag)
> (define-key map "+" 'notmuch-tree-add-tag)
> (define-key map "*" 'notmuch-tree-tag-thread)
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 8e14692..888672b 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -169,6 +169,7 @@ there will be called at other points of notmuch execution."
> (define-key map "t" 'notmuch-search-filter-by-tag)
> (define-key map "l" 'notmuch-search-filter)
> (define-key map [mouse-1] 'notmuch-search-show-thread)
> + (define-key map "k" 'notmuch-tag-jump)
> (define-key map "*" 'notmuch-search-tag-all)
> (define-key map "a" 'notmuch-search-archive-thread)
> (define-key map "-" 'notmuch-search-remove-tag)
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 7:00 ` Ioan-Adrian Ratiu
@ 2016-09-18 9:08 ` Mark Walters
2016-09-18 12:13 ` David Bremner
2016-09-18 14:30 ` Ioan-Adrian Ratiu
2016-09-20 17:28 ` Amadeusz Żołnowski
1 sibling, 2 replies; 12+ messages in thread
From: Mark Walters @ 2016-09-18 9:08 UTC (permalink / raw)
To: Ioan-Adrian Ratiu, notmuch
On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
> Hi
>
> I have implemented something similar in my tree and I really like the
> idea. I have one issue though.
>
> On Sat, 17 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>> Add a "jump" style menu for doing tagging operations.
>> ---
>>
>> Jani suggested something like this on irc today. This is a first cut
>> to see if people like it. By default the tagging jump menu is bound to
>> k (which works in search/show/tree mode), and has the following options
>>
>> a (Archive) -inbox -unread
>> u (Mark Read) -unread
>> d (Delete) +deleted
>>
>> If you do ctrl-u k the it will do the reverse operation.
>
> I know C-u is default emacs behaviour but I find very cumbersone to do
> C-u for unapplying the tag. What I do and want is to simply apply the
> tag when pressing "d" then unapply it when pressing "d" again if the
> mail/thread already contains the deleted tag (basically it's a toggle).
I agree that C-u is a little cumbersome -- I think I would be happy for
a toggle for single messages (with a single tag change), but for
multiple messages like a thread I think it would be very unclear what it
was doing.
In your example I think d on a thread with a deleted message would
undelete the thread, rather than deleting the other messages in the
thread. But whichever of the two we chose I could see people being
unsure which it was going to do.
It would be plausible to modify my patch so that k u does the same as
Ctrl-u k (i.e. takes you to the reverse tag operations) which would
avoid the awkward ctrl-u. (I don't want to add another key to the top
level maps as we are really very short on free keys)
Best wishes
Mark
> Here's an example of code I'm using:
>
> (define-key notmuch-show-mode-map "d"
> (lambda ()
> "toggle deleted tag for message"
> (interactive)
> (if (member "deleted" (notmuch-show-get-tags))
> (notmuch-show-tag (list "-deleted"))
> (notmuch-show-tag (list "+deleted")))))
>
> (define-key notmuch-search-mode-map "d"
> (lambda (&optional beg end)
> "toggle deleted tag for message"
> (interactive (notmuch-search-interactive-region))
> (if (member "deleted" (notmuch-search-get-tags))
> (notmuch-search-tag (list "-deleted") beg end)
> (notmuch-search-tag (list "+deleted") beg end))))
>
> It works really well for me :). "inbox" and other tags work similarly.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 9:08 ` Mark Walters
@ 2016-09-18 12:13 ` David Bremner
2016-09-18 15:43 ` Jani Nikula
2016-09-18 14:30 ` Ioan-Adrian Ratiu
1 sibling, 1 reply; 12+ messages in thread
From: David Bremner @ 2016-09-18 12:13 UTC (permalink / raw)
To: Mark Walters, Ioan-Adrian Ratiu, notmuch
Mark Walters <markwalters1009@gmail.com> writes:
> I agree that C-u is a little cumbersome -- I think I would be happy for
> a toggle for single messages (with a single tag change), but for
> multiple messages like a thread I think it would be very unclear what it
> was doing.
It's also not clear how toggle works for multiple tags. I mean, it's
clear in a mathematical sense, but not so clear when it would be
expected and useful in a UI sense.
>
> It would be plausible to modify my patch so that k u does the same as
> Ctrl-u k (i.e. takes you to the reverse tag operations) which would
> avoid the awkward ctrl-u. (I don't want to add another key to the top
> level maps as we are really very short on free keys)
A third option would be to use M-k as a synonym for C-u k
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-17 21:09 [PATCH] emacs: add tag jump menu Mark Walters
2016-09-18 7:00 ` Ioan-Adrian Ratiu
@ 2016-09-18 13:31 ` David Bremner
2016-09-20 3:04 ` Matt Armstrong
2016-09-18 14:06 ` Amadeusz Żołnowski
2 siblings, 1 reply; 12+ messages in thread
From: David Bremner @ 2016-09-18 13:31 UTC (permalink / raw)
To: Mark Walters, notmuch
Mark Walters <markwalters1009@gmail.com> writes:
> Add a "jump" style menu for doing tagging operations.
> ---
>
> Jani suggested something like this on irc today. This is a first cut
> to see if people like it. By default the tagging jump menu is bound to
> k (which works in search/show/tree mode), and has the following options
>
> a (Archive) -inbox -unread
> u (Mark Read) -unread
> d (Delete) +deleted
>
> If you do ctrl-u k the it will do the reverse operation.
>
> To customize you want the variable notmuch-tagging-keys in the group
> notmuch-tag. It is only very lightly tested but seems to work. And the
> docstrings will definitely need some work.
1) I was playing with moving my notmuch patch review workflow to this
setup, and I discovered that most of my tagging combos don't undo very
well. Basically that's because the represent transitions from multiple
states into a single one, e.g.
("p"
("+pending" "+notmuch::patch" "-notmuch::needs-review"
"-notmuch::moreinfo" "-notmuch::pushed"))
So if use "k p" then it's unlikely that the message had all three tags
with "-". To be clear, my current setup doesn't allow undo at all, so
I'm not losing anything.
If we think about the operation as reverse rather than undo, it might be
nice to have non-reversable operations that are ignored when doing the
reverse, e.g.
("p" ("+pending" "=notmuch::patch" "#notmuch::needs-review"
"#notmuch::moreinfo" "#notmuch::pushed"))
meaning unreversed, add pending and notmuch::patch and delete
notmuch::(needs-review, moreinfo, pushed)
while reversed only deletes pending. A simpler implimentation would
have two lists of operations, one that is ignored on reverse.
I'm not sure if people will buy into this idea of non-reversible
operations, and it could be a future enhancement (although changing the
customize structure is a mild hassle). In any case this distinction
between undo and reverse is worth keeping in mind when working on the
docs.
2) Would it be hard/possible to define submaps ? I have 9 tagging
commands related to notmuch maintence, and it seems like it would be
nicer to have those as e.g. "k n p" rather than clutter up the top level
"k <letter>" map.
This could also be a future enhancement
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-17 21:09 [PATCH] emacs: add tag jump menu Mark Walters
2016-09-18 7:00 ` Ioan-Adrian Ratiu
2016-09-18 13:31 ` David Bremner
@ 2016-09-18 14:06 ` Amadeusz Żołnowski
2 siblings, 0 replies; 12+ messages in thread
From: Amadeusz Żołnowski @ 2016-09-18 14:06 UTC (permalink / raw)
To: Mark Walters, notmuch
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
Mark Walters <markwalters1009@gmail.com> writes:
> a (Archive) -inbox -unread
Notmuch default behaviour on archiving is not removing "unread" tag.
> u (Mark Read) -unread
> d (Delete) +deleted
Could you remove "inbox" tag by default?
I also suggest another default action:
s (Mark spam) +spam -inbox
Cheers,
-- Amadeusz Żołnowski
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 948 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 9:08 ` Mark Walters
2016-09-18 12:13 ` David Bremner
@ 2016-09-18 14:30 ` Ioan-Adrian Ratiu
2016-09-18 15:53 ` Jani Nikula
1 sibling, 1 reply; 12+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-09-18 14:30 UTC (permalink / raw)
To: Mark Walters, notmuch
On Sun, 18 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
> On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
>> Hi
>>
>> I have implemented something similar in my tree and I really like the
>> idea. I have one issue though.
>>
>> On Sat, 17 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>>> Add a "jump" style menu for doing tagging operations.
>>> ---
>>>
>>> Jani suggested something like this on irc today. This is a first cut
>>> to see if people like it. By default the tagging jump menu is bound to
>>> k (which works in search/show/tree mode), and has the following options
>>>
>>> a (Archive) -inbox -unread
>>> u (Mark Read) -unread
>>> d (Delete) +deleted
>>>
>>> If you do ctrl-u k the it will do the reverse operation.
>>
>> I know C-u is default emacs behaviour but I find very cumbersone to do
>> C-u for unapplying the tag. What I do and want is to simply apply the
>> tag when pressing "d" then unapply it when pressing "d" again if the
>> mail/thread already contains the deleted tag (basically it's a toggle).
>
> I agree that C-u is a little cumbersome -- I think I would be happy for
> a toggle for single messages (with a single tag change), but for
> multiple messages like a thread I think it would be very unclear what it
> was doing.
My workflow with the kind of code shown above is as follows:
If in notmuch-search then pressing 'd' "deletes" everything selected,
including multiple messages in a region and if a thread was selected in
that region then the entire thread is deleted.
If I want to delete just a single message from the thread, I go to
notmuch-show where 'd' operates on a single message, never on a thread.
If an entire thread was already marked "deleted" and I want to undelete
a single message from that thread, I go to notmuch-show and press 'd' on
it.
IMO this is the simplest and the clearest workflow.
>
> In your example I think d on a thread with a deleted message would
> undelete the thread, rather than deleting the other messages in the
> thread. But whichever of the two we chose I could see people being
> unsure which it was going to do.
>
> It would be plausible to modify my patch so that k u does the same as
> Ctrl-u k (i.e. takes you to the reverse tag operations) which would
> avoid the awkward ctrl-u. (I don't want to add another key to the top
> level maps as we are really very short on free keys)
I agree to not pollute the top level maps and 'k u' would work for me,
what is important for me is to support toggling :)
>
> Best wishes
>
> Mark
>
>
>
>
>> Here's an example of code I'm using:
>>
>> (define-key notmuch-show-mode-map "d"
>> (lambda ()
>> "toggle deleted tag for message"
>> (interactive)
>> (if (member "deleted" (notmuch-show-get-tags))
>> (notmuch-show-tag (list "-deleted"))
>> (notmuch-show-tag (list "+deleted")))))
>>
>> (define-key notmuch-search-mode-map "d"
>> (lambda (&optional beg end)
>> "toggle deleted tag for message"
>> (interactive (notmuch-search-interactive-region))
>> (if (member "deleted" (notmuch-search-get-tags))
>> (notmuch-search-tag (list "-deleted") beg end)
>> (notmuch-search-tag (list "+deleted") beg end))))
>>
>> It works really well for me :). "inbox" and other tags work similarly.
>>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 12:13 ` David Bremner
@ 2016-09-18 15:43 ` Jani Nikula
0 siblings, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2016-09-18 15:43 UTC (permalink / raw)
To: David Bremner, Mark Walters, Ioan-Adrian Ratiu, notmuch
On Sun, 18 Sep 2016, David Bremner <david@tethera.net> wrote:
> Mark Walters <markwalters1009@gmail.com> writes:
>
>> I agree that C-u is a little cumbersome -- I think I would be happy for
>> a toggle for single messages (with a single tag change), but for
>> multiple messages like a thread I think it would be very unclear what it
>> was doing.
>
> It's also not clear how toggle works for multiple tags. I mean, it's
> clear in a mathematical sense, but not so clear when it would be
> expected and useful in a UI sense.
It sounds like both toggle *and* reverse operations are a bit unclear,
especially on multiple messages and/or tag changes. I asked for the
reverse operation using a prefix argument in a whim, but perhaps we're
better off starting without either toggle or reverse.
There's another angle. People seem to want the +deleted change also to
have -inbox. I'm not sure they'd want the reverse of "deleted" to also
put it back to inbox. David also seemed to have issues with the
asymmetry of desirable tag changes. So how about we just let people
define their tag changes using customization, including whatever reverse
they think is best? They could have "k d" (+deleted -inbox) for delete,
and "k D" (-deleted) for undelete. Or whatever they want.
And we can build on top of that later as we see how this feels.
I didn't actually try the patches, but based on the description the
general approach seemed fine. Thanks for doing this, Mark.
BR,
Jani.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 14:30 ` Ioan-Adrian Ratiu
@ 2016-09-18 15:53 ` Jani Nikula
2016-09-18 16:45 ` Ioan-Adrian Ratiu
0 siblings, 1 reply; 12+ messages in thread
From: Jani Nikula @ 2016-09-18 15:53 UTC (permalink / raw)
To: Ioan-Adrian Ratiu, Mark Walters, notmuch
On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
> On Sun, 18 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>> On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
>>> Hi
>>>
>>> I have implemented something similar in my tree and I really like the
>>> idea. I have one issue though.
>>>
>>> On Sat, 17 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>>>> Add a "jump" style menu for doing tagging operations.
>>>> ---
>>>>
>>>> Jani suggested something like this on irc today. This is a first cut
>>>> to see if people like it. By default the tagging jump menu is bound to
>>>> k (which works in search/show/tree mode), and has the following options
>>>>
>>>> a (Archive) -inbox -unread
>>>> u (Mark Read) -unread
>>>> d (Delete) +deleted
>>>>
>>>> If you do ctrl-u k the it will do the reverse operation.
>>>
>>> I know C-u is default emacs behaviour but I find very cumbersone to do
>>> C-u for unapplying the tag. What I do and want is to simply apply the
>>> tag when pressing "d" then unapply it when pressing "d" again if the
>>> mail/thread already contains the deleted tag (basically it's a toggle).
>>
>> I agree that C-u is a little cumbersome -- I think I would be happy for
>> a toggle for single messages (with a single tag change), but for
>> multiple messages like a thread I think it would be very unclear what it
>> was doing.
>
> My workflow with the kind of code shown above is as follows:
>
> If in notmuch-search then pressing 'd' "deletes" everything selected,
> including multiple messages in a region and if a thread was selected in
> that region then the entire thread is deleted.
You are not addressing the toggle case where some of the messages in
those threads have the tag, and some do not. How should notmuch know
whether you want to add or remove the deleted tag?
> IMO this is the simplest and the clearest workflow.
While working on Notmuch, one of the main lessons I've learned is that
*everyone* has their own, personal email workflow. We need to try to
give people discoverable and intuitive *mechanisms* on dealing with
email, and let people build their own workflows that suit them.
(That said, I always try to encourage people to rethink their workflows
when switching to Notmuch. But it's still *their* workflow.)
BR,
Jani.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 15:53 ` Jani Nikula
@ 2016-09-18 16:45 ` Ioan-Adrian Ratiu
0 siblings, 0 replies; 12+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-09-18 16:45 UTC (permalink / raw)
To: Jani Nikula, Mark Walters, notmuch
On Sun, 18 Sep 2016, Jani Nikula <jani@nikula.org> wrote:
> On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
>> On Sun, 18 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>>> On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
>>>> Hi
>>>>
>>>> I have implemented something similar in my tree and I really like the
>>>> idea. I have one issue though.
>>>>
>>>> On Sat, 17 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>>>>> Add a "jump" style menu for doing tagging operations.
>>>>> ---
>>>>>
>>>>> Jani suggested something like this on irc today. This is a first cut
>>>>> to see if people like it. By default the tagging jump menu is bound to
>>>>> k (which works in search/show/tree mode), and has the following options
>>>>>
>>>>> a (Archive) -inbox -unread
>>>>> u (Mark Read) -unread
>>>>> d (Delete) +deleted
>>>>>
>>>>> If you do ctrl-u k the it will do the reverse operation.
>>>>
>>>> I know C-u is default emacs behaviour but I find very cumbersone to do
>>>> C-u for unapplying the tag. What I do and want is to simply apply the
>>>> tag when pressing "d" then unapply it when pressing "d" again if the
>>>> mail/thread already contains the deleted tag (basically it's a toggle).
>>>
>>> I agree that C-u is a little cumbersome -- I think I would be happy for
>>> a toggle for single messages (with a single tag change), but for
>>> multiple messages like a thread I think it would be very unclear what it
>>> was doing.
>>
>> My workflow with the kind of code shown above is as follows:
>>
>> If in notmuch-search then pressing 'd' "deletes" everything selected,
>> including multiple messages in a region and if a thread was selected in
>> that region then the entire thread is deleted.
>
> You are not addressing the toggle case where some of the messages in
> those threads have the tag, and some do not. How should notmuch know
> whether you want to add or remove the deleted tag?
In my usecase when I toggle a tag to a thread in notmuch-search, it is
applied to all mails, obviously, and if I want to do per-mail tagging I
go into notmuch-show. To answer your question I'll give an example:
Suppose I have just some subset of a thread's mails tagged "+inbox" and
I toggle pressing "i", then all the mails in that thread are marked
"+inbox" and if I toggle again all are "-inbox". So removing a tag for a
subset of the thread's mails is just a matter of toggling twice.
I can always go in notmuch-show and do per-email tagging using toggles,
say after I removed the "inbox" tag in the example above by toggling
twice, I open the thread in notmuch-show and press "i" to toggle the tag
back on any specific email.
I'm using this for some time and it works really well :)
>
>> IMO this is the simplest and the clearest workflow.
>
> While working on Notmuch, one of the main lessons I've learned is that
> *everyone* has their own, personal email workflow. We need to try to
> give people discoverable and intuitive *mechanisms* on dealing with
> email, and let people build their own workflows that suit them.
Yes, I agree that it's better to provide mechanism than policy because
workflows are so different. Tag toggling is just another mechanism, it
can be customized, for example, when you toggle on a thread of which
some mails already are tagged, should it add or remove that tag? This
can be configured through a variable.
>
> (That said, I always try to encourage people to rethink their workflows
> when switching to Notmuch. But it's still *their* workflow.)
>
>
> BR,
> Jani.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 13:31 ` David Bremner
@ 2016-09-20 3:04 ` Matt Armstrong
0 siblings, 0 replies; 12+ messages in thread
From: Matt Armstrong @ 2016-09-20 3:04 UTC (permalink / raw)
To: David Bremner, Mark Walters, notmuch
David Bremner <david@tethera.net> writes:
> Mark Walters <markwalters1009@gmail.com> writes:
>
> If we think about the operation as reverse rather than undo
I'd be happy without undo/reverse in the first version of this feature.
I have a few key bindings I've set up and I have not bothered to set up
"reverse/undo" for them.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] emacs: add tag jump menu
2016-09-18 7:00 ` Ioan-Adrian Ratiu
2016-09-18 9:08 ` Mark Walters
@ 2016-09-20 17:28 ` Amadeusz Żołnowski
1 sibling, 0 replies; 12+ messages in thread
From: Amadeusz Żołnowski @ 2016-09-20 17:28 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 759 bytes --]
Ioan-Adrian Ratiu <adi@adirat.com> writes:
> I know C-u is default emacs behaviour but I find very cumbersone to do
> C-u for unapplying the tag. What I do and want is to simply apply the
> tag when pressing "d" then unapply it when pressing "d" again if the
> mail/thread already contains the deleted tag (basically it's a
> toggle).
I haven't completely follow discussion about this. Maybe someone has
already mentioned that:
The most important thing is to preserve consistency in Emacs UI: 'a'
archives messages and pressing it again on archived message doesn't
unarchive it. The behaviour shouldn't be different for tag jump menu.
PS. Mark, I have tested your patch. I hope you can make it into 0.23!
Cheers,
-- Amadeusz Żołnowski
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 948 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-09-20 17:28 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-17 21:09 [PATCH] emacs: add tag jump menu Mark Walters
2016-09-18 7:00 ` Ioan-Adrian Ratiu
2016-09-18 9:08 ` Mark Walters
2016-09-18 12:13 ` David Bremner
2016-09-18 15:43 ` Jani Nikula
2016-09-18 14:30 ` Ioan-Adrian Ratiu
2016-09-18 15:53 ` Jani Nikula
2016-09-18 16:45 ` Ioan-Adrian Ratiu
2016-09-20 17:28 ` Amadeusz Żołnowski
2016-09-18 13:31 ` David Bremner
2016-09-20 3:04 ` Matt Armstrong
2016-09-18 14:06 ` Amadeusz Żołnowski
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).