Re: [PATCH v3] emacs: support notmuch new as a notmuch-poll-script

2012-01-12 Thread Pieter Praet
On Mon, 12 Dec 2011 22:50:04 +0200, Jani Nikula j...@nikula.org wrote:
 Support nil value for notmuch-poll-script to run notmuch new instead of
 an external script, and make this the new default. notmuch new is run
 using the configured notmuch-command.
 
 This allows taking better advantage of the notmuch new hooks from emacs
 without intermediate scripts.
 
 Signed-off-by: Jani Nikula j...@nikula.org
 
 ---
 
 v3: only documentation changes suggested by Austin and Dmitry.
 ---
  emacs/notmuch.el |   35 +--
  1 files changed, 25 insertions(+), 10 deletions(-)
 
 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
 index 8936149..675a110 100644
 --- a/emacs/notmuch.el
 +++ b/emacs/notmuch.el
 @@ -965,28 +965,43 @@ same relative position within the new buffer.
  (notmuch-search query oldest-first target-thread target-line 
 continuation)
  (goto-char (point-min
  
 -(defcustom notmuch-poll-script 
 +(defcustom notmuch-poll-script nil
An external script to incorporate new mail into the notmuch database.
  
 -If this variable is non empty, then it should name a script to be
 -invoked by `notmuch-search-poll-and-refresh-view' and
 +This variable controls the action invoked by
 +`notmuch-search-poll-and-refresh-view' and
  `notmuch-hello-poll-and-update' (each have a default keybinding
 -of 'G'). The script could do any of the following depending on
 +of 'G') to incorporate new mail into the notmuch database.
 +
 +If set to nil (the default), new mail is processed by invoking
 +\notmuch new\. Otherwise, this should be set to a string that
 +gives the name of an external script that processes new mail. If
 +set to the empty string, no command will be run.
 +
 +The external script could do any of the following depending on
  the user's needs:
  
  1. Invoke a program to transfer mail to the local mail store
  2. Invoke \notmuch new\ to incorporate the new mail
 -3. Invoke one or more \notmuch tag\ commands to classify the mail
 -  :type 'string
 +3. Invoke one or more \notmuch tag\ commands to classify the mail
 +
 +Note that the recommended way of achieving the same is using
 +\notmuch new\ hooks.
 +  :type '(choice (const :tag notmuch new nil)
 +  (const :tag Disabled )
 +  (string :tag Custom script))
:group 'notmuch)
  
  (defun notmuch-poll ()
 -  Run external script to import mail.
 +  Run \notmuch new\ or an external script to import mail.
  
 -Invokes `notmuch-poll-script' if it is not set to an empty string.
 +Invokes `notmuch-poll-script', \notmuch new\, or does nothing
 +depending on the value of `notmuch-poll-script'.
(interactive)
 -  (if (not (string= notmuch-poll-script ))
 -  (call-process notmuch-poll-script nil nil)))
 +  (if (stringp notmuch-poll-script)
 +  (if (not (string= notmuch-poll-script ))
 +   (call-process notmuch-poll-script nil nil))
 +(call-process notmuch-command nil nil nil new)))

Since it seems to be bikeshedding-season:

When `(if (not's don't have an `else'-part, use `unless' instead ?

Patch follows.

  
  (defun notmuch-search-poll-and-refresh-view ()
Invoke `notmuch-poll' to import mail, then refresh the current view.
 -- 
 1.7.5.4
 
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch


Nicely complements the new hooks (for which thanks) !


Peace

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


Re: [PATCH v3] emacs: support notmuch new as a notmuch-poll-script

2011-12-14 Thread David Bremner
On Mon, 12 Dec 2011 22:50:04 +0200, Jani Nikula j...@nikula.org wrote:
 Support nil value for notmuch-poll-script to run notmuch new instead of
 an external script, and make this the new default. notmuch new is run
 using the configured notmuch-command.

pushed.

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


Re: [PATCH v3] emacs: support notmuch new as a notmuch-poll-script

2011-12-12 Thread Dmitry Kurochkin
On Mon, 12 Dec 2011 22:50:04 +0200, Jani Nikula j...@nikula.org wrote:
 Support nil value for notmuch-poll-script to run notmuch new instead of
 an external script, and make this the new default. notmuch new is run
 using the configured notmuch-command.
 
 This allows taking better advantage of the notmuch new hooks from emacs
 without intermediate scripts.
 
 Signed-off-by: Jani Nikula j...@nikula.org
 
 ---
 
 v3: only documentation changes suggested by Austin and Dmitry.
 ---
  emacs/notmuch.el |   35 +--
  1 files changed, 25 insertions(+), 10 deletions(-)
 
 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
 index 8936149..675a110 100644
 --- a/emacs/notmuch.el
 +++ b/emacs/notmuch.el
 @@ -965,28 +965,43 @@ same relative position within the new buffer.
  (notmuch-search query oldest-first target-thread target-line 
 continuation)
  (goto-char (point-min
  
 -(defcustom notmuch-poll-script 
 +(defcustom notmuch-poll-script nil
An external script to incorporate new mail into the notmuch database.
  
 -If this variable is non empty, then it should name a script to be
 -invoked by `notmuch-search-poll-and-refresh-view' and
 +This variable controls the action invoked by
 +`notmuch-search-poll-and-refresh-view' and
  `notmuch-hello-poll-and-update' (each have a default keybinding
 -of 'G'). The script could do any of the following depending on
 +of 'G') to incorporate new mail into the notmuch database.
 +
 +If set to nil (the default), new mail is processed by invoking
 +\notmuch new\. Otherwise, this should be set to a string that
 +gives the name of an external script that processes new mail. If
 +set to the empty string, no command will be run.

I think this should be an empty string.  But I may be mistaking.

Regards,
  Dmitry

 +
 +The external script could do any of the following depending on
  the user's needs:
  
  1. Invoke a program to transfer mail to the local mail store
  2. Invoke \notmuch new\ to incorporate the new mail
 -3. Invoke one or more \notmuch tag\ commands to classify the mail
 -  :type 'string
 +3. Invoke one or more \notmuch tag\ commands to classify the mail
 +
 +Note that the recommended way of achieving the same is using
 +\notmuch new\ hooks.
 +  :type '(choice (const :tag notmuch new nil)
 +  (const :tag Disabled )
 +  (string :tag Custom script))
:group 'notmuch)
  
  (defun notmuch-poll ()
 -  Run external script to import mail.
 +  Run \notmuch new\ or an external script to import mail.
  
 -Invokes `notmuch-poll-script' if it is not set to an empty string.
 +Invokes `notmuch-poll-script', \notmuch new\, or does nothing
 +depending on the value of `notmuch-poll-script'.
(interactive)
 -  (if (not (string= notmuch-poll-script ))
 -  (call-process notmuch-poll-script nil nil)))
 +  (if (stringp notmuch-poll-script)
 +  (if (not (string= notmuch-poll-script ))
 +   (call-process notmuch-poll-script nil nil))
 +(call-process notmuch-command nil nil nil new)))
  
  (defun notmuch-search-poll-and-refresh-view ()
Invoke `notmuch-poll' to import mail, then refresh the current view.
 -- 
 1.7.5.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 v3] emacs: support notmuch new as a notmuch-poll-script

2011-12-12 Thread Austin Clements
LGTM.

Quoth Jani Nikula on Dec 12 at 10:50 pm:
 Support nil value for notmuch-poll-script to run notmuch new instead of
 an external script, and make this the new default. notmuch new is run
 using the configured notmuch-command.
 
 This allows taking better advantage of the notmuch new hooks from emacs
 without intermediate scripts.
 
 Signed-off-by: Jani Nikula j...@nikula.org
 
 ---
 
 v3: only documentation changes suggested by Austin and Dmitry.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3] emacs: support notmuch new as a notmuch-poll-script

2011-12-12 Thread Austin Clements
Quoth Jani Nikula on Dec 12 at 11:13 pm:
 On Tue, 13 Dec 2011 00:53:05 +0400, Dmitry Kurochkin 
 dmitry.kuroch...@gmail.com wrote:
  On Mon, 12 Dec 2011 22:50:04 +0200, Jani Nikula j...@nikula.org wrote:
   +If set to nil (the default), new mail is processed by invoking
   +\notmuch new\. Otherwise, this should be set to a string that
   +gives the name of an external script that processes new mail. If
   +set to the empty string, no command will be run.
  
  I think this should be an empty string.  But I may be mistaking.
 
 Shameless copy paste from a native speaker, who am I to argue? :)
 Austin?

Either way is grammatically correct.  Really, this is a philosophical
question.  Can two empty strings have different identities?  Or is
there only one empty string in the universe?

(eq  ) = t
(eq  (string)) = t
(eq  (make-string 0 ?a)) = t
(eq  (substring a 1)) = t

It would appear Elisp is squarely in the there is one empty string
camp, so the empty string would be more correct.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3] emacs: support notmuch new as a notmuch-poll-script

2011-12-12 Thread Dmitry Kurochkin
On Mon, 12 Dec 2011 16:24:51 -0500, Austin Clements amdra...@mit.edu wrote:
 Quoth Jani Nikula on Dec 12 at 11:13 pm:
  On Tue, 13 Dec 2011 00:53:05 +0400, Dmitry Kurochkin 
  dmitry.kuroch...@gmail.com wrote:
   On Mon, 12 Dec 2011 22:50:04 +0200, Jani Nikula j...@nikula.org wrote:
+If set to nil (the default), new mail is processed by invoking
+\notmuch new\. Otherwise, this should be set to a string that
+gives the name of an external script that processes new mail. If
+set to the empty string, no command will be run.
   
   I think this should be an empty string.  But I may be mistaking.
  
  Shameless copy paste from a native speaker, who am I to argue? :)
  Austin?
 
 Either way is grammatically correct.  Really, this is a philosophical
 question.  Can two empty strings have different identities?  Or is
 there only one empty string in the universe?
 
 (eq  ) = t
 (eq  (string)) = t
 (eq  (make-string 0 ?a)) = t
 (eq  (substring a 1)) = t
 
 It would appear Elisp is squarely in the there is one empty string
 camp, so the empty string would be more correct.

Fine with me then :)

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