unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Emacs: text/calendar rendering fix
@ 2024-05-29 10:15 David Bremner
  2024-05-29 10:15 ` [PATCH 1/4] test/corpora: add example with text/calendar attachment David Bremner
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Bremner @ 2024-05-29 10:15 UTC (permalink / raw)
  To: notmuch

The actual fix here is quite trivial, but it takes some work to test.
Compared to the previous version in the thread at [1], this updates
the 3rd patch in the series to actually duplicate the problem, and
adds the 4th patch with the actual fix.

[1]: id:m2wmneguh8.fsf@gmail.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] test/corpora: add example with text/calendar attachment
  2024-05-29 10:15 Emacs: text/calendar rendering fix David Bremner
@ 2024-05-29 10:15 ` David Bremner
  2024-05-29 10:15 ` [PATCH 2/4] test/emacs: add regression test for display of calendar parts David Bremner
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2024-05-29 10:15 UTC (permalink / raw)
  To: notmuch

Initially for testing rendering in Emacs.
---
 test/corpora/attachment/text-calendar.eml | 55 +++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 test/corpora/attachment/text-calendar.eml

diff --git a/test/corpora/attachment/text-calendar.eml b/test/corpora/attachment/text-calendar.eml
new file mode 100644
index 00000000..8e064f9b
--- /dev/null
+++ b/test/corpora/attachment/text-calendar.eml
@@ -0,0 +1,55 @@
+From: David Bremner <bremner@example.com>
+To: "david@tethera.net" <david@tethera.net>
+Subject: test
+Date: Thu Jan 01 00:00:10 +0000
+Message-ID:
+ <YT3PR01MB10572EFC9F7C81F9446214768CEF72@YT3PR01MB10572.CANPRD01.PROD.OUTLOOK.COM>
+Accept-Language: en-CA, en-US
+Content-Language: en-CA
+Content-Type: multipart/alternative;
+	boundary="_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_"
+MIME-Version: 1.0
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_
+Content-Type: text/plain; charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+This meeting will could have been an email
+
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_
+Content-Type: text/calendar; charset="utf-8"; method=REQUEST
+Content-Transfer-Encoding: base64
+
+QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVRVUVTVA0KUFJPRElEOk1pY3Jvc29mdCBFeGNoYW5n
+ZSBTZXJ2ZXIgMjAxMA0KVkVSU0lPTjoyLjANCkJFR0lOOlZUSU1FWk9ORQ0KVFpJRDpBdGxhbnRp
+YyBTdGFuZGFyZCBUaW1lDQpCRUdJTjpTVEFOREFSRA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDAN
+ClRaT0ZGU0VURlJPTTotMDMwMA0KVFpPRkZTRVRUTzotMDQwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7
+SU5URVJWQUw9MTtCWURBWT0xU1U7QllNT05USD0xMQ0KRU5EOlNUQU5EQVJEDQpCRUdJTjpEQVlM
+SUdIVA0KRFRTVEFSVDoxNjAxMDEwMVQwMjAwMDANClRaT0ZGU0VURlJPTTotMDQwMA0KVFpPRkZT
+RVRUTzotMDMwMA0KUlJVTEU6RlJFUT1ZRUFSTFk7SU5URVJWQUw9MTtCWURBWT0yU1U7QllNT05U
+SD0zDQpFTkQ6REFZTElHSFQNCkVORDpWVElNRVpPTkUNCkJFR0lOOlZFVkVOVA0KT1JHQU5JWkVS
+O0NOPURhdmlkIEJyZW1uZXI6bWFpbHRvOmJyZW1uZXJAZXhhbXBsZS5jb20NCkFUVEVOREVFO1JP
+TEU9UkVRLVBBUlRJQ0lQQU5UO1BBUlRTVEFUPU5FRURTLUFDVElPTjtSU1ZQPVRSVUU7Q049ZGF2
+aWRAdGV0aA0KIGVyYS5uZXQ6bWFpbHRvOmRhdmlkQHRldGhlcmEubmV0DQpERVNDUklQVElPTj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OT1RGT1JXQVJETUVFVElORzpGQUxTRQ0KWC1NSUNST1NPRlQtRElT
+QUxMT1ctQ09VTlRFUjpGQUxTRQ0KWC1NSUNST1NPRlQtUkVRVUVTVEVEQVRURU5EQU5DRU1PREU6
+SU5QRVJTT05SRVFVSVJFRA0KWC1NSUNST1NPRlQtSVNSRVNQT05TRVJFUVVFU1RFRDpUUlVFDQpY
+LU1JQ1JPU09GVC1MT0NBVElPTlM6W10NCkJFR0lOOlZBTEFSTQ0KREVTQ1JJUFRJT046UkVNSU5E
+RVINClRSSUdHRVI7UkVMQVRFRD1TVEFSVDotUFQxNU0NCkFDVElPTjpESVNQTEFZDQpFTkQ6VkFM
+QVJNDQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVOREFSDQo=
+
+--_000_YT3PR01MB10572EFC9F7C81F9446214768CEF72YT3PR01MB10572CA_--
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] test/emacs: add regression test for display of calendar parts.
  2024-05-29 10:15 Emacs: text/calendar rendering fix David Bremner
  2024-05-29 10:15 ` [PATCH 1/4] test/corpora: add example with text/calendar attachment David Bremner
@ 2024-05-29 10:15 ` David Bremner
  2024-05-29 10:15 ` [PATCH 3/4] test/emacs: add tests for rendering text/calendar parts David Bremner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2024-05-29 10:15 UTC (permalink / raw)
  To: notmuch

This will hopefully catch breakage due to either changes in
Emacs (especially Gnus) or changes to the notmuch-show code.
---
 test/T450-emacs-show.sh | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 559df8aa..438a7b9b 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -318,6 +318,28 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE"
 
 add_email_corpus attachment
 
+test_begin_subtest "display of text/calendar"
+test_emacs '(let ((notmuch-show-all-multipart/alternative-parts t))
+	   (notmuch-show "id:YT3PR01MB10572EFC9F7C81F9446214768CEF72@YT3PR01MB10572.CANPRD01.PROD.OUTLOOK.COM"))
+	(test-visible-output "OUTPUT")'
+cat <<EOF > EXPECTED
+David Bremner <bremner@example.com> (1970-01-01) (inbox)
+Subject: test
+To: "david@tethera.net" <david@tethera.net>
+Date: Thu, 01 Jan 1970 00:00:00 +0000
+
+[ multipart/alternative ]
+[ text/plain ]
+This meeting will could have been an email
+[ text/calendar ]
+%%(and (diary-cyclic 1 5 27 2024) (diary-block 5 27 2024 8 27 2024)) 17:00-17:30 test [In-person]
+ Desc: This meeting will could have been an email
+
+
+ Organizer: mailto:bremner@example.com
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "tar not inlined by default"
 test_emacs '(notmuch-show "id:874llc2bkp.fsf@curie.anarc.at")
 	(test-visible-output "OUTPUT")'
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] test/emacs: add tests for rendering text/calendar parts
  2024-05-29 10:15 Emacs: text/calendar rendering fix David Bremner
  2024-05-29 10:15 ` [PATCH 1/4] test/corpora: add example with text/calendar attachment David Bremner
  2024-05-29 10:15 ` [PATCH 2/4] test/emacs: add regression test for display of calendar parts David Bremner
@ 2024-05-29 10:15 ` David Bremner
  2024-05-29 10:15 ` [PATCH 4/4] emacs/show: fix for text/calendar display David Bremner
  2024-06-15 17:45 ` Emacs: text/calendar rendering fix David Bremner
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2024-05-29 10:15 UTC (permalink / raw)
  To: notmuch

The first test is just a general regression test, while the second
duplicates the problem discussed in the thread starting at [1].

[1]: id:m2leo2u0uo.fsf@gmail.com
---
 test/T450-emacs-show.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 438a7b9b..027062cd 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -340,6 +340,33 @@ This meeting will could have been an email
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "display of text/calendar, symlinked tmpdir"
+test_subtest_known_broken
+mkdir real-tmp
+ln -s real-tmp tmp
+test_emacs "(let ((notmuch-show-all-multipart/alternative-parts t)
+	          (temporary-file-directory \"tmp\")
+	          (find-file-visit-truename t))
+	     (notmuch-show \"id:YT3PR01MB10572EFC9F7C81F9446214768CEF72@YT3PR01MB10572.CANPRD01.PROD.OUTLOOK.COM\"))
+	    (test-visible-output \"OUTPUT\")"
+cat <<EOF > EXPECTED
+David Bremner <bremner@example.com> (1970-01-01) (inbox)
+Subject: test
+To: "david@tethera.net" <david@tethera.net>
+Date: Thu, 01 Jan 1970 00:00:00 +0000
+
+[ multipart/alternative ]
+[ text/plain ]
+This meeting will could have been an email
+[ text/calendar ]
+%%(and (diary-cyclic 1 5 27 2024) (diary-block 5 27 2024 8 27 2024)) 17:00-17:30 test [In-person]
+ Desc: This meeting will could have been an email
+
+
+ Organizer: mailto:bremner@example.com
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "tar not inlined by default"
 test_emacs '(notmuch-show "id:874llc2bkp.fsf@curie.anarc.at")
 	(test-visible-output "OUTPUT")'
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] emacs/show: fix for text/calendar display
  2024-05-29 10:15 Emacs: text/calendar rendering fix David Bremner
                   ` (2 preceding siblings ...)
  2024-05-29 10:15 ` [PATCH 3/4] test/emacs: add tests for rendering text/calendar parts David Bremner
@ 2024-05-29 10:15 ` David Bremner
  2024-06-15 17:45 ` Emacs: text/calendar rendering fix David Bremner
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2024-05-29 10:15 UTC (permalink / raw)
  To: notmuch

In certain scenarios involving symlinks and setting
find-file-visit-truename, text/calendar parts were not displayed
properly.

Following a suggestion of Al Haji-Ali [1], replace the use of
get-file-buffer with find-buffer-visiting.

[1]: id:m2wmneguh8.fsf@gmail.com
---
 emacs/notmuch-show.el   | 2 +-
 test/T450-emacs-show.sh | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4c0ad74d..14e3c698 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -864,7 +864,7 @@ will return nil if the CID is unknown or cannot be retrieved."
 		    (unless (icalendar-import-buffer file t)
 		      (error "Icalendar import error. %s"
 			     "See *icalendar-errors* for more information"))
-		    (set-buffer (get-file-buffer file))
+		    (set-buffer (find-buffer-visiting file))
 		    (setq result (buffer-substring (point-min) (point-max)))
 		    (set-buffer-modified-p nil)
 		    (kill-buffer (current-buffer)))
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 027062cd..7c6a946a 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -341,7 +341,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "display of text/calendar, symlinked tmpdir"
-test_subtest_known_broken
 mkdir real-tmp
 ln -s real-tmp tmp
 test_emacs "(let ((notmuch-show-all-multipart/alternative-parts t)
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Emacs: text/calendar rendering fix
  2024-05-29 10:15 Emacs: text/calendar rendering fix David Bremner
                   ` (3 preceding siblings ...)
  2024-05-29 10:15 ` [PATCH 4/4] emacs/show: fix for text/calendar display David Bremner
@ 2024-06-15 17:45 ` David Bremner
  4 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2024-06-15 17:45 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> The actual fix here is quite trivial, but it takes some work to test.
> Compared to the previous version in the thread at [1], this updates
> the 3rd patch in the series to actually duplicate the problem, and
> adds the 4th patch with the actual fix.
>
> [1]: id:m2wmneguh8.fsf@gmail.com

Thread applied to master.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-15 17:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29 10:15 Emacs: text/calendar rendering fix David Bremner
2024-05-29 10:15 ` [PATCH 1/4] test/corpora: add example with text/calendar attachment David Bremner
2024-05-29 10:15 ` [PATCH 2/4] test/emacs: add regression test for display of calendar parts David Bremner
2024-05-29 10:15 ` [PATCH 3/4] test/emacs: add tests for rendering text/calendar parts David Bremner
2024-05-29 10:15 ` [PATCH 4/4] emacs/show: fix for text/calendar display David Bremner
2024-06-15 17:45 ` Emacs: text/calendar rendering fix David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).