summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-05-09 23:37:47 -0400
committerKyle Meyer <kyle@kyleam.com>2020-05-10 22:45:29 -0400
commit8b7617c5aeb720a94f79ccc7201fd5ee042a5635 (patch)
tree1c1ae7f81bb307189b9e7c34851cdbd288efe1a1
parent33a7b658e537683d892bc195b463435199595a3a (diff)
downloadpiem-8b7617c5aeb720a94f79ccc7201fd5ee042a5635.tar.gz
b4: Rework handling of output file naming
When passing a name like "a.mbx" to b4-am's --mbox-name, only the "a" is retained; b4-am unconditionally appends the ".mbx". Avoid passing a name with ".mbx" to make it clearer that the caller does not control the extension. Reduce the base name to "m" to avoid a message ID ending with ".*" being treated as an extension, which would require analyzing the message ID in order to guess what output name b4-am will use. Finally, name the custom thread mbox with "-piem" rather than "-thread" (which was chosen to mimic b4-mbox) so it's more obvious who created the file when later inspecting the directory.
-rw-r--r--piem-b4.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/piem-b4.el b/piem-b4.el
index e085848..bbd7cb2 100644
--- a/piem-b4.el
+++ b/piem-b4.el
@@ -83,11 +83,10 @@
;; default to using that, but it should still be an option to use b4
;; so that we honor its customization/URL resolution.
(defun piem-b4--get-mbox-file (mid coderepo args)
- (let* ((mbox-name (format "%s.mbx" mid))
- (outdir (file-name-as-directory
+ (let* ((outdir (file-name-as-directory
(make-temp-file "piem-b4-" t)))
- (mbox-am (concat outdir mbox-name))
- (mbox-thread (concat mbox-am "-thread"))
+ (root (concat outdir "m"))
+ (mbox-thread (concat root "-piem"))
(custom-p nil))
(when-let ((fn (run-hook-with-args-until-success
'piem-mid-to-thread-functions mid)))
@@ -102,11 +101,12 @@
(and custom-p
(concat "--use-local-mbox=" mbox-thread))
(concat "--outdir=" outdir)
- (concat "--mbox-name=" mbox-name)
+ (concat "--mbox-name=m")
(append args (list mid))))
- (unless (file-exists-p mbox-am)
- (error "Expected mbox file does not exist: %s" mbox-am))
- mbox-am))
+ (let ((mbox-am (concat root ".mbx")))
+ (if (file-exists-p mbox-am)
+ mbox-am
+ (error "Expected mbox file does not exist: %s" mbox-am)))))
;;; Commands