From 27495eeb67515f8dac0e7449aa2165272e8ebe5a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 22 Nov 2020 15:46:08 -0500 Subject: Use when-let in a few more spots Message-Id: <20201122204609.12604-4-kyle@kyleam.com> --- piem-gnus.el | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'piem-gnus.el') diff --git a/piem-gnus.el b/piem-gnus.el index c1551ce..ca128fb 100644 --- a/piem-gnus.el +++ b/piem-gnus.el @@ -65,33 +65,31 @@ message itself if it looks like a patch." (when (derived-mode-p 'gnus-article-mode 'gnus-summary-mode) (cond (gnus-article-mime-handles - (let ((patches - (delq nil - (mapcar (lambda (handle) - (and (listp handle) - (piem-am-patch-attachment-p - (mm-handle-media-type handle)) - (with-temp-buffer - (mm-display-inline handle) - (buffer-substring-no-properties - (point-min) (point-max))))) - gnus-article-mime-handles)))) - (when patches - (cons (lambda () - (dolist (patch patches) - (insert patch))) - "mbox")))) + (when-let ((patches + (delq nil + (mapcar (lambda (handle) + (and (listp handle) + (piem-am-patch-attachment-p + (mm-handle-media-type handle)) + (with-temp-buffer + (mm-display-inline handle) + (buffer-substring-no-properties + (point-min) (point-max))))) + gnus-article-mime-handles)))) + (cons (lambda () + (dolist (patch patches) + (insert patch))) + "mbox"))) (gnus-article-buffer - (let ((patch (with-current-buffer gnus-article-buffer - (save-restriction - (widen) - (and (string-match-p piem-patch-subject-re - (message-field-value "subject")) - (buffer-substring-no-properties - (point-min) (point-max))))))) - (when patch - (cons (lambda () (insert patch)) - "mbox"))))))) + (when-let ((patch (with-current-buffer gnus-article-buffer + (save-restriction + (widen) + (and (string-match-p piem-patch-subject-re + (message-field-value "subject")) + (buffer-substring-no-properties + (point-min) (point-max))))))) + (cons (lambda () (insert patch)) + "mbox")))))) ;;;###autoload (define-minor-mode piem-gnus-mode -- cgit v1.2.3