discussion and development of piem
 help / color / mirror / Atom feed
* [PATCH 2/5] Move "has gunzip?" check to helper
  2020-08-17  1:33 [PATCH 0/5] b4: Try to download thread from piem-inboxes URL Kyle Meyer
@ 2020-08-17  1:33 ` Kyle Meyer
  0 siblings, 0 replies; only message in thread
From: Kyle Meyer @ 2020-08-17  1:33 UTC (permalink / raw)
  To: piem

This will be needed in another spot.
---
 piem.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/piem.el b/piem.el
index bcbec78..4b35938 100644
--- a/piem.el
+++ b/piem.el
@@ -365,6 +365,13 @@ (defun piem-am-ready-mbox ()
 \f
 ;;;; 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))
@@ -413,8 +420,6 @@ (defun piem--inject-thread-callback (status mid message-only)
       (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'.
@@ -428,15 +433,13 @@ (defun piem-inject-thread-into-maildir (mid &optional message-only)
    (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
-- 
2.28.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-17  1:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  1:33 [PATCH 0/5] b4: Try to download thread from piem-inboxes URL Kyle Meyer
2020-08-17  1:33 ` [PATCH 2/5] Move "has gunzip?" check to helper Kyle Meyer

discussion and development of piem

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.kyleam.com/piem/0 piem/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 piem piem/ https://inbox.kyleam.com/piem \
		piem@inbox.kyleam.com
	public-inbox-index piem

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.piem


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git