* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
@ 2024-02-15 11:12 Philip Kaludercic
2024-02-17 18:10 ` Eric Abrahamsen
0 siblings, 1 reply; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-15 11:12 UTC (permalink / raw)
To: 69141
[-- Attachment #1: Type: text/plain, Size: 314 bytes --]
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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Allow attaching files at point using 'gnus-dired-attach' --]
[-- Type: text/x-patch, Size: 1416 bytes --]
From 9a5e9c51e74a278580eb670769b6093388a6109a 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.
---
lisp/gnus/gnus-dired.el | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index 48c1aef968b..740caab349d 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -111,6 +111,11 @@ 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?
+ :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 +166,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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
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
0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2024-02-17 18:10 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: 69141
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-17 18:10 ` Eric Abrahamsen
@ 2024-02-19 15:54 ` Philip Kaludercic
2024-02-19 16:21 ` Eric Abrahamsen
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-19 15:54 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: 69141
[-- 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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 15:54 ` Philip Kaludercic
@ 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
2 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2024-02-19 16:21 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: 69141
On 02/19/24 15:54 PM, Philip Kaludercic wrote:
> 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:
Looks good! Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 15:54 ` Philip Kaludercic
2024-02-19 16:21 ` Eric Abrahamsen
@ 2024-02-19 16:52 ` Eli Zaretskii
2024-02-19 19:00 ` Stefan Kangas
2 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2024-02-19 16:52 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: eric, 69141
> Cc: 69141@debbugs.gnu.org
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Mon, 19 Feb 2024 15:54:22 +0000
>
> 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:
Just as comment from the sidelines, by someone who doesn't use Gnus:
isn't this quite a bit of ado about very little? AFAIK and IME, the
way attachments are shown on the receiving end is completely up to MUA
on that end; having them embedded inside the body of the email message
doesn't necessarily mean it will be shown as part of the message. In
fact, there are widely used MUAs out there which will always show
attachments on a specially-assigned spot of the MUA display. So the
usability of this option seems to have a known effect on a couple of
Emacs based MUAs, and otherwise all bets are off. Right?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 15:54 ` Philip Kaludercic
2024-02-19 16:21 ` Eric Abrahamsen
2024-02-19 16:52 ` Eli Zaretskii
@ 2024-02-19 19:00 ` Stefan Kangas
2024-02-19 19:02 ` Philip Kaludercic
2 siblings, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2024-02-19 19:00 UTC (permalink / raw)
To: Philip Kaludercic, Eric Abrahamsen; +Cc: 69141
Philip Kaludercic <philipk@posteo.net> writes:
> How does this look like:
Thanks for fixing this longstanding issue with `gnus-dired-attach'.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 19:00 ` Stefan Kangas
@ 2024-02-19 19:02 ` Philip Kaludercic
2024-02-19 20:33 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-19 19:02 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Eric Abrahamsen, 69141
Stefan Kangas <stefankangas@gmail.com> writes:
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> How does this look like:
>
> Thanks for fixing this longstanding issue with `gnus-dired-attach'.
I am glad to know that I wasn't the only one annoyed by this minor and
extremely easy-to-fix issue ^^
Do you think it would be OK to modify the default behaviour? If so, I
guess we should mention it in NEWS and point out how to restore the old
behaviour, for anyone would really needs it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 16:21 ` Eric Abrahamsen
@ 2024-02-19 19:02 ` Philip Kaludercic
0 siblings, 0 replies; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-19 19:02 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: 69141-done
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> On 02/19/24 15:54 PM, Philip Kaludercic wrote:
>> 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:
>
> Looks good! Thanks.
Pushed, thank you for your comments.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
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
0 siblings, 2 replies; 11+ messages in thread
From: Stefan Kangas @ 2024-02-19 20:33 UTC (permalink / raw)
To: Philip Kaludercic; +Cc: Eric Abrahamsen, 69141
Philip Kaludercic <philipk@posteo.net> writes:
> Do you think it would be OK to modify the default behaviour? If so, I
> guess we should mention it in NEWS and point out how to restore the old
> behaviour, for anyone would really needs it.
I'm not sure it's worth changing it, because other attach commands in
message-mode adds attachments in place, which kind of makes sense if you
are dealing with in-line images. So I can realistically see users
wanting either behaviour, and providing an option does that.
WDYT?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 20:33 ` Stefan Kangas
@ 2024-02-20 2:22 ` Visuwesh
2024-02-26 10:15 ` Philip Kaludercic
1 sibling, 0 replies; 11+ messages in thread
From: Visuwesh @ 2024-02-20 2:22 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Eric Abrahamsen, Philip Kaludercic, 69141
[திங்கள் பிப்ரவரி 19, 2024] Stefan Kangas wrote:
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Do you think it would be OK to modify the default behaviour? If so, I
>> guess we should mention it in NEWS and point out how to restore the old
>> behaviour, for anyone would really needs it.
>
> I'm not sure it's worth changing it, because other attach commands in
> message-mode adds attachments in place, which kind of makes sense if you
> are dealing with in-line images. So I can realistically see users
> wanting either behaviour, and providing an option does that.
>
> WDYT?
Although as Eli pointed, the place where the attachment shows up is
completely up to the MUA, I always found it annoying that the dired
command attaches it at the end since it made it (1) hard for me to know
whether I attached the file, and (2) hard to present the attachment in a
relevant place to other Gnus others. So I ended up resorting to
drag-n-drop from dired (now I use yank-media to attach copied files in
clipboard). I wouldn't mind having this new defcustom default to nil.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#69141: [PATCH] Allow attaching files at point using 'gnus-dired-attach'
2024-02-19 20:33 ` Stefan Kangas
2024-02-20 2:22 ` Visuwesh
@ 2024-02-26 10:15 ` Philip Kaludercic
1 sibling, 0 replies; 11+ messages in thread
From: Philip Kaludercic @ 2024-02-26 10:15 UTC (permalink / raw)
To: Stefan Kangas; +Cc: Eric Abrahamsen, 69141
Stefan Kangas <stefankangas@gmail.com> writes:
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Do you think it would be OK to modify the default behaviour? If so, I
>> guess we should mention it in NEWS and point out how to restore the old
>> behaviour, for anyone would really needs it.
>
> I'm not sure it's worth changing it, because other attach commands in
> message-mode adds attachments in place, which kind of makes sense if you
> are dealing with in-line images. So I can realistically see users
> wanting either behaviour, and providing an option does that.
>
> WDYT?
The argument for changing it would precisely be to be more consistent
with what other commands do. The argument against it, as usual, would
be that it could conceivably break someones workflow.
--
Philip Kaludercic on peregrine
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-02-26 10:15 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.