diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-08-16 21:33:40 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-08-17 20:23:20 -0400 |
commit | e37abb4e89952a919722237b5786102cf956a84e (patch) | |
tree | ddf5d0c01a0ac1e86acfef2cc3ebfa922fb522ee | |
parent | 1b5a531adbda35ed5de03c8c06d26e6337dca05d (diff) | |
download | piem-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.el | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |