]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow attaching files at point using 'gnus-dired-attach'
authorPhilip Kaludercic <philipk@posteo.net>
Thu, 15 Feb 2024 11:10:12 +0000 (12:10 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 28 Feb 2024 17:36:39 +0000 (18:36 +0100)
* lisp/gnus/gnus-dired.el (gnus-dired-attach-at-end): Add option.
(gnus-dired-attach): Respect it.
* doc/misc/gnus.texi (Other modes): Document it.  (Bug#69141)

(cherry picked from commit 6893106fe9302b1be68dd04034441799e6d29b68)

doc/misc/gnus.texi
lisp/gnus/gnus-dired.el

index 2f8f97e58454a0f599d6e7b720eeab1c2a3145b1..98196310b5c4a695c2c62e0ea6a3445c6dbd3121 100644 (file)
@@ -26695,9 +26695,12 @@ buffers.  It is enabled with
 @table @kbd
 @item C-c C-m C-a
 @findex gnus-dired-attach
+@vindex gnus-dired-attach-at-end
 @cindex attachments, selection via dired
 Send dired's marked files as an attachment (@code{gnus-dired-attach}).
-You will be prompted for a message buffer.
+You will be prompted for a message buffer.  By default it will attach
+files to the end of the message buffer, but you can modify that
+behaviour by customising @code{gnus-dired-attach-at-end}.
 
 @item C-c C-m C-l
 @findex gnus-dired-find-file-mailcap
index 48c1aef968b164ba24d8d4c24a40b9a6173eb9f5..f33c5f7f2e5620544559d899eeb45ecb91abe57e 100644 (file)
@@ -111,6 +111,12 @@ See `mail-user-agent' for more information."
 
 (autoload 'gnus-completing-read "gnus-util")
 
+(defcustom gnus-dired-attach-at-end t
+  "Non-nil means that files should be attached at the end of a buffer."
+  :group 'mail ;; dired?
+  :version "30.1"
+  :type 'boolean)
+
 ;; Method to attach files to a mail composition.
 (defun gnus-dired-attach (files-to-attach)
   "Attach dired's marked files to a gnus message composition.
@@ -161,7 +167,8 @@ filenames."
 
       ;; set buffer to destination buffer, and attach files
       (set-buffer destination)
-      (goto-char (point-max))          ;attach at end of buffer
+      (when gnus-dired-attach-at-end
+        (goto-char (point-max)))               ;attach at end of buffer
       (while files-to-attach
        (mml-attach-file (car files-to-attach)
                         (or (mm-default-file-type (car files-to-attach))