unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: 69141@debbugs.gnu.org
Subject: bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
Date: Mon, 19 Feb 2024 15:54:22 +0000	[thread overview]
Message-ID: <878r3gbgb5.fsf@posteo.net> (raw)
In-Reply-To: <87bk8fq7w7.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 17 Feb 2024 10:10:16 -0800")

[-- Attachment #1: Type: text/plain, Size: 715 bytes --]

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> I use this command frequently, and am just as frequently mildly annoyed
>> that attachments are always added at the bottom of the message buffer,
>> instead of at point as is the case with 'mml-attach-file' (usually this
>> is mild enough that I'd immediately forget about it).  This patch allows
>> disabling the behaviour:
>
> This looks fine to me, thank you. Would you add a :version to the
> defcustom, and also a mention (with index entry) in the Gnus manual,
> "Interaction with other modes -> Dired"?
>
> I guess 'mail is a fine group for the defcustom, kind of hard to say.

How does this look like:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-attaching-files-at-point-using-gnus-dired-atta.patch --]
[-- Type: text/x-patch, Size: 2219 bytes --]

From a61cf2688bc952864a5c394a4f06b64c48a906e2 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 15 Feb 2024 12:10:12 +0100
Subject: [PATCH] Allow attaching files at point using 'gnus-dired-attach'

* 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)
---
 doc/misc/gnus.texi      | 5 ++++-
 lisp/gnus/gnus-dired.el | 9 ++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 2f8f97e5845..98196310b5c 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -26695,9 +26695,12 @@ Other modes
 @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
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index 48c1aef968b..f33c5f7f2e5 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -111,6 +111,12 @@ gnus-dired-mail-buffers
 
 (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 @@ gnus-dired-attach
 
       ;; 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))
-- 
2.43.0


  reply	other threads:[~2024-02-19 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 11:12 bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach' Philip Kaludercic
2024-02-17 18:10 ` Eric Abrahamsen
2024-02-19 15:54   ` Philip Kaludercic [this message]
2024-02-19 16:21     ` Eric Abrahamsen
2024-02-19 19:02       ` Philip Kaludercic
2024-02-19 16:52     ` Eli Zaretskii
2024-02-19 19:00     ` Stefan Kangas
2024-02-19 19:02       ` Philip Kaludercic
2024-02-19 20:33         ` Stefan Kangas
2024-02-20  2:22           ` Visuwesh
2024-02-26 10:15           ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878r3gbgb5.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=69141@debbugs.gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).