~rjarry/aerc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
6 5

[PATCH aerc v3] commands/msg: use selected message part for quote-reply and forward

Details
Message ID
<20240109160740.101581-1-s@sbinet.org>
DKIM signature
missing
Download raw message
Patch: +18 -9
use the currently selected message part (if any) as the original message
for quote-reply and forward.
honor viewer::alternatives if no message part was selected.

Signed-off-by: Sebastien Binet <s@sbinet.org>
---
 commands/msg/forward.go |  3 ++-
 commands/msg/reply.go   |  9 +--------
 commands/msg/utils.go   | 15 +++++++++++++++
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index 4147e8c..20e945c 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -143,11 +143,12 @@ func (f forward) Execute(args []string) error {
			f.Template = config.Templates.Forwards
		}

		part := lib.FindPlaintext(msg.BodyStructure, nil)
		part := getMessagePart(msg, widget)
		if part == nil {
			part = lib.FindFirstNonMultipart(msg.BodyStructure, nil)
			// if it's still nil here, we don't have a multipart msg, that's fine
		}

		err = addMimeType(msg, part, &original)
		if err != nil {
			return err
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 4b3e7c8..333b3e3 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -222,14 +222,7 @@ func (r reply) Execute(args []string) error {
			return nil
		}

		var part []int
		for _, mime := range config.Viewer.Alternatives {
			part = lib.FindMIMEPart(mime, msg.BodyStructure, nil)
			if part != nil {
				break
			}
		}

		part := getMessagePart(msg, widget)
		if part == nil {
			// mkey... let's get the first thing that isn't a container
			// if that's still nil it's either not a multipart msg (ok) or
diff --git a/commands/msg/utils.go b/commands/msg/utils.go
index 4269334..d6dffd5 100644
--- a/commands/msg/utils.go
+++ b/commands/msg/utils.go
@@ -6,6 +6,7 @@ import (

	"git.sr.ht/~rjarry/aerc/app"
	"git.sr.ht/~rjarry/aerc/commands"
	"git.sr.ht/~rjarry/aerc/config"
	"git.sr.ht/~rjarry/aerc/lib"
	"git.sr.ht/~rjarry/aerc/models"
)
@@ -59,3 +60,17 @@ func (h *helper) messages() ([]*models.MessageInfo, error) {
	}
	return commands.MsgInfoFromUids(store, uid, h.statusInfo)
}

func getMessagePart(msg *models.MessageInfo, provider app.ProvidesMessage) []int {
	p := provider.SelectedMessagePart()
	if p != nil {
		return p.Index
	}
	for _, mime := range config.Viewer.Alternatives {
		part := lib.FindMIMEPart(mime, msg.BodyStructure, nil)
		if part != nil {
			return part
		}
	}
	return nil
}
-- 
2.43.0

[aerc/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CYAB3W512L5D.WY3TI3MC3BU8@cirno2>
In-Reply-To
<20240109160740.101581-1-s@sbinet.org> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: SUCCESS in 4m55s

[commands/msg: use selected message part for quote-reply and forward][0] v3 from [Sebastien Binet][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/48450
[1]: s@sbinet.org

✓ #1130136 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1130136
✓ #1130135 SUCCESS aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1130135
Details
Message ID
<CYABB15AZIW1.78J8QK107P2N@gmail.com>
In-Reply-To
<20240109160740.101581-1-s@sbinet.org> (view parent)
DKIM signature
missing
Download raw message
On Tue Jan 9, 2024 at 4:06 PM UTC, Sebastien Binet wrote:
> use the currently selected message part (if any) as the original message
> for quote-reply and forward.
> honor viewer::alternatives if no message part was selected.
>
> Signed-off-by: Sebastien Binet <s@sbinet.org>
> ---

Thanks. LGTM!

Reviewed-by: Koni Marti <koni.marti@gmail.com>

Applied: [PATCH aerc v3] commands/msg: use selected message part for quote-reply and forward

Details
Message ID
<170548915744.431191.2993186554208848559@ringo>
In-Reply-To
<20240109160740.101581-1-s@sbinet.org> (view parent)
DKIM signature
pass
Download raw message
Sebastien Binet <s@sbinet.org> wrote:
> use the currently selected message part (if any) as the original message
> for quote-reply and forward.
> honor viewer::alternatives if no message part was selected.
>
> Signed-off-by: Sebastien Binet <s@sbinet.org>
> ---

Acked-by: Robin Jarry <robin@jarry.cc>

Applied, thanks.

To git@git.sr.ht:~rjarry/aerc
   680244d0533d..ec8b22b8eec4  master -> master

Re: Applied: [PATCH aerc v3] commands/msg: use selected message part for quote-reply and forward

Details
Message ID
<CZ4U2R7HFTKY.DMG1Y4UVW5VU@sindominio.net>
In-Reply-To
<170548915744.431191.2993186554208848559@ringo> (view parent)
DKIM signature
pass
Download raw message

On 17/01/2024, 11:59, Robin Jarry wrote:
> Sebastien Binet <s@sbinet.org> wrote:
> > use the currently selected message part (if any) as the original message
> > for quote-reply and forward.
> > honor viewer::alternatives if no message part was selected.

Is there a way to disable this behaviour, at least for attachments? It
is kinda annoying when you reply to a message while an attachment is
selected and this attachment it's a binary file of some sort... I'd have
expected a flag in the reply/forward commands. Sorry for not pointing
this out while the patch was being reviewed.

Re: Applied: [PATCH aerc v3] commands/msg: use selected message part for quote-reply and forward

Details
Message ID
<CZ4UYWTACPWC.2FC8EF0UNR0U6@sbinet.org>
In-Reply-To
<CZ4U2R7HFTKY.DMG1Y4UVW5VU@sindominio.net> (view parent)
DKIM signature
pass
Download raw message
On Wed Feb 14, 2024 at 14:24 CET, inwit wrote:
>
>
> On 17/01/2024, 11:59, Robin Jarry wrote:
> > Sebastien Binet <s@sbinet.org> wrote:
> > > use the currently selected message part (if any) as the original message
> > > for quote-reply and forward.
> > > honor viewer::alternatives if no message part was selected.
>
> Is there a way to disable this behaviour, at least for attachments? It
> is kinda annoying when you reply to a message while an attachment is
> selected and this attachment it's a binary file of some sort... I'd have
> expected a flag in the reply/forward commands. Sorry for not pointing
> this out while the patch was being reviewed.

see:
 https://lists.sr.ht/~rjarry/aerc-devel/patches/49490

as a tentative fix.

-s

Re: Applied: [PATCH aerc v3] commands/msg: use selected message part for quote-reply and forward

Details
Message ID
<CZ4ZKVPU6HUH.3CFIUGIWCZ6YR@sbinet.org>
In-Reply-To
<CZ4U2R7HFTKY.DMG1Y4UVW5VU@sindominio.net> (view parent)
DKIM signature
pass
Download raw message
On Wed Feb 14, 2024 at 14:24 CET, inwit wrote:
>
>
> On 17/01/2024, 11:59, Robin Jarry wrote:
> > Sebastien Binet <s@sbinet.org> wrote:
> > > use the currently selected message part (if any) as the original message
> > > for quote-reply and forward.
> > > honor viewer::alternatives if no message part was selected.
>
> Is there a way to disable this behaviour, at least for attachments? It
> is kinda annoying when you reply to a message while an attachment is
> selected and this attachment it's a binary file of some sort... I'd have
> expected a flag in the reply/forward commands. Sorry for not pointing
> this out while the patch was being reviewed.

I've sent a patch :
- https://lists.sr.ht/~rjarry/aerc-devel/patches/49490

but perhaps it's not so well advised.

-s
Reply to thread Export thread (mbox)