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

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

[elpa] externals/gnorb 056a767 442/449: [gnorb] Improvements to gnorb-or


From: Stefan Monnier
Subject: [elpa] externals/gnorb 056a767 442/449: [gnorb] Improvements to gnorb-org-setup-message
Date: Fri, 27 Nov 2020 23:16:29 -0500 (EST)

branch: externals/gnorb
commit 056a767b4785447b8cb5886ed00a6e228c7dff02
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    [gnorb] Improvements to gnorb-org-setup-message
    
    * packages/gnorb/gnorb-org.el (gnorb-org-setup-message): Accept an
    optional NOPROMPT argument that will attach all files unconditionally.
    Do a better job of adding extra headers correctly, without snarfing
    newlines. Don't add a newline before inserting text (why was I doing
    that?).
---
 gnorb-org.el | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/gnorb-org.el b/gnorb-org.el
index 7f51bb2..9c97af2 100644
--- a/gnorb-org.el
+++ b/gnorb-org.el
@@ -297,7 +297,7 @@ subtree (or REGION) for links, and use those instead."
 (defvar message-beginning-of-line)
 
 (defun gnorb-org-setup-message
-    (&optional messages mails from cc bcc attachments text ids)
+    (&optional messages mails from cc bcc attachments text ids noprompt)
   "Common message setup routine for other gnorb-org commands.
 MESSAGES is a list of gnus links pointing to messages -- we
 currently only use the first of the list. MAILS is a list of
@@ -334,25 +334,26 @@ headings."
                  (funcall (intern (format "message-goto-%s" (car h))))
                  (let ((message-beginning-of-line t)
                        (show-trailing-whitespace t))
-                   (message-beginning-of-line)
-                   (unless (bolp)
-                     (kill-line))
+                   (message-beginning-of-header t)
                    (insert (cdr h))))))
     (dolist (h `((from . ,from) (cc . ,cc) (bcc . ,bcc)))
       (sh h)))
   ;; attach ATTACHMENTS
-  (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"))
+  (if noprompt
+      (dolist (a attachments)
+       (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")))
   ;; insert text, if any
   (when text
     (message-goto-body)
-    (insert "\n")
     (if (bufferp text)
        (insert-buffer-substring text)
       (insert text)))



reply via email to

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