~sircmpwn/aerc

Stop wrapping OriginalText in default templates v1 PROPOSED

Nguyễn Gia Phong: 2
 Stop wrapping OriginalText in default templates
 Remove redundant toLocal as format includes TZ

 3 files changed, 3 insertions(+), 3 deletions(-)
Not sure I follow your reasoning:

```
package main

import (
	"fmt"
	"log"
	"time"
)

func main() {
	format := "Mon Jan 2, 2006 at 3:04 PM MST"
	date := time.Now()
	fmt.Println(date.Format(format)) // Fri Mar 26, 2021 at 5:52 PM CET

	loc, err := time.LoadLocation("MST")
	if err != nil {
		log.Fatalf("%#v", err)
	}
	mstDate := date.In(loc)
	fmt.Println(mstDate.Format(format)) // Fri Mar 26, 2021 at 9:52 AM MST
}
```

The TZ in the format string just instructs go to add the TZ string, it doesn't
impact what TZ the date is actually in, *that's* what toLocal does in aerc.

Or am I missing what you actually want to achieve?

Cheers,
Reto
Thank you for the explanation, there was some mistake when I was
experimenting with it.  Does the parent commit make sense though,
and should I resend the patch without this child commit?


The problem with wrap is that it tries to split the orignal message
by whitespace, which makes quoted patches differs from the original.
I noticed this by that lists.sr.ht cannot automatically display
where the review is supposed to be.

That being said, my local template without wrapping is working fine,
and the change is trivial, I see no reason pushing for it any further.
Cheers.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/21495/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH 1/2] Stop wrapping OriginalText in default templates Export this patch

Wrapping embeded code or patches could mess up the content.
---
 templates/forward_as_body | 2 +-
 templates/quoted_reply    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/forward_as_body b/templates/forward_as_body
index efbe2a3..42f5835 100644
--- a/templates/forward_as_body
+++ b/templates/forward_as_body
@@ -1,3 +1,3 @@

Forwarded message from {{(index .OriginalFrom 0).Name}} on {{dateFormat .OriginalDate "Mon Jan 2, 2006 at 3:04 PM"}}:
{{wrap 72 .OriginalText}}
{{.OriginalText}}
diff --git a/templates/quoted_reply b/templates/quoted_reply
index 5587726..9fb7121 100644
--- a/templates/quoted_reply
+++ b/templates/quoted_reply
@@ -1,3 +1,3 @@

On {{dateFormat (.OriginalDate | toLocal) "Mon Jan 2, 2006 at 3:04 PM MST"}}, {{(index .OriginalFrom 0).Name}} wrote:
{{wrap 72 .OriginalText | quote}}
{{quote .OriginalText}}
-- 
2.31.0

[PATCH 2/2] Remove redundant toLocal as format includes TZ Export this patch

---
 templates/quoted_reply | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/quoted_reply b/templates/quoted_reply
index 9fb7121..8c4655f 100644
--- a/templates/quoted_reply
+++ b/templates/quoted_reply
@@ -1,3 +1,3 @@

On {{dateFormat (.OriginalDate | toLocal) "Mon Jan 2, 2006 at 3:04 PM MST"}}, {{(index .OriginalFrom 0).Name}} wrote:
On {{dateFormat .OriginalDate "Mon Jan 2, 2006 at 3:04 PM MST"}}, {{(index .OriginalFrom 0).Name}} wrote:
{{quote .OriginalText}}
-- 
2.31.0
Not sure I follow your reasoning:

```
package main

import (
	"fmt"
	"log"
	"time"
)

func main() {
	format := "Mon Jan 2, 2006 at 3:04 PM MST"
	date := time.Now()
	fmt.Println(date.Format(format)) // Fri Mar 26, 2021 at 5:52 PM CET

	loc, err := time.LoadLocation("MST")
	if err != nil {
		log.Fatalf("%#v", err)
	}
	mstDate := date.In(loc)
	fmt.Println(mstDate.Format(format)) // Fri Mar 26, 2021 at 9:52 AM MST
}
```

The TZ in the format string just instructs go to add the TZ string, it doesn't
impact what TZ the date is actually in, *that's* what toLocal does in aerc.

Or am I missing what you actually want to achieve?

Cheers,
Reto