mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
emacs: support "notmuch new" as a notmuch-poll-script
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 <jani@nikula.org>
This commit is contained in:
parent
a06f7b6737
commit
ed56fee6e5
1 changed files with 25 additions and 10 deletions
|
@ -965,28 +965,43 @@ same relative position within the new buffer."
|
||||||
(notmuch-search query oldest-first target-thread target-line continuation)
|
(notmuch-search query oldest-first target-thread target-line continuation)
|
||||||
(goto-char (point-min))))
|
(goto-char (point-min))))
|
||||||
|
|
||||||
(defcustom notmuch-poll-script ""
|
(defcustom notmuch-poll-script nil
|
||||||
"An external script to incorporate new mail into the notmuch database.
|
"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
|
This variable controls the action invoked by
|
||||||
invoked by `notmuch-search-poll-and-refresh-view' and
|
`notmuch-search-poll-and-refresh-view' and
|
||||||
`notmuch-hello-poll-and-update' (each have a default keybinding
|
`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:
|
the user's needs:
|
||||||
|
|
||||||
1. Invoke a program to transfer mail to the local mail store
|
1. Invoke a program to transfer mail to the local mail store
|
||||||
2. Invoke \"notmuch new\" to incorporate the new mail
|
2. Invoke \"notmuch new\" to incorporate the new mail
|
||||||
3. Invoke one or more \"notmuch tag\" commands to classify the mail"
|
3. Invoke one or more \"notmuch tag\" commands to classify the mail
|
||||||
:type 'string
|
|
||||||
|
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)
|
:group 'notmuch)
|
||||||
|
|
||||||
(defun notmuch-poll ()
|
(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)
|
(interactive)
|
||||||
|
(if (stringp notmuch-poll-script)
|
||||||
(if (not (string= notmuch-poll-script ""))
|
(if (not (string= notmuch-poll-script ""))
|
||||||
(call-process notmuch-poll-script nil nil)))
|
(call-process notmuch-poll-script nil nil))
|
||||||
|
(call-process notmuch-command nil nil nil "new")))
|
||||||
|
|
||||||
(defun notmuch-search-poll-and-refresh-view ()
|
(defun notmuch-search-poll-and-refresh-view ()
|
||||||
"Invoke `notmuch-poll' to import mail, then refresh the current view."
|
"Invoke `notmuch-poll' to import mail, then refresh the current view."
|
||||||
|
|
Loading…
Reference in a new issue