[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-10-16 Thread Ethan Glasser-Camp
Mark Walters  writes:

> I like the use of separator rather than hard-wiring " or ". My personal
> preference would be to make that change but keep the two functions
> separate (my "C"ness makes me like functions that have clear return
> types!) But I am happy with the change too.

I agree with this comment. Especially in dynamic languages, it's a good
idea for each function to have only one return type.

Also, it seems that the commit message has a TAB character in it 
(",-search").

Ethan


Re: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-10-15 Thread Ethan Glasser-Camp
Mark Walters markwalters1...@gmail.com writes:

 I like the use of separator rather than hard-wiring  or . My personal
 preference would be to make that change but keep the two functions
 separate (my Cness makes me like functions that have clear return
 types!) But I am happy with the change too.

I agree with this comment. Especially in dynamic languages, it's a good
idea for each function to have only one return type.

Also, it seems that the commit message has a TAB character in it 
(,TAB-search).

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


[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-03-21 Thread Mark Walters
On Fri, 24 Feb 2012 23:30:39 +0100, Pieter Praet  wrote:
> * emacs/notmuch-show.el
> 
>   (notmuch-show-get-messages-ids):
> If provided with optional arg SEPARATOR, return a string consisting
> of all Message-Id's, separated by SEPARATOR.  Also improve original
> docstring wrt default return value.
> 
>   (notmuch-show-get-messages-ids-search):
> Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
> 
>   (notmuch-show-tag-all):
> Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
> `notmuch-show-get-messages-ids-search'.
> ---
>  emacs/notmuch-show.el |   18 +-
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 6adbdc0..05606fc 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
>"Return the message id of the current message."
>(concat "id:\"" (notmuch-show-get-prop :id) "\""))
>  
> -(defun notmuch-show-get-messages-ids ()
> -  "Return all message ids of messages in the current thread."
> +(defun notmuch-show-get-messages-ids ( separator)
> +  "Return a list of Message-Id's of all messages in the current buffer.
> +
> +If provided with optional argument SEPARATOR, return a string
> +instead, consisting of all Message-Id's separated by SEPARATOR."
>(let ((message-ids))
>  (notmuch-show-mapc
>   (lambda () (push (notmuch-show-get-message-id) message-ids)))
> -message-ids))
> -
> -(defun notmuch-show-get-messages-ids-search ()
> -  "Return a search string for all message ids of messages in the
> -current thread."
> -  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
> +(if separator
> + (mapconcat 'identity message-ids separator)
> +  message-ids)))
>  
>  ;; dme: Would it make sense to use a macro for many of these?
>  
> @@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all ( tag-changes)
>  
>  TAG-CHANGES is a list of tag operations for `notmuch-tag'."
>(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
> -  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
> +  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
>(notmuch-show-mapc
> (lambda ()
>   (let* ((current-tags (notmuch-show-get-tags))

Oh and I forgot to add that this patch doesn't seem to apply anymore.

MW


[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-03-21 Thread Mark Walters
On Fri, 24 Feb 2012 23:30:39 +0100, Pieter Praet  wrote:
> * emacs/notmuch-show.el
> 
>   (notmuch-show-get-messages-ids):
> If provided with optional arg SEPARATOR, return a string consisting
> of all Message-Id's, separated by SEPARATOR.  Also improve original
> docstring wrt default return value.
> 
>   (notmuch-show-get-messages-ids-search):
> Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
> 
>   (notmuch-show-tag-all):
> Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
> `notmuch-show-get-messages-ids-search'.
> ---
>  emacs/notmuch-show.el |   18 +-
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 6adbdc0..05606fc 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
>"Return the message id of the current message."
>(concat "id:\"" (notmuch-show-get-prop :id) "\""))
>  
> -(defun notmuch-show-get-messages-ids ()
> -  "Return all message ids of messages in the current thread."
> +(defun notmuch-show-get-messages-ids ( separator)
> +  "Return a list of Message-Id's of all messages in the current buffer.
> +
> +If provided with optional argument SEPARATOR, return a string
> +instead, consisting of all Message-Id's separated by SEPARATOR."
>(let ((message-ids))
>  (notmuch-show-mapc
>   (lambda () (push (notmuch-show-get-message-id) message-ids)))
> -message-ids))
> -
> -(defun notmuch-show-get-messages-ids-search ()
> -  "Return a search string for all message ids of messages in the
> -current thread."
> -  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
> +(if separator
> + (mapconcat 'identity message-ids separator)
> +  message-ids)))
>  
>  ;; dme: Would it make sense to use a macro for many of these?
>  
> @@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all ( tag-changes)
>  
>  TAG-CHANGES is a list of tag operations for `notmuch-tag'."
>(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
> -  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
> +  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
>(notmuch-show-mapc
> (lambda ()
>   (let* ((current-tags (notmuch-show-get-tags))

I like the use of separator rather than hard-wiring " or ". My personal
preference would be to make that change but keep the two functions
separate (my "C"ness makes me like functions that have clear return
types!) But I am happy with the change too.

Best wishes

Mark




Re: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-03-20 Thread Mark Walters
On Fri, 24 Feb 2012 23:30:39 +0100, Pieter Praet pie...@praet.org wrote:
 * emacs/notmuch-show.el
 
   (notmuch-show-get-messages-ids):
 If provided with optional arg SEPARATOR, return a string consisting
 of all Message-Id's, separated by SEPARATOR.  Also improve original
 docstring wrt default return value.
 
   (notmuch-show-get-messages-ids-search):
 Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
 
   (notmuch-show-tag-all):
 Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
 `notmuch-show-get-messages-ids-search'.
 ---
  emacs/notmuch-show.el |   18 +-
  1 files changed, 9 insertions(+), 9 deletions(-)
 
 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
 index 6adbdc0..05606fc 100644
 --- a/emacs/notmuch-show.el
 +++ b/emacs/notmuch-show.el
 @@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
Return the message id of the current message.
(concat id:\ (notmuch-show-get-prop :id) \))
  
 -(defun notmuch-show-get-messages-ids ()
 -  Return all message ids of messages in the current thread.
 +(defun notmuch-show-get-messages-ids (optional separator)
 +  Return a list of Message-Id's of all messages in the current buffer.
 +
 +If provided with optional argument SEPARATOR, return a string
 +instead, consisting of all Message-Id's separated by SEPARATOR.
(let ((message-ids))
  (notmuch-show-mapc
   (lambda () (push (notmuch-show-get-message-id) message-ids)))
 -message-ids))
 -
 -(defun notmuch-show-get-messages-ids-search ()
 -  Return a search string for all message ids of messages in the
 -current thread.
 -  (mapconcat 'identity (notmuch-show-get-messages-ids)  or ))
 +(if separator
 + (mapconcat 'identity message-ids separator)
 +  message-ids)))
  
  ;; dme: Would it make sense to use a macro for many of these?
  
 @@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all (rest tag-changes)
  
  TAG-CHANGES is a list of tag operations for `notmuch-tag'.
(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
 -  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
 +  (apply 'notmuch-tag (notmuch-show-get-messages-ids  or ) tag-changes)
(notmuch-show-mapc
 (lambda ()
   (let* ((current-tags (notmuch-show-get-tags))

I like the use of separator rather than hard-wiring  or . My personal
preference would be to make that change but keep the two functions
separate (my Cness makes me like functions that have clear return
types!) But I am happy with the change too.

Best wishes

Mark


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


Re: [PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-03-20 Thread Mark Walters
On Fri, 24 Feb 2012 23:30:39 +0100, Pieter Praet pie...@praet.org wrote:
 * emacs/notmuch-show.el
 
   (notmuch-show-get-messages-ids):
 If provided with optional arg SEPARATOR, return a string consisting
 of all Message-Id's, separated by SEPARATOR.  Also improve original
 docstring wrt default return value.
 
   (notmuch-show-get-messages-ids-search):
 Removed, as its functionality is now in `notmuch-show-get-messages-ids'.
 
   (notmuch-show-tag-all):
 Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
 `notmuch-show-get-messages-ids-search'.
 ---
  emacs/notmuch-show.el |   18 +-
  1 files changed, 9 insertions(+), 9 deletions(-)
 
 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
 index 6adbdc0..05606fc 100644
 --- a/emacs/notmuch-show.el
 +++ b/emacs/notmuch-show.el
 @@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
Return the message id of the current message.
(concat id:\ (notmuch-show-get-prop :id) \))
  
 -(defun notmuch-show-get-messages-ids ()
 -  Return all message ids of messages in the current thread.
 +(defun notmuch-show-get-messages-ids (optional separator)
 +  Return a list of Message-Id's of all messages in the current buffer.
 +
 +If provided with optional argument SEPARATOR, return a string
 +instead, consisting of all Message-Id's separated by SEPARATOR.
(let ((message-ids))
  (notmuch-show-mapc
   (lambda () (push (notmuch-show-get-message-id) message-ids)))
 -message-ids))
 -
 -(defun notmuch-show-get-messages-ids-search ()
 -  Return a search string for all message ids of messages in the
 -current thread.
 -  (mapconcat 'identity (notmuch-show-get-messages-ids)  or ))
 +(if separator
 + (mapconcat 'identity message-ids separator)
 +  message-ids)))
  
  ;; dme: Would it make sense to use a macro for many of these?
  
 @@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all (rest tag-changes)
  
  TAG-CHANGES is a list of tag operations for `notmuch-tag'.
(interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
 -  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
 +  (apply 'notmuch-tag (notmuch-show-get-messages-ids  or ) tag-changes)
(notmuch-show-mapc
 (lambda ()
   (let* ((current-tags (notmuch-show-get-tags))

Oh and I forgot to add that this patch doesn't seem to apply anymore.

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


[PATCH v2 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}'

2012-02-24 Thread Pieter Praet
* emacs/notmuch-show.el

  (notmuch-show-get-messages-ids):
If provided with optional arg SEPARATOR, return a string consisting
of all Message-Id's, separated by SEPARATOR.  Also improve original
docstring wrt default return value.

  (notmuch-show-get-messages-ids-search):
Removed, as its functionality is now in `notmuch-show-get-messages-ids'.

  (notmuch-show-tag-all):
Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of
`notmuch-show-get-messages-ids-search'.
---
 emacs/notmuch-show.el |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6adbdc0..05606fc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1339,17 +1339,17 @@ (defun notmuch-show-get-message-id ()
   "Return the message id of the current message."
   (concat "id:\"" (notmuch-show-get-prop :id) "\""))

-(defun notmuch-show-get-messages-ids ()
-  "Return all message ids of messages in the current thread."
+(defun notmuch-show-get-messages-ids ( separator)
+  "Return a list of Message-Id's of all messages in the current buffer.
+
+If provided with optional argument SEPARATOR, return a string
+instead, consisting of all Message-Id's separated by SEPARATOR."
   (let ((message-ids))
 (notmuch-show-mapc
  (lambda () (push (notmuch-show-get-message-id) message-ids)))
-message-ids))
-
-(defun notmuch-show-get-messages-ids-search ()
-  "Return a search string for all message ids of messages in the
-current thread."
-  (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
+(if separator
+   (mapconcat 'identity message-ids separator)
+  message-ids)))

 ;; dme: Would it make sense to use a macro for many of these?

@@ -1638,7 +1638,7 @@ (defun notmuch-show-tag-all ( tag-changes)

 TAG-CHANGES is a list of tag operations for `notmuch-tag'."
   (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
-  (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
+  (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes)
   (notmuch-show-mapc
(lambda ()
  (let* ((current-tags (notmuch-show-get-tags))
-- 
1.7.8.1