mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 11:58:10 +01:00
emacs: wrap process-lines
Initially just set the working directory, to avoid (the implicit) call-process crashing when the default-directory points to a non-existent location. Use of a macro here is over-engineering for this change, but the same change needs to be applied to several other process creation primitives.
This commit is contained in:
parent
06477bce03
commit
a890241138
6 changed files with 16 additions and 7 deletions
|
@ -217,7 +217,7 @@ requiring external commands."
|
||||||
;; harvest if necessary.
|
;; harvest if necessary.
|
||||||
(notmuch-address-harvest-trigger)))
|
(notmuch-address-harvest-trigger)))
|
||||||
(t
|
(t
|
||||||
(process-lines notmuch-address-command original))))
|
(notmuch--process-lines notmuch-address-command original))))
|
||||||
|
|
||||||
(defun notmuch-address-expand-name ()
|
(defun notmuch-address-expand-name ()
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -239,7 +239,7 @@ applied to newly inserted messages)."
|
||||||
(defun notmuch-draft-resume (id)
|
(defun notmuch-draft-resume (id)
|
||||||
"Resume editing of message with id ID."
|
"Resume editing of message with id ID."
|
||||||
;; Used by command `notmuch-show-resume-message'.
|
;; Used by command `notmuch-show-resume-message'.
|
||||||
(let* ((tags (process-lines notmuch-command "search" "--output=tags"
|
(let* ((tags (notmuch--process-lines notmuch-command "search" "--output=tags"
|
||||||
"--exclude=false" id))
|
"--exclude=false" id))
|
||||||
(draft (equal tags (notmuch-update-tags tags notmuch-draft-tags))))
|
(draft (equal tags (notmuch-update-tags tags notmuch-draft-tags))))
|
||||||
(when (or draft
|
(when (or draft
|
||||||
|
|
|
@ -496,7 +496,7 @@ diagonal."
|
||||||
(widget-get widget :notmuch-search-oldest-first)))))
|
(widget-get widget :notmuch-search-oldest-first)))))
|
||||||
|
|
||||||
(defun notmuch-saved-search-count (search)
|
(defun notmuch-saved-search-count (search)
|
||||||
(car (process-lines notmuch-command "count" search)))
|
(car (notmuch--process-lines notmuch-command "count" search)))
|
||||||
|
|
||||||
(defun notmuch-hello-tags-per-line (widest)
|
(defun notmuch-hello-tags-per-line (widest)
|
||||||
"Determine how many tags to show per line and how wide they
|
"Determine how many tags to show per line and how wide they
|
||||||
|
@ -748,7 +748,7 @@ Complete list of currently available key bindings:
|
||||||
(list (cons tag
|
(list (cons tag
|
||||||
(concat "tag:"
|
(concat "tag:"
|
||||||
(notmuch-escape-boolean-term tag))))))
|
(notmuch-escape-boolean-term tag))))))
|
||||||
(process-lines notmuch-command "search" "--output=tags" "*")))
|
(notmuch--process-lines notmuch-command "search" "--output=tags" "*")))
|
||||||
|
|
||||||
(defun notmuch-hello-insert-header ()
|
(defun notmuch-hello-insert-header ()
|
||||||
"Insert the default notmuch-hello header."
|
"Insert the default notmuch-hello header."
|
||||||
|
@ -786,7 +786,7 @@ Complete list of currently available key bindings:
|
||||||
:help-echo "Refresh"
|
:help-echo "Refresh"
|
||||||
(notmuch-hello-nice-number
|
(notmuch-hello-nice-number
|
||||||
(string-to-number
|
(string-to-number
|
||||||
(car (process-lines notmuch-command "count")))))
|
(car (notmuch--process-lines notmuch-command "count")))))
|
||||||
(widget-insert " messages.\n")))
|
(widget-insert " messages.\n")))
|
||||||
|
|
||||||
(defun notmuch-hello-insert-saved-searches ()
|
(defun notmuch-hello-insert-saved-searches ()
|
||||||
|
|
|
@ -860,6 +860,15 @@ You may need to restart Emacs or upgrade your notmuch package."))
|
||||||
;; `notmuch-logged-error' does not return.
|
;; `notmuch-logged-error' does not return.
|
||||||
))))
|
))))
|
||||||
|
|
||||||
|
(defmacro notmuch--apply-with-env (func &rest args)
|
||||||
|
`(let ((default-directory "~"))
|
||||||
|
(apply ,func ,@args)))
|
||||||
|
|
||||||
|
(defun notmuch--process-lines (program &rest args)
|
||||||
|
"Wrap process-lines, binding DEFAULT-DIRECTORY to a safe
|
||||||
|
default"
|
||||||
|
(notmuch--apply-with-env #'process-lines program args))
|
||||||
|
|
||||||
(defun notmuch-call-notmuch--helper (destination args)
|
(defun notmuch-call-notmuch--helper (destination args)
|
||||||
"Helper for synchronous notmuch invocation commands.
|
"Helper for synchronous notmuch invocation commands.
|
||||||
|
|
||||||
|
|
|
@ -1113,7 +1113,7 @@ the same as for the function notmuch-tree."
|
||||||
(concat " and (" query-context ")"))))
|
(concat " and (" query-context ")"))))
|
||||||
(sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
|
(sort-arg (if oldest-first "--sort=oldest-first" "--sort=newest-first"))
|
||||||
(message-arg (if unthreaded "--unthreaded" "--entire-thread")))
|
(message-arg (if unthreaded "--unthreaded" "--entire-thread")))
|
||||||
(when (equal (car (process-lines notmuch-command "count" search-args)) "0")
|
(when (equal (car (notmuch--process-lines notmuch-command "count" search-args)) "0")
|
||||||
(setq search-args basic-query))
|
(setq search-args basic-query))
|
||||||
(notmuch-tag-clear-cache)
|
(notmuch-tag-clear-cache)
|
||||||
(let ((proc (notmuch-start-notmuch
|
(let ((proc (notmuch-start-notmuch
|
||||||
|
|
|
@ -940,7 +940,7 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
|
||||||
PROMPT is the string to prompt with."
|
PROMPT is the string to prompt with."
|
||||||
(let* ((all-tags
|
(let* ((all-tags
|
||||||
(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
|
(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
|
||||||
(process-lines notmuch-command "search" "--output=tags" "*")))
|
(notmuch--process-lines notmuch-command "search" "--output=tags" "*")))
|
||||||
(completions
|
(completions
|
||||||
(append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
|
(append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
|
||||||
"subject:" "attachment:")
|
"subject:" "attachment:")
|
||||||
|
|
Loading…
Reference in a new issue