emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnorb ed9825e 034/449: Use map-y-or-n-p for attachment


From: Stefan Monnier
Subject: [elpa] externals/gnorb ed9825e 034/449: Use map-y-or-n-p for attachment actions
Date: Fri, 27 Nov 2020 23:15:03 -0500 (EST)

branch: externals/gnorb
commit ed9825e6638da58027fec45440952e07d5ebb947
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Use map-y-or-n-p for attachment actions
    
    gnorb-org.el: Both `gnorb-org-handle-mail' and `gnorb-org-email-subtree'
    
    gnorb-gnus.el: `gnorb-gnus-capture-attach'
---
 lisp/gnorb-gnus.el | 10 +++++++---
 lisp/gnorb-org.el  | 35 +++++++++++++++++++----------------
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index 2cc253c..7d862c9 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -113,9 +113,13 @@ save them into `gnorb-tmp-dir'."
     (require 'org-attach)
     (setq gnorb-gnus-capture-attachments nil)
     (gnorb-gnus-collect-all-attachments t)
-    (when gnorb-gnus-capture-attachments
-      (dolist (a gnorb-gnus-capture-attachments)
-       (org-attach-attach a nil 'mv)))))
+    (map-y-or-n-p
+     (lambda (a)
+       (format "Attach %s to capture heading? "
+              (file-name-nondirectory a)))
+     (lambda (a) (org-attach-attach a nil 'mv))
+     gnorb-gnus-capture-attachments
+     '("file" "files" "attach"))))
 
 (add-hook 'org-capture-mode-hook 'gnorb-gnus-capture-attach)
 
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index f7e16bb..373f6e7 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -118,14 +118,16 @@ point."
        (attachments (gnorb-org-attachment-list)))
     (gnorb-org-setup-message (first mail-stuff) (second mail-stuff))
     (message-goto-body)
-    (when attachments
-      (dolist (a attachments)
-       (and (yes-or-no-p
-             (format "Attach %s to outgoing message? "
-                     (file-name-nondirectory a)))
-            (mml-attach-file a
-             (mm-default-file-encoding a)
-             nil "attachment"))))))
+    (map-y-or-n-p
+     (lambda (a)
+       (format "Attach %s to outgoing message? "
+              (file-name-nondirectory a)))
+     (lambda (a)
+       (mml-attach-file
+       a (mm-default-file-encoding a)
+       nil "attachment"))
+     attachments
+     '("file" "files" "attach"))))
 
 (defun gnorb-org-handle-mail-agenda ()
   "Examine item at point for mail-related links, and handle them."
@@ -234,14 +236,15 @@ default set of parameters."
        result
        (mm-default-file-encoding result)
        nil "attachment"))
-    (when attachments
-      (dolist (a attachments)
-       (and (yes-or-no-p (format
-                          "Attach %s to outgoing message? "
-                          (file-name-nondirectory a)))
-            (mml-attach-file a
-                             (mm-default-file-encoding a)
-                             nil "attachment"))))))
+    (map-y-or-n-p
+     (lambda (a) (format "Attach %s to outgoing message? "
+                        (file-name-nondirectory a)))
+     (lambda (a)
+       (mml-attach-file
+       a (mm-default-file-encoding a)
+       nil "attachment"))
+     attachments
+     '("file" "files" "attach"))))
 
 (provide 'gnorb-org)
 ;;; gnorb-org.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]