discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Subject: [PATCH 3/5] piem-gunzip-buffer: Check for gunzip executable
Date: Sun, 23 May 2021 17:46:21 -0400	[thread overview]
Message-ID: <20210523214623.31331-4-kyle@kyleam.com> (raw)
In-Reply-To: <20210523214623.31331-1-kyle@kyleam.com>

Make piem-gunzip-buffer handle the executable check so that callers
don't have to worry about it.
---
 piem-b4.el | 1 -
 piem.el    | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/piem-b4.el b/piem-b4.el
index 92ddea8..e76953e 100644
--- a/piem-b4.el
+++ b/piem-b4.el
@@ -73,7 +73,6 @@ (defun piem-b4--get-am-files (mid coderepo args)
     ;; back to b4's configuration.
     (unless local-mbox-p
       (when-let ((url (and (equal mid (piem-mid))
-                           (piem-check-gunzip)
                            (piem-inbox-get :url))))
         (ignore-errors
           (piem-with-url-contents
diff --git a/piem.el b/piem.el
index 7b98005..20f2f8b 100644
--- a/piem.el
+++ b/piem.el
@@ -536,6 +536,8 @@ (defun piem-check-gunzip ()
   piem--has-gunzip)
 
 (defun piem-gunzip-buffer ()
+  (unless (piem-check-gunzip)
+    (user-error "gunzip executable not found"))
   (goto-char (point-min))
   (unless (= 0 (call-process-region nil nil "gunzip" nil t))
     (error "Decompressing t.mbox.gz failed"))
@@ -630,9 +632,7 @@ (defun piem-inject-thread-into-maildir (mid &optional message-only)
       (user-error "No directory returned by `piem-inbox-maildir-directory'"))
      ((not (piem-maildir-dir-is-maildir-p maildir-directory))
       (user-error
-       "Does not look like a Maildir directory: %s" maildir-directory))
-     ((not (or message-only (piem-check-gunzip)))
-      (user-error "gunzip executable not found")))
+       "Does not look like a Maildir directory: %s" maildir-directory)))
     (let ((url (concat (piem-mid-url mid)
                        (if message-only "/raw" "/t.mbox.gz"))))
       (piem-with-url-contents url
-- 
2.31.1


  parent reply	other threads:[~2021-05-23 21:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-23 21:46 [PATCH 0/5] Rework url-retrieve-synchronously wrapper Kyle Meyer
2021-05-23 21:46 ` [PATCH 1/5] b4: Check for message ID match when using current buffer's URL Kyle Meyer
2021-05-23 21:46 ` [PATCH 2/5] Rework url-retrieve-synchronously wrapper Kyle Meyer
2021-05-23 21:46 ` Kyle Meyer [this message]
2021-05-23 21:46 ` [PATCH 4/5] piem-gunzip-buffer: Absorb caching of gunzip check Kyle Meyer
2021-05-23 21:46 ` [PATCH 5/5] piem-gunzip-buffer: Don't assume t.mbox.gz is being decompressed Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210523214623.31331-4-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.kyleam.com/piem/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).