[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--


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


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

2012-09-03 Thread Jani Nikula
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.

Jani.

>
>> +  (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 1/6] emacs: add helper for tag change list manipulation

2012-09-03 Thread Michal Nazarewicz
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.

> +   (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--
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



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

2012-09-03 Thread Jani Nikula
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.

Jani.


 +  (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


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

2012-09-02 Thread Jani Nikula
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 reverse
+ (concat (if (= (string-to-char s) ?-) "+" "-")
+ (substring s 1))
+   s)))
+ tags))
+
+
 ;;

 (provide 'notmuch-tag)
-- 
1.7.9.5