summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-08-16 21:33:40 -0400
committerKyle Meyer <kyle@kyleam.com>2020-08-17 20:23:20 -0400
commite37abb4e89952a919722237b5786102cf956a84e (patch)
treeddf5d0c01a0ac1e86acfef2cc3ebfa922fb522ee
parent1b5a531adbda35ed5de03c8c06d26e6337dca05d (diff)
downloadpiem-e37abb4e89952a919722237b5786102cf956a84e.tar.gz
Move "has gunzip?" check to helper
This will be needed in another spot. Message-Id: <20200817013343.15615-3-kyle@kyleam.com>
-rw-r--r--piem.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/piem.el b/piem.el
index 1640f46..693c951 100644
--- a/piem.el
+++ b/piem.el
@@ -373,6 +373,13 @@ buffer."
;;;; Maildir injection
+(defvar piem--has-gunzip)
+(defun piem-check-gunzip ()
+ "Return non-nil if gunzip is available."
+ (unless (boundp 'piem--has-gunzip)
+ (setq piem--has-gunzip (executable-find "gunzip")))
+ piem--has-gunzip)
+
(defun piem--write-mbox-to-maildir ()
(let ((n-messages 0))
(while (and (not (eobp))
@@ -421,8 +428,6 @@ buffer."
(and (buffer-live-p buffer)
(kill-buffer buffer)))))
-(defvar piem--has-gunzip)
-
;;;###autoload
(defun piem-inject-thread-into-maildir (mid &optional message-only)
"Inject thread containing MID into `piem-maildir-directory'.
@@ -436,15 +441,13 @@ This function depends on :url being configured for entries in
(list (or (piem-mid)
(user-error "No message ID found for the current buffer"))
current-prefix-arg))
- (unless (or message-only (boundp 'piem--has-gunzip))
- (setq piem--has-gunzip (executable-find "gunzip")))
(cond
((not piem-maildir-directory)
(user-error "`piem-maildir-directory' is not configured"))
((not (piem-maildir-dir-is-maildir-p piem-maildir-directory))
(user-error
"`piem-maildir-directory' does not look like a Maildir directory"))
- ((not (or message-only piem--has-gunzip))
+ ((not (or message-only (piem-check-gunzip)))
(user-error "gunzip executable not found")))
(url-retrieve (concat (or (piem-inbox-url)
(user-error