unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: fcc-insert: mark read when inserting
@ 2016-10-03 18:30 Mark Walters
  2016-10-04  1:32 ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Walters @ 2016-10-03 18:30 UTC (permalink / raw)
  To: notmuch

Apply the mark read tags when inserting. These can be overridden by
the user specified tags on the fcc line.

The full ordering is

1) the normal "new" tags applied according to notmuch-config
2) the tags in notmuch-show-mark-read
3) any user tags on the fcc line
---

On irc amdragon suggested that we should not add the unread tag to
sent messages fcc'd by notmuch insert. This does this. The slight
complication is that the unread tag (or more accurately the tag change
to apply when a message is read) is customisable. Thus we apply the
tag change to the inserted message. This can be over-ridden by the
user (eg specifying "+unread" on the fcc line).

We could apply the archive tags at the same time but that seemed more
controversial, so is not done here.

Note this is not heavily tested, but seems to work.

Best wishes

Mark


emacs/notmuch-maildir-fcc.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 95e5650..8d444d9 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -27,6 +27,9 @@
 
 (require 'notmuch-lib)
 
+;; The following variable is defined in notmuch-show
+(defvar notmuch-show-mark-read-tags)
+
 (defvar notmuch-maildir-fcc-count 0)
 
 (defcustom notmuch-fcc-dirs "sent"
@@ -230,11 +233,13 @@ should be a list of tag changes to apply to the inserted message."
 The fcc-header should be of the form \"folder +tag1 -tag2\" where
 folder is the folder (relative to the notmuch mailstore) to store
 the message in, and tag1 and tag2 are tag changes to apply to the
-stored message. If CREATE is non-nil then create the folder if
-necessary."
+stored message. These tag changes are applied after both the
+normal notmuch insert tag changes, and the tag changes in
+`notmuch-show-mark-read-tags' are applied.  If CREATE is non-nil
+then create the folder if necessary."
   (let* ((args (split-string-and-unquote fcc-header))
 	 (folder (car args))
-	 (tags (cdr args)))
+	 (tags (append notmuch-show-mark-read-tags (cdr args))))
     (condition-case nil
 	(notmuch-maildir-notmuch-insert-current-buffer folder create tags)
       ;; Since there are many reasons notmuch insert could fail, e.g.,
-- 
2.1.4

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

* Re: [PATCH] emacs: fcc-insert: mark read when inserting
  2016-10-03 18:30 [PATCH] emacs: fcc-insert: mark read when inserting Mark Walters
@ 2016-10-04  1:32 ` David Bremner
  2016-10-04 10:57   ` Mark Walters
  0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2016-10-04  1:32 UTC (permalink / raw)
  To: Mark Walters, notmuch

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

Mark Walters <markwalters1009@gmail.com> writes:

> Apply the mark read tags when inserting. These can be overridden by
> the user specified tags on the fcc line.
>
> The full ordering is
>
> 1) the normal "new" tags applied according to notmuch-config
> 2) the tags in notmuch-show-mark-read
> 3) any user tags on the fcc line

Hi Mark;

This might be the right UI in the end, but I feel like there are some
issues here that need more discussion, in particular the fact that the
full set of tag changes are not shown on the fcc line.  I can see that
might be the only practical thing to do, but I'm not quite confident
enough to push it in to 0.23.

d

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

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

* Re: [PATCH] emacs: fcc-insert: mark read when inserting
  2016-10-04  1:32 ` David Bremner
@ 2016-10-04 10:57   ` Mark Walters
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Walters @ 2016-10-04 10:57 UTC (permalink / raw)
  To: David Bremner, notmuch


On Tue, 04 Oct 2016, David Bremner <david@tethera.net> wrote:
> Mark Walters <markwalters1009@gmail.com> writes:
>
>> Apply the mark read tags when inserting. These can be overridden by
>> the user specified tags on the fcc line.
>>
>> The full ordering is
>>
>> 1) the normal "new" tags applied according to notmuch-config
>> 2) the tags in notmuch-show-mark-read
>> 3) any user tags on the fcc line
>
> Hi Mark;
>
> This might be the right UI in the end, but I feel like there are some
> issues here that need more discussion, in particular the fact that the
> full set of tag changes are not shown on the fcc line.  I can see that
> might be the only practical thing to do, but I'm not quite confident
> enough to push it in to 0.23.

Yes I agree. I think the best thing might be to add something to cli
notmuch-insert to tell it not to add the tags from notmuch-config. Then
the tags added to the sent message would be exactly the ones in the fcc
header.

Best wishes

Mark

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

end of thread, other threads:[~2016-10-04 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-03 18:30 [PATCH] emacs: fcc-insert: mark read when inserting Mark Walters
2016-10-04  1:32 ` David Bremner
2016-10-04 10:57   ` 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).