[PATCH v2 4/6] emacs: add support for custom tag changes on message/thread archive

2012-09-06 Thread Jani Nikula
Add support for customization of the tag changes that are applied when
a message or a thread is archived. Instead of hard-coded removal of
the "inbox" tag, the user can now specify a list of tag changes to
perform.
---
 emacs/notmuch-lib.el  |   14 ++
 emacs/notmuch-show.el |   29 +
 emacs/notmuch.el  |   12 ++--
 3 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 900235b..20d990d 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -82,6 +82,20 @@
   :type '(alist :key-type string :value-type string)
   :group 'notmuch-hello)

+(defcustom notmuch-archive-tags '("-inbox")
+  "List of tag changes to apply to a message or a thread when it is archived.
+
+Tags starting with \"+\" (or not starting with either \"+\" or
+\"-\") in the list will be added, and tags starting with \"-\"
+will be removed from the message or thread being archived.
+
+For example, if you wanted to remove an \"inbox\" tag and add an
+\"archived\" tag, you would set:
+(\"-inbox\" \"+archived\")"
+  :type '(repeat string)
+  :group 'notmuch-search
+  :group 'notmuch-show)
+
 (defvar notmuch-folders nil
   "Deprecated name for what is now known as `notmuch-saved-searches'.")

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ce5ea6f..e701aec 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1748,18 +1748,20 @@ argument, hide all of the messages."
 (defun notmuch-show-archive-thread ( unarchive)
   "Archive each message in thread.

-Archive each message currently shown by removing the \"inbox\"
-tag from each.  If a prefix argument is given, the messages will
-be \"unarchived\" (ie. the \"inbox\" tag will be added instead of
-removed).
+Archive each message currently shown by applying the tag changes
+in `notmuch-archive-tags' to each (remove the \"inbox\" tag by
+default). If a prefix argument is given, the messages will be
+\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'
+will be reversed.

 Note: This command is safe from any race condition of new messages
 being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer."
   (interactive "P")
-  (let ((op (if unarchive "+" "-")))
-(notmuch-show-tag-all (concat op "inbox"
+  (when notmuch-archive-tags
+(notmuch-show-tag-all
+ (notmuch-tag-change-list notmuch-archive-tags unarchive

 (defun notmuch-show-archive-thread-then-next ()
   "Archive all messages in the current buffer, then show next thread from 
search."
@@ -1774,14 +1776,17 @@ buffer."
   (notmuch-show-next-thread))

 (defun notmuch-show-archive-message ( unarchive)
-  "Archive the current message (remove \"inbox\" tag).
+  "Archive the current message.

-If a prefix argument is given, the message will be
-\"unarchived\" (ie. the \"inbox\" tag will be added instead of
-removed)."
+Archive the current message by applying the tag changes in
+`notmuch-archive-tags' to it (remove the \"inbox\" tag by
+default). If a prefix argument is given, the message will be
+\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'
+will be reversed."
   (interactive "P")
-  (let ((op (if unarchive "+" "-")))
-(notmuch-show-tag-message (concat op "inbox"
+  (when notmuch-archive-tags
+(apply 'notmuch-show-tag-message
+  (notmuch-tag-change-list notmuch-archive-tags unarchive

 (defun notmuch-show-archive-message-then-next-or-exit ()
   "Archive the current message, then show the next open message in the current 
thread.
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 1c43d3e..64caa3e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -594,11 +594,19 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES."
   (notmuch-search-tag "-"))

 (defun notmuch-search-archive-thread ()
-  "Archive the currently selected thread (remove its \"inbox\" tag).
+  "Archive the currently selected thread.
+
+Archive each message in the currently selected thread by applying
+the tag changes in `notmuch-archive-tags' to each (remove the
+\"inbox\" tag by default). If a prefix argument is given, the
+messages will be \"unarchived\" (i.e. the tag changes in
+`notmuch-archive-tags' will be reversed).

 This function advances the next thread when finished."
   (interactive)
-  (notmuch-search-tag '("-inbox"))
+  (when notmuch-archive-tags
+(notmuch-search-tag
+ (notmuch-tag-change-list notmuch-archive-tags)))
   (notmuch-search-next-thread))

 (defun notmuch-search-update-result (result  pos)
-- 
1.7.9.5



[PATCH v2 3/6] emacs: use new tag change helper to mark messages as replied

2012-09-06 Thread Jani Nikula
Clarify documentation while at it.
---
 emacs/notmuch-message.el |   24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
index 3798046..4dc4883 100644
--- a/emacs/notmuch-message.el
+++ b/emacs/notmuch-message.el
@@ -23,14 +23,16 @@
 (require 'notmuch-tag)
 (require 'notmuch-mua)

-(defcustom notmuch-message-replied-tags '("replied")
-  "Tags to be automatically added to or removed from a message when it is 
replied to.
-Any tag in the list will be added to a replied message or,
-if it is prefaced with a \"-\", removed.
+(defcustom notmuch-message-replied-tags '("+replied")
+  "List of tag changes to apply to a message when it has been replied to.
+
+Tags starting with \"+\" (or not starting with either \"+\" or
+\"-\") in the list will be added, and tags starting with \"-\"
+will be removed from the message being replied to.

 For example, if you wanted to add a \"replied\" tag and remove
-the \"inbox\" and \"todo\", you would set
-(\"replied\" \"-inbox\" \"-todo\"\)"
+the \"inbox\" and \"todo\" tags, you would set:
+(\"+replied\" \"-inbox\" \"-todo\"\)"
   :type '(repeat string)
   :group 'notmuch-send)

@@ -38,14 +40,8 @@ the \"inbox\" and \"todo\", you would set
   ;; get the in-reply-to header and parse it for the message id.
   (let ((rep (mail-header-parse-addresses (message-field-value 
"In-Reply-To"
 (when (and notmuch-message-replied-tags rep)
-  ;; add a "+" to any tag that is doesn't already begin with a "+"
-  ;; or "-"
-  (let ((tags (mapcar (lambda (str)
-   (if (not (string-match "^[+-]" str))
-   (concat "+" str)
- str))
- notmuch-message-replied-tags)))
-   (funcall 'notmuch-tag (notmuch-id-to-query (car (car rep))) tags)
+  (funcall 'notmuch-tag (notmuch-id-to-query (car (car rep)))
+  (notmuch-tag-change-list notmuch-message-replied-tags)

 (add-hook 'message-send-hook 'notmuch-message-mark-replied)

-- 
1.7.9.5



[PATCH v2 2/6] emacs: fix notmuch-message-replied-tags defcustom type

2012-09-06 Thread Jani Nikula
---
 emacs/notmuch-message.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
index d3738bf..3798046 100644
--- a/emacs/notmuch-message.el
+++ b/emacs/notmuch-message.el
@@ -31,7 +31,7 @@ if it is prefaced with a \"-\", removed.
 For example, if you wanted to add a \"replied\" tag and remove
 the \"inbox\" and \"todo\", you would set
 (\"replied\" \"-inbox\" \"-todo\"\)"
-  :type 'list
+  :type '(repeat string)
   :group 'notmuch-send)

 (defun notmuch-message-mark-replied ()
-- 
1.7.9.5



[PATCH v2 1/6] emacs: add helper for tag change list manipulation

2012-09-06 Thread Jani Nikula
Add a helper to create (and optionally reverse) a list of tag changes.
---
 emacs/notmuch-tag.el |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 0c0fc87..4fce3a9 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -140,6 +140,21 @@ notmuch-after-tag-hook will be run."
   ;; in all cases we return tag-changes as a list
   tag-changes)

+(defun notmuch-tag-change-list (tags  reverse)
+  "Convert TAGS into a list of tag changes.
+
+Add a \"+\" prefix to any tag in TAGS list that doesn't already
+begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
+\"+\" prefixes with \"-\" and vice versa in the result."
+  (mapcar (lambda (str)
+   (let ((s (if (string-match "^[+-]" str) str (concat "+" str
+ (if reverse
+ (concat (if (= (string-to-char s) ?-) "+" "-")
+ (substring s 1))
+   s)))
+ tags))
+
+
 ;;

 (provide 'notmuch-tag)
-- 
1.7.9.5



[PATCH v2 0/6] emacs: customization for tag changes on archive

2012-09-06 Thread Jani Nikula
Hi all, this is v2 of [1], the only change being Michal's suggestion [2] for
patch 1/6.

[1] id:"cover.1346614915.git.jani at nikula.org"
[2] id:"xa1tipbvwdb0.fsf at mina86.com"

BR,
Jani.


Jani Nikula (6):
  emacs: add helper for tag change list manipulation
  emacs: fix notmuch-message-replied-tags defcustom type
  emacs: use new tag change helper to mark messages as replied
  emacs: add support for custom tag changes on message/thread archive
  emacs: add support for reversing notmuch-search-archive-thread tag
changes
  emacs: add support for reversing notmuch-show-mark-read tag changes

 emacs/notmuch-lib.el |   14 
 emacs/notmuch-message.el |   26 ++
 emacs/notmuch-show.el|   54 +++---
 emacs/notmuch-tag.el |   15 +
 emacs/notmuch.el |   16 ++
 5 files changed, 89 insertions(+), 36 deletions(-)

-- 
1.7.9.5



[PATCH v2 0/5] emacs: notmuch-hello status message refresh hook, etc

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka wrote:

> On Tue, Sep 04 2012, Jani Nikula wrote:
>> On Tue, 04 Sep 2012, Michal Sojka  wrote:
>>> On Sun, Sep 02 2012, Jani Nikula wrote:
 Hi all, v2 of [1] addressing review comments: added NEWS, improved
 documentation, made the query customizable.

 [1]
 id:"37899e28dbf67e4620a53279a869be3174c02d6f.1339775602.git.jani at 
 nikula.org"
>>>
>>> Hello Jani,
>>>
>>> if I understand correctly, the goal of this patchset is to display the
>>> message with the difference in the number of messages before and after
>>> refresh of notmuch-hello.
>>
>> Difference between two refreshes of notmuch-hello to be specific.
>>
>>> I think the current implementation is unnecessarily complicated. It
>>> would be sufficient to implement this directly in `notmuch-hello'
>>> without any hook. If `notmuch-hello-refresh-status-query' is nil
>>> (default) no message would be shown. If it is configured to something
>>> else, the message would be shown provided that no-display is nil. This
>>> way you don't have to break existing user's hooks and achieve the same
>>> behavior, don't you?
>>
>> I think it would be useful to pass no-display to hooks anyway,
>> regardless of the use here.
>
> I'm strongly against breaking existing user's setups without a good
> reason. The meaning of no-display parameter, as I understand it, is only
> to tells whether the refresh should happen in background or foreground.
> Isn't there any other method for hooks to check for this conditions? For
> example something like checking whether notmuch-hello buffer is shown in
> a window of the active frame? Or a simple (perhaps buffer-local)
> variable can contain this information.

I mentioned using no-display from dynamic scope -- which isn't very
good solution in a long run. Lately I've been leaning to Jani's suggestion
by just calling refresh-hook with no-display arg But if there is
well-established way to provide this information to hooks without
adding this argument in the hook call then that could be used..

> I don't know what people use notmuch-hello-refresh-hook for. I suppose
> that your use case (displaying a message outside of hello buffer) is
> rather an exception than a typical use.

In any case, I think the refresh-hook needs to know this no-display
information, somehow. If there is no other good way than giving it
as an argument to the hook then that should be done (by pushing patches
1-3).

>> I don't see that as a big reason to do this one way or the other.
>> Having this implemented directly in notmuch-hello does not make this
>> less complicated either.
>
> That's true, but it would be simpler for users to set it up. With your
> patches, users would have to configure the variable (query) as well as
> the hook. I propose to have only one place to configure this feature.

I've been thinking that Jani's way to provide the information to minibuffer
is a bit better than provide it in hello buffer -- as I think there is a
small "imperfection" that may irritate users: The default '*' is in use.
The hello buffer is refreshed (via emacsclient or something?) with
no-display t -- message count changes but the reference count
(notmuch-hello-refresh-count) keeps the same. Next time the hello buffer is
visible, showing current message count -- and user refreshes it.  In most
cases message count change in hello buffer is different that what will be
shown in minibuffer.

Now, If this "imperfection" reason enough to have this feature available
from wiki/contrib. 

If not, then the decision between hook/part of notmuch-hello is to be done:

1) If hook, then one less if's to be used -- and customization useful for
those who don't (add-hook...) more hooks there.

2) If somewhere in notmuch-hello processing then this "query-variable"
(named appropriately) can be used to check whether this feature is in 
use; if nil then not, otherwise it contains the query variable to be used
in (notmuch-command "count" ...) call.

> -Michal

Tomi


[PATCH 1/6] emacs: add helper for tag change list manipulation

2012-09-06 Thread Tomi Ollila
On Mon, Sep 03 2012, Jani Nikula wrote:

> On Mon, 03 Sep 2012, Michal Nazarewicz  wrote:
>> Jani Nikula  writes:
>>> Add a helper to create (and optionally reverse) a list of tag changes.
>>> ---
>>>  emacs/notmuch-tag.el |   17 +
>>>  1 file changed, 17 insertions(+)
>>>
>>> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
>>> index 0c0fc87..c1aeb99 100644
>>> --- a/emacs/notmuch-tag.el
>>> +++ b/emacs/notmuch-tag.el
>>> @@ -140,6 +140,23 @@ notmuch-after-tag-hook will be run."
>>>;; in all cases we return tag-changes as a list
>>>tag-changes)
>>>  
>>> +(defun notmuch-tag-change-list (tags  reverse)
>>> +  "Convert TAGS into a list of tag changes.
>>> +
>>> +Add a \"+\" prefix to any tag in TAGS list that doesn't already
>>> +begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all
>>> +\"+\" prefixes with \"-\" and vice versa in the result."
>>> +  (mapcar (lambda (str)
>>> +   (let ((s (if (not (string-match "^[+-]" str))
>>> +(concat "+" str)
>>> +  str)))
>>
>> (if (string-match "^[-+]" str) str (concat "+" str))
>>
>> Negation only makes things less readable IMO.
>
> Agreed.

The whole series LGTM -- but are you still going to do 
changes here ?

> Jani.

Tomi


>
>>
>>> + (if reverse
>>> + (concat (if (= (string-to-char s) ?-) "+" "-")
>>> + (substring s 1))
>>> +   s)))
>>> + tags))
>>> +
>>> +
>>>  ;;
>>>  
>>>  (provide 'notmuch-tag)
>>
>> -- 
>> Best regards, _ _
>> .o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
>> ..o | Computer Science,  Micha? ?mina86? Nazarewicz(o o)
>> ooo +--ooO--(_)--Ooo--


[PATCH] notmuch-show: include Bcc header in json output

2012-09-06 Thread Michal Nazarewicz
From: Michal Nazarewicz 

---
 notmuch-show.c   |7 +++
 test/json|8 
 test/test-lib.sh |5 +
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 3556293..0b7abf1 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -233,6 +233,13 @@ format_headers_json (sprinter_t *sp, GMimeMessage *message,
sp->string (sp, recipients_string);
 }

+recipients = g_mime_message_get_recipients (message, 
GMIME_RECIPIENT_TYPE_BCC);
+recipients_string = internet_address_list_to_string (recipients, 0);
+if (recipients_string) {
+   sp->map_key (sp, "Bcc");
+   sp->string (sp, recipients_string);
+}
+
 if (reply) {
sp->map_key (sp, "In-reply-to");
sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), 
"In-reply-to"));
diff --git a/test/json b/test/json
index ac8fa8e..40d0ba3 100755
--- a/test/json
+++ b/test/json
@@ -3,18 +3,18 @@ test_description="--format=json output"
 . ./test-lib.sh

 test_begin_subtest "Show message: json"
-add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"json-show-message\""
+add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[bcc]=\"test_suite+bcc at notmuchmail.org\"" 
"[body]=\"json-show-message\""
 output=$(notmuch show --format=json "json-show-message")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": 
true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", 
\"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": 
[\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", 
\"From\": \"Notmuch Test Suite \", \"To\": 
\"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 
2000 12:00:00 +\"}, \"body\": [{\"id\": 1, \"content-type\": 
\"text/plain\", \"content\": \"json-show-message\n\"}]}, ["
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": 
true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", 
\"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": 
[\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", 
\"From\": \"Notmuch Test Suite \", \"To\": 
\"Notmuch Test Suite \", \"Bcc\": 
\"test_suite+bcc at notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 
+\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": 
\"json-show-message\n\"}]}, ["

 # This should be the same output as above.
 test_begin_subtest "Show message: json --body=true"
 output=$(notmuch show --format=json --body=true "json-show-message")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": 
true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", 
\"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": 
[\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", 
\"From\": \"Notmuch Test Suite \", \"To\": 
\"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 
2000 12:00:00 +\"}, \"body\": [{\"id\": 1, \"content-type\": 
\"text/plain\", \"content\": \"json-show-message\n\"}]}, ["
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": 
true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", 
\"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": 
[\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", 
\"From\": \"Notmuch Test Suite \", \"To\": 
\"Notmuch Test Suite \", \"Bcc\": 
\"test_suite+bcc at notmuchmail.org\",\"Date\": \"Sat, 01 Jan 2000 12:00:00 
+\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": 
\"json-show-message\n\"}]}, ["

 test_begin_subtest "Show message: json --body=false"
 output=$(notmuch show --format=json --body=false "json-show-message")
-test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": 
true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", 
\"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": 
[\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", 
\"From\": \"Notmuch Test Suite \", \"To\": 
\"Notmuch Test Suite \", \"Date\": \"Sat, 01 Jan 
2000 12:00:00 +\"}}, ["
+test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": 
true, \"excluded\": false, \"filename\": \"${gen_msg_filename}\", 
\"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": 
[\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", 
\"From\": \"Notmuch Test Suite \", \"To\": 
\"Notmuch Test Suite \", \"Bcc\": 
\"test_suite+bcc at notmuchmail.org\",\"Date\": \"Sat, 01 Jan 2000 12:00:00 
+\"}}, ["

 test_begin_subtest "Search message: json"
 add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 
12:00:00 -\"" "[body]=\"json-search-message\""
diff --git a/test/test-lib.sh 

[PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka  wrote:

>> So far good, but...
>>
>> You forgot to handle the current group setting for 
>> notmuch-message-replied-tags -- currently notmuch-message.el has this:
>>
>> (defcustom notmuch-message-replied-tags '("replied")
>>   "Tags to be automatically added to or removed from a message when it is
>>   replied to.
>> Any tag in the list will be added to a replied message or,
>> if it is prefaced with a \"-\", removed.
>>
>> For example, if you wanted to add a \"replied\" tag and remove
>> the \"inbox\" and \"todo\", you would set
>> (\"replied\" \"-inbox\" \"-todo\"\)"
>>   :type 'list
>>   :group 'notmuch-send)
>>
>> If the above was changed to 'normuch-send, (require 'notmuch-lib)
>> was added to the beginning of notmuch-message.el and the defgroup
>> below was written as
>>
>> (defgroup notmuch-reply
>>   '((message-insertion custom-group)))
>>"Replying to messages.
>> ...
>>
>> would that work as expected ?
>
> Hi Tomi,
>
> I don't really get what are you trying to say. Do you mean that
> notmuch-message-replied-tags is referenced from notmuch-lib.el without
> (require 'notmuch-message)? I'm not sure whether it is required, but it
> works here without problems.

Ok, some sillines in my part and something I did not check well
enough before replying...

First, notmuch-lib.el defines notmuch-send group, yet 
(defcustom notmuch-message-replied-tags ...) is defined 
in notmuch-message.el which is not requiring notmuch-lib...
and all of this works now...

Actually, notmuch-lib.el defines all defgroups (except coolj).

Then, I found the following: notmuch-mua-send-hook is defined 
both in notmuch-hooks and notmuch-send groups (having a precedent
helps a bit there when choosing alternatives below)


All the defgroups are defined using pattern:

(defgroup notmuch- nil ...)

We should follow this pattern unless there is good reason not to 
do so here: notmuch-send is written as:

  (defgroup notmuch-send nil
"Sending messages from Notmuch."
:group 'notmuch)

  (custom-add-to-group 'notmuch-send 'message 'custom-group)

But, as the documentation in this notmuch-reply definition references
'Message insertion' group, doing

  (defgroup notmuch-reply 
'((message-insertion custom-group))'
"Replying to messages.

  Most of the reply customization settings can be found in `Message
  insertion' group. Notmuch specific settings are included directly
  here."
  :group 'notmuch)

could be good thing to do here; definition matches doc from the beginning
(just not adding any of the custom variables, yet).


Now, currently notmuch-message.el defines notmuch-message-replied-tags
and puts that to :group 'notmuch-send

There are 2 alternatives:

1) change that to :group 'notmuch-reply

2) add (custom-add-to-group 'notmuch-reply 'notmuch-message-replied-tags 
'custom-variable)
   to notmuch-message.el (or notmuch-lib.el)

2b) change :group 'notmuch-send -> :group 'notmuch-reply and
   add (custom-add-to-group 'notmuch-send 'notmuch-message-replied-tags 
'custom-variable)
   to notmuch-message.el (or notmuch-lib.el)


I personally would slightly lean to option 1 but if 2 gets more 
supporters then 2b (so that the spesific group is in the group definition).

On other words; 1 or 2b gets LGTM from me :)

Understood ? :D


Tomi


> Running M-x customize-variable RET notmuch-message-replied-tags RET
> shows the following. Note that both groups are mentioned at the bottom.
> No warning or errors are produced.

Yes, I tested that missing group-thing with:

(defgroup foo '((bar-group custom-group)) "test")

It seems the nonexisting bar-group is created on-the-fly (but
exist temporarily). No warnings nor errors :).

>
> -Michal

Tomi

>
> --8<---cut here---start->8---
> To apply changes, use the Save or Set buttons.
> For details, see Saving Customizations in the Emacs manual.
>
>   Search 
>
>  Operate on all settings in this buffer:
>   Set for current session   Save for future sessions 
>   Undo edits   Reset to saved   Erase customizations Exit 
>
> Hide notmuch-message-replied-tags: '("replied")
> State : STANDARD. (mismatch)
>Tags to be automatically added to or removed from a message when it is 
> replied to. Hide   
>Any tag in the list will be added to a replied message or,
>if it is prefaced with a "-", removed.
>
>For example, if you wanted to add a "replied" tag and remove
>the "inbox" and "todo", you would set
>("replied" "-inbox" "-todo")
> Groups: Notmuch Send Notmuch Reply
> --8<---cut here---end--->8---


[PATCH] notmuch-show: include Bcc header in json output

2012-09-06 Thread Michal Sojka
On Wed, Sep 05 2012, Michal Nazarewicz wrote:
> From: Michal Nazarewicz 
>
> ---
>  notmuch-show.c |7 +++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> Actually, I don't understand why json does not include all the
> headers...

Hi,

I tested this and haven't found any problems. You may want to add a test
for this feature.

Thanks,
-Michal


[PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Michal Sojka
On Thu, Sep 06 2012, Tomi Ollila wrote:
> On Thu, Sep 06 2012, Michal Sojka  wrote:
>
>>> So far good, but...
>>>
>>> You forgot to handle the current group setting for 
>>> notmuch-message-replied-tags -- currently notmuch-message.el has this:
>>>
>>> (defcustom notmuch-message-replied-tags '("replied")
>>>   "Tags to be automatically added to or removed from a message when it is
>>>   replied to.
>>> Any tag in the list will be added to a replied message or,
>>> if it is prefaced with a \"-\", removed.
>>>
>>> For example, if you wanted to add a \"replied\" tag and remove
>>> the \"inbox\" and \"todo\", you would set
>>> (\"replied\" \"-inbox\" \"-todo\"\)"
>>>   :type 'list
>>>   :group 'notmuch-send)
>>>
>>> If the above was changed to 'normuch-send, (require 'notmuch-lib)
>>> was added to the beginning of notmuch-message.el and the defgroup
>>> below was written as
>>>
>>> (defgroup notmuch-reply
>>>   '((message-insertion custom-group)))
>>>"Replying to messages.
>>> ...
>>>
>>> would that work as expected ?
>>
>> Hi Tomi,
>>
>> I don't really get what are you trying to say. Do you mean that
>> notmuch-message-replied-tags is referenced from notmuch-lib.el without
>> (require 'notmuch-message)? I'm not sure whether it is required, but it
>> works here without problems.
>
> Ok, some sillines in my part and something I did not check well
> enough before replying...
>
> First, notmuch-lib.el defines notmuch-send group, yet 
> (defcustom notmuch-message-replied-tags ...) is defined 
> in notmuch-message.el which is not requiring notmuch-lib...
> and all of this works now...
>
> Actually, notmuch-lib.el defines all defgroups (except coolj).
>
> Then, I found the following: notmuch-mua-send-hook is defined 
> both in notmuch-hooks and notmuch-send groups (having a precedent
> helps a bit there when choosing alternatives below)
>
>
> All the defgroups are defined using pattern:
>
> (defgroup notmuch- nil ...)
>
> We should follow this pattern unless there is good reason not to 
> do so here: notmuch-send is written as:
>
>   (defgroup notmuch-send nil
> "Sending messages from Notmuch."
> :group 'notmuch)
>
>   (custom-add-to-group 'notmuch-send 'message 'custom-group)
>
> But, as the documentation in this notmuch-reply definition references
> 'Message insertion' group, doing
>
>   (defgroup notmuch-reply 
> '((message-insertion custom-group))'
> "Replying to messages.
>
>   Most of the reply customization settings can be found in `Message
>   insertion' group. Notmuch specific settings are included directly
>   here."
>   :group 'notmuch)
>
> could be good thing to do here; definition matches doc from the beginning
> (just not adding any of the custom variables, yet).
>
>
> Now, currently notmuch-message.el defines notmuch-message-replied-tags
> and puts that to :group 'notmuch-send
>
> There are 2 alternatives:
>
> 1) change that to :group 'notmuch-reply

Now I understand. I think that 1) would be a good solution. I'll wait a
bit for other comments and than I'll send a new patch.

-Michal

>
> 2) add (custom-add-to-group 'notmuch-reply 'notmuch-message-replied-tags 
> 'custom-variable)
>to notmuch-message.el (or notmuch-lib.el)
>
> 2b) change :group 'notmuch-send -> :group 'notmuch-reply and
>add (custom-add-to-group 'notmuch-send 'notmuch-message-replied-tags 
> 'custom-variable)
>to notmuch-message.el (or notmuch-lib.el)
>
>
> I personally would slightly lean to option 1 but if 2 gets more 
> supporters then 2b (so that the spesific group is in the group definition).
>
> On other words; 1 or 2b gets LGTM from me :)


[PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Michal Sojka
On Thu, Sep 06 2012, Tomi Ollila wrote:
> On Thu, Sep 06 2012, Michal Sojka  wrote:
>
>> When one wants to customize the format of reply message, there is nothing
>> to tell the user how to do it.  Without knowing that construction of
>> reply buffer is actually implemented in the message package, it seems
>> that replying cannot be customized.
>>
>> Because I was getting annoyed by the empty line the between the citation
>> line and the quoted message, I figured out that changing this is fairly
>> easy when one knows what to customize.
>>
>> This patch adds notmuch-reply customization group that contains
>> references to the relevant customization options. The new group is easy
>> to find as it is shown as a result of running "M-x customize-group RET
>> notmuch RET".
>> ---
>
> So far good, but...
>
> You forgot to handle the current group setting for 
> notmuch-message-replied-tags -- currently notmuch-message.el has this:
>
> (defcustom notmuch-message-replied-tags '("replied")
>   "Tags to be automatically added to or removed from a message when it is
>   replied to.
> Any tag in the list will be added to a replied message or,
> if it is prefaced with a \"-\", removed.
>
> For example, if you wanted to add a \"replied\" tag and remove
> the \"inbox\" and \"todo\", you would set
> (\"replied\" \"-inbox\" \"-todo\"\)"
>   :type 'list
>   :group 'notmuch-send)
>
> If the above was changed to 'normuch-send, (require 'notmuch-lib)
> was added to the beginning of notmuch-message.el and the defgroup
> below was written as
>
> (defgroup notmuch-reply
>   '((message-insertion custom-group)))
>"Replying to messages.
> ...
>
> would that work as expected ?

Hi Tomi,

I don't really get what are you trying to say. Do you mean that
notmuch-message-replied-tags is referenced from notmuch-lib.el without
(require 'notmuch-message)? I'm not sure whether it is required, but it
works here without problems.

Running M-x customize-variable RET notmuch-message-replied-tags RET
shows the following. Note that both groups are mentioned at the bottom.
No warning or errors are produced.

-Michal

--8<---cut here---start->8---
To apply changes, use the Save or Set buttons.
For details, see Saving Customizations in the Emacs manual.

  Search 

 Operate on all settings in this buffer:
  Set for current session   Save for future sessions 
  Undo edits   Reset to saved   Erase customizations Exit 

Hide notmuch-message-replied-tags: '("replied")
State : STANDARD. (mismatch)
   Tags to be automatically added to or removed from a message when it is 
replied to. Hide   
   Any tag in the list will be added to a replied message or,
   if it is prefaced with a "-", removed.

   For example, if you wanted to add a "replied" tag and remove
   the "inbox" and "todo", you would set
   ("replied" "-inbox" "-todo")
Groups: Notmuch Send Notmuch Reply
--8<---cut here---end--->8---



[PATCH] emacs: Add customization group for replying

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka  wrote:

> On Wed, Sep 05 2012, Tomi Ollila wrote:
>>
>> From consistency point of view all the customization variables in notmuch
>> groups start with "notmuch-" and these "message-" breaks this... An
>> alternative to the above could be the following:
>>
>>  (defgroup notmuch-reply
>>'((notmuch-message-replied-tags custom-variable)
>>  (message-insertion custom-group))
>>   "..."
>
> Why not. Updated patch follows...

Ok, next iteration after that is partly my fault ;/

> -Michal

Tomi


[PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka  wrote:

> When one wants to customize the format of reply message, there is nothing
> to tell the user how to do it.  Without knowing that construction of
> reply buffer is actually implemented in the message package, it seems
> that replying cannot be customized.
>
> Because I was getting annoyed by the empty line the between the citation
> line and the quoted message, I figured out that changing this is fairly
> easy when one knows what to customize.
>
> This patch adds notmuch-reply customization group that contains
> references to the relevant customization options. The new group is easy
> to find as it is shown as a result of running "M-x customize-group RET
> notmuch RET".
> ---

So far good, but...

You forgot to handle the current group setting for 
notmuch-message-replied-tags -- currently notmuch-message.el has this:

(defcustom notmuch-message-replied-tags '("replied")
  "Tags to be automatically added to or removed from a message when it is
  replied to.
Any tag in the list will be added to a replied message or,
if it is prefaced with a \"-\", removed.

For example, if you wanted to add a \"replied\" tag and remove
the \"inbox\" and \"todo\", you would set
(\"replied\" \"-inbox\" \"-todo\"\)"
  :type 'list
  :group 'notmuch-send)

If the above was changed to 'normuch-send, (require 'notmuch-lib)
was added to the beginning of notmuch-message.el and the defgroup
below was written as

(defgroup notmuch-reply
  '((message-insertion custom-group)))
   "Replying to messages.
...

would that work as expected ?

Tomi


>  emacs/notmuch-lib.el |   10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 900235b..c045a32 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -45,6 +45,16 @@
>"Showing messages and threads."
>:group 'notmuch)
>  
> +(defgroup notmuch-reply
> +  '((message-insertion custom-group)
> +(notmuch-message-replied-tags custom-variable))
> +  "Replying to messages.
> +
> +Most of the reply customization settings can be found in `Message
> +insertion' group. Notmuch specific settings is included directly
> +here."
> +  :group 'notmuch)
> +
>  (defgroup notmuch-send nil
>"Sending messages from Notmuch."
>:group 'notmuch)
> -- 
> 1.7.10.4
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Michal Sojka
When one wants to customize the format of reply message, there is nothing
to tell the user how to do it.  Without knowing that construction of
reply buffer is actually implemented in the message package, it seems
that replying cannot be customized.

Because I was getting annoyed by the empty line the between the citation
line and the quoted message, I figured out that changing this is fairly
easy when one knows what to customize.

This patch adds notmuch-reply customization group that contains
references to the relevant customization options. The new group is easy
to find as it is shown as a result of running "M-x customize-group RET
notmuch RET".
---
 emacs/notmuch-lib.el |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 900235b..c045a32 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -45,6 +45,16 @@
   "Showing messages and threads."
   :group 'notmuch)

+(defgroup notmuch-reply
+  '((message-insertion custom-group)
+(notmuch-message-replied-tags custom-variable))
+  "Replying to messages.
+
+Most of the reply customization settings can be found in `Message
+insertion' group. Notmuch specific settings is included directly
+here."
+  :group 'notmuch)
+
 (defgroup notmuch-send nil
   "Sending messages from Notmuch."
   :group 'notmuch)
-- 
1.7.10.4



[PATCH] emacs: Add customization group for replying

2012-09-06 Thread Michal Sojka
On Wed, Sep 05 2012, Tomi Ollila wrote:
> On Tue, Sep 04 2012, Michal Sojka  wrote:
>
>> On Tue, Sep 04 2012, Tomi Ollila wrote:
>>> On Tue, Sep 04 2012, Michal Sojka  wrote:
>>>
 On Thu, Jul 26 2012, Michal Sojka wrote:
> When one wants to customize the format of reply message, there nothing
> to tell the user how to do it.  Without knowing that construction of
> reply buffer is actually implemented in the message package, it seems
> that replying cannot be customized.
>
> Because I was getting annoyed by the empty line the between citation
> line and the quoted message, I figured out that changing this is fairly
> easy when one knows what to customize.
>
> This patch adds notmuch-reply customization group that that contains
> references to the relevant customization options. The new group is easy
> to find as it is shown as a result of running "M-x customize-group RET
> notmuch RET".

 Ping.

 Any objections against applying?
>>>
>>> Nobody dares to say anything due to infamiliriaty of this spesific case ;/.
>>>
>>> I could not find any reference this has been made before.
>>
>> It's at least documented at
>> http://www.gnu.org/software/emacs/manual/html_node/elisp/Group-Definitions.html
>>
>>   The argument members is a list specifying an initial set of
>>   customization items to be members of the group. However, most often
>>   members is nil, and you specify the group's members by using the
>>   :group keyword when defining those members.
>>
>>> I could not find any discussion about this issue.
>>>
>>> With little effort I could not extract the customization tree to
>>> stdout I could have attempted to grep whether there is same variable
>>> in many groups.
>>
>> I tried to grep emacs sources and found the following:
>>
>> (defgroup message '((user-mail-address custom-variable)
>> (defgroup gnus-message '((message custom-group))
>> (defgroup ps-print-printer '((lpr custom-group))
>> (defgroup customize '((widgets custom-group))
>> (defgroup font-lock '((jit-lock custom-group))
>>
>> At least the first line corresponds exactly to what is proposed in my
>> patch.
>
> Yes...
>
>
> I was looking whether the same customization variable has been put
> into multiple groups (now those are also in message-insertion group like
> you have in your patch). (So far) I haven't seen that to be done
> (not that it forbids doing so, just that there aren't issues about that).
>
> From consistency point of view all the customization variables in notmuch
> groups start with "notmuch-" and these "message-" breaks this... An
> alternative to the above could be the following:
>
>  (defgroup notmuch-reply
>'((notmuch-message-replied-tags custom-variable)
>  (message-insertion custom-group))
>   "..."

Why not. Updated patch follows...

-Michal


[PATCH] emacs: notmuch-search: fix faces

2012-09-06 Thread Michal Nazarewicz
On Thu, Aug 23 2012, Michal Nazarewicz wrote:
> For some reason the faces do not get applied when 'face property is
> used, but they work correctly with 'font-lock-face property.  This
> commit changes notmuch-search to use the latter.

OK, forget about this.  The problem ?fixed itself? when I upgraded the
package that caused the issue.  Strange thing is that I cannot identify
any change in the package that could cause the problem to disappear.

Oh well, another life mystery.

-- 
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Micha? ?mina86? Nazarewicz(o o)
ooo +--ooO--(_)--Ooo--
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120906/83cb05e8/attachment.pgp>


[PATCH] notmuch-show: include Bcc header in json output

2012-09-06 Thread Michal Nazarewicz
From: Michal Nazarewicz 

---
 notmuch-show.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

Actually, I don't understand why json does not include all the
headers...

diff --git a/notmuch-show.c b/notmuch-show.c
index 3556293..0b7abf1 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -233,6 +233,13 @@ format_headers_json (sprinter_t *sp, GMimeMessage *message,
sp->string (sp, recipients_string);
 }

+recipients = g_mime_message_get_recipients (message, 
GMIME_RECIPIENT_TYPE_BCC);
+recipients_string = internet_address_list_to_string (recipients, 0);
+if (recipients_string) {
+   sp->map_key (sp, "Bcc");
+   sp->string (sp, recipients_string);
+}
+
 if (reply) {
sp->map_key (sp, "In-reply-to");
sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), 
"In-reply-to"));
-- 
1.7.7.3



Re: [PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka sojk...@fel.cvut.cz wrote:

 When one wants to customize the format of reply message, there is nothing
 to tell the user how to do it.  Without knowing that construction of
 reply buffer is actually implemented in the message package, it seems
 that replying cannot be customized.

 Because I was getting annoyed by the empty line the between the citation
 line and the quoted message, I figured out that changing this is fairly
 easy when one knows what to customize.

 This patch adds notmuch-reply customization group that contains
 references to the relevant customization options. The new group is easy
 to find as it is shown as a result of running M-x customize-group RET
 notmuch RET.
 ---

So far good, but...

You forgot to handle the current group setting for 
notmuch-message-replied-tags -- currently notmuch-message.el has this:

(defcustom notmuch-message-replied-tags '(replied)
  Tags to be automatically added to or removed from a message when it is
  replied to.
Any tag in the list will be added to a replied message or,
if it is prefaced with a \-\, removed.

For example, if you wanted to add a \replied\ tag and remove
the \inbox\ and \todo\, you would set
(\replied\ \-inbox\ \-todo\\)
  :type 'list
  :group 'notmuch-send)

If the above was changed to 'normuch-send, (require 'notmuch-lib)
was added to the beginning of notmuch-message.el and the defgroup
below was written as

(defgroup notmuch-reply
  '((message-insertion custom-group)))
   Replying to messages.
...

would that work as expected ?

Tomi


  emacs/notmuch-lib.el |   10 ++
  1 file changed, 10 insertions(+)

 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
 index 900235b..c045a32 100644
 --- a/emacs/notmuch-lib.el
 +++ b/emacs/notmuch-lib.el
 @@ -45,6 +45,16 @@
Showing messages and threads.
:group 'notmuch)
  
 +(defgroup notmuch-reply
 +  '((message-insertion custom-group)
 +(notmuch-message-replied-tags custom-variable))
 +  Replying to messages.
 +
 +Most of the reply customization settings can be found in `Message
 +insertion' group. Notmuch specific settings is included directly
 +here.
 +  :group 'notmuch)
 +
  (defgroup notmuch-send nil
Sending messages from Notmuch.
:group 'notmuch)
 -- 
 1.7.10.4

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add customization group for replying

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka sojk...@fel.cvut.cz wrote:

 On Wed, Sep 05 2012, Tomi Ollila wrote:

 From consistency point of view all the customization variables in notmuch
 groups start with notmuch- and these message- breaks this... An
 alternative to the above could be the following:

  (defgroup notmuch-reply
'((notmuch-message-replied-tags custom-variable)
  (message-insertion custom-group))
   ...

 Why not. Updated patch follows...

Ok, next iteration after that is partly my fault ;/

 -Michal

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Michal Sojka
On Thu, Sep 06 2012, Tomi Ollila wrote:
 On Thu, Sep 06 2012, Michal Sojka sojk...@fel.cvut.cz wrote:

 When one wants to customize the format of reply message, there is nothing
 to tell the user how to do it.  Without knowing that construction of
 reply buffer is actually implemented in the message package, it seems
 that replying cannot be customized.

 Because I was getting annoyed by the empty line the between the citation
 line and the quoted message, I figured out that changing this is fairly
 easy when one knows what to customize.

 This patch adds notmuch-reply customization group that contains
 references to the relevant customization options. The new group is easy
 to find as it is shown as a result of running M-x customize-group RET
 notmuch RET.
 ---

 So far good, but...

 You forgot to handle the current group setting for 
 notmuch-message-replied-tags -- currently notmuch-message.el has this:

 (defcustom notmuch-message-replied-tags '(replied)
   Tags to be automatically added to or removed from a message when it is
   replied to.
 Any tag in the list will be added to a replied message or,
 if it is prefaced with a \-\, removed.

 For example, if you wanted to add a \replied\ tag and remove
 the \inbox\ and \todo\, you would set
 (\replied\ \-inbox\ \-todo\\)
   :type 'list
   :group 'notmuch-send)

 If the above was changed to 'normuch-send, (require 'notmuch-lib)
 was added to the beginning of notmuch-message.el and the defgroup
 below was written as

 (defgroup notmuch-reply
   '((message-insertion custom-group)))
Replying to messages.
 ...

 would that work as expected ?

Hi Tomi,

I don't really get what are you trying to say. Do you mean that
notmuch-message-replied-tags is referenced from notmuch-lib.el without
(require 'notmuch-message)? I'm not sure whether it is required, but it
works here without problems.

Running M-x customize-variable RET notmuch-message-replied-tags RET
shows the following. Note that both groups are mentioned at the bottom.
No warning or errors are produced.

-Michal

--8---cut here---start-8---
To apply changes, use the Save or Set buttons.
For details, see Saving Customizations in the Emacs manual.

  Search 

 Operate on all settings in this buffer:
  Set for current session   Save for future sessions 
  Undo edits   Reset to saved   Erase customizations Exit 

Hide notmuch-message-replied-tags: '(replied)
State : STANDARD. (mismatch)
   Tags to be automatically added to or removed from a message when it is 
replied to. Hide   
   Any tag in the list will be added to a replied message or,
   if it is prefaced with a -, removed.
   
   For example, if you wanted to add a replied tag and remove
   the inbox and todo, you would set
   (replied -inbox -todo)
Groups: Notmuch Send Notmuch Reply
--8---cut here---end---8---

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka sojk...@fel.cvut.cz wrote:

 So far good, but...

 You forgot to handle the current group setting for 
 notmuch-message-replied-tags -- currently notmuch-message.el has this:

 (defcustom notmuch-message-replied-tags '(replied)
   Tags to be automatically added to or removed from a message when it is
   replied to.
 Any tag in the list will be added to a replied message or,
 if it is prefaced with a \-\, removed.

 For example, if you wanted to add a \replied\ tag and remove
 the \inbox\ and \todo\, you would set
 (\replied\ \-inbox\ \-todo\\)
   :type 'list
   :group 'notmuch-send)

 If the above was changed to 'normuch-send, (require 'notmuch-lib)
 was added to the beginning of notmuch-message.el and the defgroup
 below was written as

 (defgroup notmuch-reply
   '((message-insertion custom-group)))
Replying to messages.
 ...

 would that work as expected ?

 Hi Tomi,

 I don't really get what are you trying to say. Do you mean that
 notmuch-message-replied-tags is referenced from notmuch-lib.el without
 (require 'notmuch-message)? I'm not sure whether it is required, but it
 works here without problems.

Ok, some sillines in my part and something I did not check well
enough before replying...

First, notmuch-lib.el defines notmuch-send group, yet 
(defcustom notmuch-message-replied-tags ...) is defined 
in notmuch-message.el which is not requiring notmuch-lib...
and all of this works now...

Actually, notmuch-lib.el defines all defgroups (except coolj).

Then, I found the following: notmuch-mua-send-hook is defined 
both in notmuch-hooks and notmuch-send groups (having a precedent
helps a bit there when choosing alternatives below)


All the defgroups are defined using pattern:

(defgroup notmuch-group nil ...)

We should follow this pattern unless there is good reason not to 
do so here: notmuch-send is written as:

  (defgroup notmuch-send nil
Sending messages from Notmuch.
:group 'notmuch)

  (custom-add-to-group 'notmuch-send 'message 'custom-group)

But, as the documentation in this notmuch-reply definition references
'Message insertion' group, doing

  (defgroup notmuch-reply 
'((message-insertion custom-group))'
Replying to messages.

  Most of the reply customization settings can be found in `Message
  insertion' group. Notmuch specific settings are included directly
  here.
  :group 'notmuch)

could be good thing to do here; definition matches doc from the beginning
(just not adding any of the custom variables, yet).


Now, currently notmuch-message.el defines notmuch-message-replied-tags
and puts that to :group 'notmuch-send

There are 2 alternatives:

1) change that to :group 'notmuch-reply

2) add (custom-add-to-group 'notmuch-reply 'notmuch-message-replied-tags 
'custom-variable)
   to notmuch-message.el (or notmuch-lib.el)

2b) change :group 'notmuch-send - :group 'notmuch-reply and
   add (custom-add-to-group 'notmuch-send 'notmuch-message-replied-tags 
'custom-variable)
   to notmuch-message.el (or notmuch-lib.el)


I personally would slightly lean to option 1 but if 2 gets more 
supporters then 2b (so that the spesific group is in the group definition).

On other words; 1 or 2b gets LGTM from me :)

Understood ? :D


Tomi


 Running M-x customize-variable RET notmuch-message-replied-tags RET
 shows the following. Note that both groups are mentioned at the bottom.
 No warning or errors are produced.

Yes, I tested that missing group-thing with:

(defgroup foo '((bar-group custom-group)) test)

It seems the nonexisting bar-group is created on-the-fly (but
exist temporarily). No warnings nor errors :).


 -Michal

Tomi


 --8---cut here---start-8---
 To apply changes, use the Save or Set buttons.
 For details, see Saving Customizations in the Emacs manual.

   Search 

  Operate on all settings in this buffer:
   Set for current session   Save for future sessions 
   Undo edits   Reset to saved   Erase customizations Exit 

 Hide notmuch-message-replied-tags: '(replied)
 State : STANDARD. (mismatch)
Tags to be automatically added to or removed from a message when it is 
 replied to. Hide   
Any tag in the list will be added to a replied message or,
if it is prefaced with a -, removed.

For example, if you wanted to add a replied tag and remove
the inbox and todo, you would set
(replied -inbox -todo)
 Groups: Notmuch Send Notmuch Reply
 --8---cut here---end---8---
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] emacs: Add customization group for replying

2012-09-06 Thread Michal Sojka
On Thu, Sep 06 2012, Tomi Ollila wrote:
 On Thu, Sep 06 2012, Michal Sojka sojk...@fel.cvut.cz wrote:

 So far good, but...

 You forgot to handle the current group setting for 
 notmuch-message-replied-tags -- currently notmuch-message.el has this:

 (defcustom notmuch-message-replied-tags '(replied)
   Tags to be automatically added to or removed from a message when it is
   replied to.
 Any tag in the list will be added to a replied message or,
 if it is prefaced with a \-\, removed.

 For example, if you wanted to add a \replied\ tag and remove
 the \inbox\ and \todo\, you would set
 (\replied\ \-inbox\ \-todo\\)
   :type 'list
   :group 'notmuch-send)

 If the above was changed to 'normuch-send, (require 'notmuch-lib)
 was added to the beginning of notmuch-message.el and the defgroup
 below was written as

 (defgroup notmuch-reply
   '((message-insertion custom-group)))
Replying to messages.
 ...

 would that work as expected ?

 Hi Tomi,

 I don't really get what are you trying to say. Do you mean that
 notmuch-message-replied-tags is referenced from notmuch-lib.el without
 (require 'notmuch-message)? I'm not sure whether it is required, but it
 works here without problems.

 Ok, some sillines in my part and something I did not check well
 enough before replying...

 First, notmuch-lib.el defines notmuch-send group, yet 
 (defcustom notmuch-message-replied-tags ...) is defined 
 in notmuch-message.el which is not requiring notmuch-lib...
 and all of this works now...

 Actually, notmuch-lib.el defines all defgroups (except coolj).

 Then, I found the following: notmuch-mua-send-hook is defined 
 both in notmuch-hooks and notmuch-send groups (having a precedent
 helps a bit there when choosing alternatives below)


 All the defgroups are defined using pattern:

 (defgroup notmuch-group nil ...)

 We should follow this pattern unless there is good reason not to 
 do so here: notmuch-send is written as:

   (defgroup notmuch-send nil
 Sending messages from Notmuch.
 :group 'notmuch)

   (custom-add-to-group 'notmuch-send 'message 'custom-group)

 But, as the documentation in this notmuch-reply definition references
 'Message insertion' group, doing

   (defgroup notmuch-reply 
 '((message-insertion custom-group))'
 Replying to messages.

   Most of the reply customization settings can be found in `Message
   insertion' group. Notmuch specific settings are included directly
   here.
   :group 'notmuch)

 could be good thing to do here; definition matches doc from the beginning
 (just not adding any of the custom variables, yet).


 Now, currently notmuch-message.el defines notmuch-message-replied-tags
 and puts that to :group 'notmuch-send

 There are 2 alternatives:

 1) change that to :group 'notmuch-reply

Now I understand. I think that 1) would be a good solution. I'll wait a
bit for other comments and than I'll send a new patch.

-Michal


 2) add (custom-add-to-group 'notmuch-reply 'notmuch-message-replied-tags 
 'custom-variable)
to notmuch-message.el (or notmuch-lib.el)

 2b) change :group 'notmuch-send - :group 'notmuch-reply and
add (custom-add-to-group 'notmuch-send 'notmuch-message-replied-tags 
 'custom-variable)
to notmuch-message.el (or notmuch-lib.el)


 I personally would slightly lean to option 1 but if 2 gets more 
 supporters then 2b (so that the spesific group is in the group definition).

 On other words; 1 or 2b gets LGTM from me :)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/6] emacs: add helper for tag change list manipulation

2012-09-06 Thread Tomi Ollila
On Mon, Sep 03 2012, Jani Nikula wrote:

 On Mon, 03 Sep 2012, Michal Nazarewicz min...@mina86.com wrote:
 Jani Nikula j...@nikula.org writes:
 Add a helper to create (and optionally reverse) a list of tag changes.
 ---
  emacs/notmuch-tag.el |   17 +
  1 file changed, 17 insertions(+)

 diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
 index 0c0fc87..c1aeb99 100644
 --- a/emacs/notmuch-tag.el
 +++ b/emacs/notmuch-tag.el
 @@ -140,6 +140,23 @@ notmuch-after-tag-hook will be run.
;; in all cases we return tag-changes as a list
tag-changes)
  
 +(defun notmuch-tag-change-list (tags optional reverse)
 +  Convert TAGS into a list of tag changes.
 +
 +Add a \+\ prefix to any tag in TAGS list that doesn't already
 +begin with a \+\ or a \-\. If REVERSE is non-nil, replace all
 +\+\ prefixes with \-\ and vice versa in the result.
 +  (mapcar (lambda (str)
 +   (let ((s (if (not (string-match ^[+-] str))
 +(concat + str)
 +  str)))

 (if (string-match ^[-+] str) str (concat + str))

 Negation only makes things less readable IMO.

 Agreed.

The whole series LGTM -- but are you still going to do 
changes here ?

 Jani.

Tomi




 + (if reverse
 + (concat (if (= (string-to-char s) ?-) + -)
 + (substring s 1))
 +   s)))
 + tags))
 +
 +
  ;;
  
  (provide 'notmuch-tag)

 -- 
 Best regards, _ _
 .o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
 ..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
 ooo +email/xmpp: m...@google.com--ooO--(_)--Ooo--
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] notmuch-show: include Bcc header in json output

2012-09-06 Thread Michal Sojka
On Wed, Sep 05 2012, Michal Nazarewicz wrote:
 From: Michal Nazarewicz min...@mina86.com

 ---
  notmuch-show.c |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)

 Actually, I don't understand why json does not include all the
 headers...

Hi,

I tested this and haven't found any problems. You may want to add a test
for this feature.

Thanks,
-Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 0/5] emacs: notmuch-hello status message refresh hook, etc

2012-09-06 Thread Tomi Ollila
On Thu, Sep 06 2012, Michal Sojka wrote:

 On Tue, Sep 04 2012, Jani Nikula wrote:
 On Tue, 04 Sep 2012, Michal Sojka sojk...@fel.cvut.cz wrote:
 On Sun, Sep 02 2012, Jani Nikula wrote:
 Hi all, v2 of [1] addressing review comments: added NEWS, improved
 documentation, made the query customizable.

 [1]
 
 id:37899e28dbf67e4620a53279a869be3174c02d6f.1339775602.git.j...@nikula.org

 Hello Jani,

 if I understand correctly, the goal of this patchset is to display the
 message with the difference in the number of messages before and after
 refresh of notmuch-hello.

 Difference between two refreshes of notmuch-hello to be specific.

 I think the current implementation is unnecessarily complicated. It
 would be sufficient to implement this directly in `notmuch-hello'
 without any hook. If `notmuch-hello-refresh-status-query' is nil
 (default) no message would be shown. If it is configured to something
 else, the message would be shown provided that no-display is nil. This
 way you don't have to break existing user's hooks and achieve the same
 behavior, don't you?

 I think it would be useful to pass no-display to hooks anyway,
 regardless of the use here.

 I'm strongly against breaking existing user's setups without a good
 reason. The meaning of no-display parameter, as I understand it, is only
 to tells whether the refresh should happen in background or foreground.
 Isn't there any other method for hooks to check for this conditions? For
 example something like checking whether notmuch-hello buffer is shown in
 a window of the active frame? Or a simple (perhaps buffer-local)
 variable can contain this information.

I mentioned using no-display from dynamic scope -- which isn't very
good solution in a long run. Lately I've been leaning to Jani's suggestion
by just calling refresh-hook with no-display arg But if there is
well-established way to provide this information to hooks without
adding this argument in the hook call then that could be used..

 I don't know what people use notmuch-hello-refresh-hook for. I suppose
 that your use case (displaying a message outside of hello buffer) is
 rather an exception than a typical use.

In any case, I think the refresh-hook needs to know this no-display
information, somehow. If there is no other good way than giving it
as an argument to the hook then that should be done (by pushing patches
1-3).

 I don't see that as a big reason to do this one way or the other.
 Having this implemented directly in notmuch-hello does not make this
 less complicated either.

 That's true, but it would be simpler for users to set it up. With your
 patches, users would have to configure the variable (query) as well as
 the hook. I propose to have only one place to configure this feature.

I've been thinking that Jani's way to provide the information to minibuffer
is a bit better than provide it in hello buffer -- as I think there is a
small imperfection that may irritate users: The default '*' is in use.
The hello buffer is refreshed (via emacsclient or something?) with
no-display t -- message count changes but the reference count
(notmuch-hello-refresh-count) keeps the same. Next time the hello buffer is
visible, showing current message count -- and user refreshes it.  In most
cases message count change in hello buffer is different that what will be
shown in minibuffer.

Now, If this imperfection reason enough to have this feature available
from wiki/contrib. 

If not, then the decision between hook/part of notmuch-hello is to be done:

1) If hook, then one less if's to be used -- and customization useful for
those who don't (add-hook...) more hooks there.

2) If somewhere in notmuch-hello processing then this query-variable
(named appropriately) can be used to check whether this feature is in 
use; if nil then not, otherwise it contains the query variable to be used
in (notmuch-command count ...) call.

 -Michal

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 0/6] emacs: customization for tag changes on archive

2012-09-06 Thread Jani Nikula
Hi all, this is v2 of [1], the only change being Michal's suggestion [2] for
patch 1/6.

[1] id:cover.1346614915.git.j...@nikula.org
[2] id:xa1tipbvwdb0@mina86.com

BR,
Jani.


Jani Nikula (6):
  emacs: add helper for tag change list manipulation
  emacs: fix notmuch-message-replied-tags defcustom type
  emacs: use new tag change helper to mark messages as replied
  emacs: add support for custom tag changes on message/thread archive
  emacs: add support for reversing notmuch-search-archive-thread tag
changes
  emacs: add support for reversing notmuch-show-mark-read tag changes

 emacs/notmuch-lib.el |   14 
 emacs/notmuch-message.el |   26 ++
 emacs/notmuch-show.el|   54 +++---
 emacs/notmuch-tag.el |   15 +
 emacs/notmuch.el |   16 ++
 5 files changed, 89 insertions(+), 36 deletions(-)

-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 1/6] emacs: add helper for tag change list manipulation

2012-09-06 Thread Jani Nikula
Add a helper to create (and optionally reverse) a list of tag changes.
---
 emacs/notmuch-tag.el |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 0c0fc87..4fce3a9 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -140,6 +140,21 @@ notmuch-after-tag-hook will be run.
   ;; in all cases we return tag-changes as a list
   tag-changes)
 
+(defun notmuch-tag-change-list (tags optional reverse)
+  Convert TAGS into a list of tag changes.
+
+Add a \+\ prefix to any tag in TAGS list that doesn't already
+begin with a \+\ or a \-\. If REVERSE is non-nil, replace all
+\+\ prefixes with \-\ and vice versa in the result.
+  (mapcar (lambda (str)
+   (let ((s (if (string-match ^[+-] str) str (concat + str
+ (if reverse
+ (concat (if (= (string-to-char s) ?-) + -)
+ (substring s 1))
+   s)))
+ tags))
+
+
 ;;
 
 (provide 'notmuch-tag)
-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 2/6] emacs: fix notmuch-message-replied-tags defcustom type

2012-09-06 Thread Jani Nikula
---
 emacs/notmuch-message.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
index d3738bf..3798046 100644
--- a/emacs/notmuch-message.el
+++ b/emacs/notmuch-message.el
@@ -31,7 +31,7 @@ if it is prefaced with a \-\, removed.
 For example, if you wanted to add a \replied\ tag and remove
 the \inbox\ and \todo\, you would set
 (\replied\ \-inbox\ \-todo\\)
-  :type 'list
+  :type '(repeat string)
   :group 'notmuch-send)
 
 (defun notmuch-message-mark-replied ()
-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 3/6] emacs: use new tag change helper to mark messages as replied

2012-09-06 Thread Jani Nikula
Clarify documentation while at it.
---
 emacs/notmuch-message.el |   24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
index 3798046..4dc4883 100644
--- a/emacs/notmuch-message.el
+++ b/emacs/notmuch-message.el
@@ -23,14 +23,16 @@
 (require 'notmuch-tag)
 (require 'notmuch-mua)
 
-(defcustom notmuch-message-replied-tags '(replied)
-  Tags to be automatically added to or removed from a message when it is 
replied to.
-Any tag in the list will be added to a replied message or,
-if it is prefaced with a \-\, removed.
+(defcustom notmuch-message-replied-tags '(+replied)
+  List of tag changes to apply to a message when it has been replied to.
+
+Tags starting with \+\ (or not starting with either \+\ or
+\-\) in the list will be added, and tags starting with \-\
+will be removed from the message being replied to.
 
 For example, if you wanted to add a \replied\ tag and remove
-the \inbox\ and \todo\, you would set
-(\replied\ \-inbox\ \-todo\\)
+the \inbox\ and \todo\ tags, you would set:
+(\+replied\ \-inbox\ \-todo\\)
   :type '(repeat string)
   :group 'notmuch-send)
 
@@ -38,14 +40,8 @@ the \inbox\ and \todo\, you would set
   ;; get the in-reply-to header and parse it for the message id.
   (let ((rep (mail-header-parse-addresses (message-field-value 
In-Reply-To
 (when (and notmuch-message-replied-tags rep)
-  ;; add a + to any tag that is doesn't already begin with a +
-  ;; or -
-  (let ((tags (mapcar (lambda (str)
-   (if (not (string-match ^[+-] str))
-   (concat + str)
- str))
- notmuch-message-replied-tags)))
-   (funcall 'notmuch-tag (notmuch-id-to-query (car (car rep))) tags)
+  (funcall 'notmuch-tag (notmuch-id-to-query (car (car rep)))
+  (notmuch-tag-change-list notmuch-message-replied-tags)
 
 (add-hook 'message-send-hook 'notmuch-message-mark-replied)
 
-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 4/6] emacs: add support for custom tag changes on message/thread archive

2012-09-06 Thread Jani Nikula
Add support for customization of the tag changes that are applied when
a message or a thread is archived. Instead of hard-coded removal of
the inbox tag, the user can now specify a list of tag changes to
perform.
---
 emacs/notmuch-lib.el  |   14 ++
 emacs/notmuch-show.el |   29 +
 emacs/notmuch.el  |   12 ++--
 3 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 900235b..20d990d 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -82,6 +82,20 @@
   :type '(alist :key-type string :value-type string)
   :group 'notmuch-hello)
 
+(defcustom notmuch-archive-tags '(-inbox)
+  List of tag changes to apply to a message or a thread when it is archived.
+
+Tags starting with \+\ (or not starting with either \+\ or
+\-\) in the list will be added, and tags starting with \-\
+will be removed from the message or thread being archived.
+
+For example, if you wanted to remove an \inbox\ tag and add an
+\archived\ tag, you would set:
+(\-inbox\ \+archived\)
+  :type '(repeat string)
+  :group 'notmuch-search
+  :group 'notmuch-show)
+
 (defvar notmuch-folders nil
   Deprecated name for what is now known as `notmuch-saved-searches'.)
 
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ce5ea6f..e701aec 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1748,18 +1748,20 @@ argument, hide all of the messages.
 (defun notmuch-show-archive-thread (optional unarchive)
   Archive each message in thread.
 
-Archive each message currently shown by removing the \inbox\
-tag from each.  If a prefix argument is given, the messages will
-be \unarchived\ (ie. the \inbox\ tag will be added instead of
-removed).
+Archive each message currently shown by applying the tag changes
+in `notmuch-archive-tags' to each (remove the \inbox\ tag by
+default). If a prefix argument is given, the messages will be
+\unarchived\, i.e. the tag changes in `notmuch-archive-tags'
+will be reversed.
 
 Note: This command is safe from any race condition of new messages
 being delivered to the same thread. It does not archive the
 entire thread, but only the messages shown in the current
 buffer.
   (interactive P)
-  (let ((op (if unarchive + -)))
-(notmuch-show-tag-all (concat op inbox
+  (when notmuch-archive-tags
+(notmuch-show-tag-all
+ (notmuch-tag-change-list notmuch-archive-tags unarchive
 
 (defun notmuch-show-archive-thread-then-next ()
   Archive all messages in the current buffer, then show next thread from 
search.
@@ -1774,14 +1776,17 @@ buffer.
   (notmuch-show-next-thread))
 
 (defun notmuch-show-archive-message (optional unarchive)
-  Archive the current message (remove \inbox\ tag).
+  Archive the current message.
 
-If a prefix argument is given, the message will be
-\unarchived\ (ie. the \inbox\ tag will be added instead of
-removed).
+Archive the current message by applying the tag changes in
+`notmuch-archive-tags' to it (remove the \inbox\ tag by
+default). If a prefix argument is given, the message will be
+\unarchived\, i.e. the tag changes in `notmuch-archive-tags'
+will be reversed.
   (interactive P)
-  (let ((op (if unarchive + -)))
-(notmuch-show-tag-message (concat op inbox
+  (when notmuch-archive-tags
+(apply 'notmuch-show-tag-message
+  (notmuch-tag-change-list notmuch-archive-tags unarchive
 
 (defun notmuch-show-archive-message-then-next-or-exit ()
   Archive the current message, then show the next open message in the current 
thread.
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 1c43d3e..64caa3e 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -594,11 +594,19 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES.
   (notmuch-search-tag -))
 
 (defun notmuch-search-archive-thread ()
-  Archive the currently selected thread (remove its \inbox\ tag).
+  Archive the currently selected thread.
+
+Archive each message in the currently selected thread by applying
+the tag changes in `notmuch-archive-tags' to each (remove the
+\inbox\ tag by default). If a prefix argument is given, the
+messages will be \unarchived\ (i.e. the tag changes in
+`notmuch-archive-tags' will be reversed).
 
 This function advances the next thread when finished.
   (interactive)
-  (notmuch-search-tag '(-inbox))
+  (when notmuch-archive-tags
+(notmuch-search-tag
+ (notmuch-tag-change-list notmuch-archive-tags)))
   (notmuch-search-next-thread))
 
 (defun notmuch-search-update-result (result optional pos)
-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 5/6] emacs: add support for reversing notmuch-search-archive-thread tag changes

2012-09-06 Thread Jani Nikula
Since archiving a thread can now be a user customized set of tag
changes, make reversing this easier. Allow a prefix argument to
notmuch-search-archive-thread to reverse the archiving, similar to the
unarchiving in notmuch-show-archive-message.
---
 emacs/notmuch.el |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 64caa3e..a8a85ce 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -593,7 +593,7 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES.
   (interactive)
   (notmuch-search-tag -))
 
-(defun notmuch-search-archive-thread ()
+(defun notmuch-search-archive-thread (optional unarchive)
   Archive the currently selected thread.
 
 Archive each message in the currently selected thread by applying
@@ -603,10 +603,10 @@ messages will be \unarchived\ (i.e. the tag changes in
 `notmuch-archive-tags' will be reversed).
 
 This function advances the next thread when finished.
-  (interactive)
+  (interactive P)
   (when notmuch-archive-tags
 (notmuch-search-tag
- (notmuch-tag-change-list notmuch-archive-tags)))
+ (notmuch-tag-change-list notmuch-archive-tags unarchive)))
   (notmuch-search-next-thread))
 
 (defun notmuch-search-update-result (result optional pos)
-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 6/6] emacs: add support for reversing notmuch-show-mark-read tag changes

2012-09-06 Thread Jani Nikula
Since marking a message as read can now be a user customized set of
tag changes, make reversing this easier. Allow a prefix argument to
notmuch-show-mark-read to reverse the marking as read, similar to the
unarchiving in notmuch-show-archive-message.

While at it, update the relevant documentation to match that of other
automatic tagging (i.e. archive and reply).
---
 emacs/notmuch-show.el |   25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e701aec..1c1cf9c 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -184,8 +184,15 @@ provided with an MLA argument nor `completing-read' input.
   :group 'notmuch-show)
 
 (defcustom notmuch-show-mark-read-tags '(-unread)
-  List of tags to apply when message is read, ie. shown in notmuch-show
-buffer.
+  List of tag changes to apply to a message when it is marked as read.
+
+Tags starting with \+\ (or not starting with either \+\ or
+\-\) in the list will be added, and tags starting with \-\
+will be removed from the message being marked as read.
+
+For example, if you wanted to remove an \unread\ tag and add a
+\read\ tag (which would make little sense), you would set:
+(\-unread\ \+read\)
   :type '(repeat string)
   :group 'notmuch-show)
 
@@ -1390,10 +1397,18 @@ current thread.
   Are the headers of the current message visible?
   (notmuch-show-get-prop :headers-visible))
 
-(defun notmuch-show-mark-read ()
-  Apply `notmuch-show-mark-read-tags' to the message.
+(defun notmuch-show-mark-read (optional unread)
+  Mark the current message as read.
+
+Mark the current message as read by applying the tag changes in
+`notmuch-show-mark-read-tags' to it (remove the \unread\ tag by
+default). If a prefix argument is given, the message will be
+marked as unread, i.e. the tag changes in
+`notmuch-show-mark-read-tags' will be reversed.
+  (interactive P)
   (when notmuch-show-mark-read-tags
-(apply 'notmuch-show-tag-message notmuch-show-mark-read-tags)))
+(apply 'notmuch-show-tag-message
+  (notmuch-tag-change-list notmuch-show-mark-read-tags unread
 
 ;; Functions for getting attributes of several messages in the current
 ;; thread.
-- 
1.7.9.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/6] emacs: add helper for tag change list manipulation

2012-09-06 Thread Jani Nikula
On Thu, 06 Sep 2012, Tomi Ollila tomi.oll...@iki.fi wrote:
 The whole series LGTM -- but are you still going to do 
 changes here ?

Yes, id:cover.1346945257.git.j...@nikula.org

J.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch