aboutsummaryrefslogtreecommitdiff
path: root/piem.el
diff options
context:
space:
mode:
Diffstat (limited to 'piem.el')
-rw-r--r--piem.el26
1 files changed, 15 insertions, 11 deletions
diff --git a/piem.el b/piem.el
index 47944e4..63c358a 100644
--- a/piem.el
+++ b/piem.el
@@ -817,17 +817,21 @@ message for MID, not the entire thread."
;;;; Patch handling
(defun piem-am-extract-attached-patch (handle)
- "Return content for HANDLE if it looks like a patch."
- (and (listp handle)
- (let ((type (mm-handle-media-type handle))
- (filename (mm-handle-filename handle)))
- (or (member type '("text/x-diff" "text/x-patch"))
- (and filename
- (equal type "text/plain")
- (string-suffix-p ".patch" filename t))))
- (with-temp-buffer
- (mm-display-inline handle)
- (buffer-substring-no-properties (point-min) (point-max)))))
+ "Get the content for HANDLE if it looks like a patch.
+The return value is of the form (N . CONTENT), where N is the
+number at the start of the file name."
+ (when (listp handle)
+ (let ((type (mm-handle-media-type handle))
+ (filename (mm-handle-filename handle)))
+ (and (or (member type '("text/x-diff" "text/x-patch"))
+ (and filename
+ (equal type "text/plain")
+ (string-suffix-p ".patch" filename t)))
+ (with-temp-buffer
+ (mm-display-inline handle)
+ (cons
+ (string-to-number filename)
+ (buffer-substring-no-properties (point-min) (point-max))))))))
(defun piem-extract-mbox-info (&optional buffer)
"Collect information from message in BUFFER.