* notmuch.el, needs without-restriction to properly save draft
@ 2024-03-13 16:32 Marc Fargas
2024-03-13 23:00 ` Carl Worth
0 siblings, 1 reply; 23+ messages in thread
From: Marc Fargas @ 2024-03-13 16:32 UTC (permalink / raw)
To: notmuch
Hi there,
I'm not sure if this is the appropiate mailing list for bugs regarding
notmuch.el (Notmuch in Emacs). Also, I'm not subscribed so please keep
me in CC!
I recently noticed that when saving drafts in notmuch I would loose all
the headers that are not normally visible on the compose
buffer. References, In-Reply-To and the likes.
By default, when when composing a Reply all those cool and nice headers
are narrowed out of the buffer. They show up on sending because
"message-send" will sort the headers breaking the restriction.
After digging, it seems that "(insert-buffer-substring buf)", in
"with-temporary-notmuch-message-buffer" which is used by
"notmuch-draft-save" is not seeing the buffer contents beyond the
buffer's current restriction.
Thus, "insert-buffer-substring buf" should be wrapped inside a
"without-restriction".
Doing this makes the saved draft keep all headers:
(defun unrestrict-notmuch (orig-fn &rest args)
(without-restriction
(apply orig-fn args)))
(advice-add #'notmuch-draft-postpone :around #'unrestrict-notmuch)
Note that when resuming the draft later on all headers will be visible,
still working out how to restore the narrow restriction there.
marc
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-03-13 16:32 notmuch.el, needs without-restriction to properly save draft Marc Fargas
@ 2024-03-13 23:00 ` Carl Worth
2024-03-14 15:03 ` [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` Marc Fargas
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Carl Worth @ 2024-03-13 23:00 UTC (permalink / raw)
To: Marc Fargas, notmuch
On Wed, Mar 13 2024, Marc Fargas wrote:
> Hi there,
Hi, Marc!
> I'm not sure if this is the appropiate mailing list for bugs regarding
> notmuch.el (Notmuch in Emacs). Also, I'm not subscribed so please keep
> me in CC!
Yes, this is a fine place to report things
> I recently noticed that when saving drafts in notmuch I would loose all
> the headers that are not normally visible on the compose
> buffer. References, In-Reply-To and the likes.
Thanks for the bug report, as well as the fix you provided. I haven't
run it, but it looks totally reasonable.
> Note that when resuming the draft later on all headers will be visible,
> still working out how to restore the narrow restriction there.
That seems worth chasing down, but shouldn't prevent the acceptance of
your fix here which seems like only progress in the right direction.
Could you put your fix together in the form of a git-appliable patch?
Such as by applying it to the notmuch source, running `git commit` and
then `git format-patch HEAD~` or similar.
Thanks again,
-Carl
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer`
2024-03-13 23:00 ` Carl Worth
@ 2024-03-14 15:03 ` Marc Fargas
2024-03-15 8:33 ` Marc Fargas
2024-03-24 17:04 ` notmuch.el, needs without-restriction to properly save draft Marc Fargas
2024-03-24 17:08 ` Marc Fargas
2 siblings, 1 reply; 23+ messages in thread
From: Marc Fargas @ 2024-03-14 15:03 UTC (permalink / raw)
To: Carl Worth, notmuch
This ensures that the temporary copy of the current message-mode
buffer is whole and not limited by a current restriction.
An example of such restriction is the default one established by
message-mode when composing a reply, that hides the References,
In-Reply-To and similar headers.
---
emacs/notmuch-maildir-fcc.el | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 5102078..fdced98 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -148,11 +148,12 @@ Otherwise set it according to `notmuch-fcc-dirs'."
`(let ((case-fold-search t)
(buf (current-buffer))
(mml-externalize-attachments message-fcc-externalize-attachments))
- (with-current-buffer (get-buffer-create " *message temp*")
- (message-clone-locals buf) ;; for message-encoded-mail-cache
- (erase-buffer)
- (insert-buffer-substring buf)
- ,@body)))
+ (without-restriction
+ (with-current-buffer (get-buffer-create " *message temp*")
+ (message-clone-locals buf) ;; for message-encoded-mail-cache
+ (erase-buffer)
+ (insert-buffer-substring buf)
+ ,@body))))
(defun notmuch-maildir-setup-message-for-saving ()
"Setup message for saving.
--
2.43.2
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer`
2024-03-14 15:03 ` [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` Marc Fargas
@ 2024-03-15 8:33 ` Marc Fargas
2024-03-15 9:59 ` David Bremner
0 siblings, 1 reply; 23+ messages in thread
From: Marc Fargas @ 2024-03-15 8:33 UTC (permalink / raw)
To: Carl Worth, notmuch
Hi,
I hope my previous e-mails was properly sent.
I have been testing the patch and.. does it work? The code looks proper
to me but testing on my computer it is not working properly, as if the
`without-restrictions` was being ignored.
I think I do not understand `defmacro` properly to see where the problem
is. Please someone test the patch just to make sure its not a local
problem of my setup.
(Just Reply to an email, postpone; see if the saved draft is kept in the
thread with its headers or becomes an orphan in drafts).
Thanks,
marc
El jue. 14 de mar. 2024, Marc escribió:
> This ensures that the temporary copy of the current message-mode
> buffer is whole and not limited by a current restriction.
>
> An example of such restriction is the default one established by
> message-mode when composing a reply, that hides the References,
> In-Reply-To and similar headers.\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer`
2024-03-15 8:33 ` Marc Fargas
@ 2024-03-15 9:59 ` David Bremner
0 siblings, 0 replies; 23+ messages in thread
From: David Bremner @ 2024-03-15 9:59 UTC (permalink / raw)
To: Marc Fargas, notmuch
Marc Fargas <telenieko@telenieko.com> writes:
> I hope my previous e-mails was properly sent.
>
Yes, it worked fine.
> I have been testing the patch and.. does it work? The code looks proper
> to me but testing on my computer it is not working properly, as if the
> `without-restrictions` was being ignored.
It seems to work here _but_ I did not notice the problem with postponed
replies being orphaned before so maybe it is an issue of your local
setup?
To test this idea you can try ./devel/try-emacs-mua -q
Equally likely is that I have not understood the problem yet.
>
> (Just Reply to an email, postpone; see if the saved draft is kept in the
> thread with its headers or becomes an orphan in drafts).
>
Although it is significantly more work, it would be very helpful if you
could come up with an automated test in the style of those in
T630-emacs-draft.sh. There is one that checks for an internal header, so
perhaps it could be modified to check for In-Reply-To?
David
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-03-13 23:00 ` Carl Worth
2024-03-14 15:03 ` [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` Marc Fargas
@ 2024-03-24 17:04 ` Marc Fargas
2024-03-24 17:54 ` Marc Fargas
2024-03-24 17:08 ` Marc Fargas
2 siblings, 1 reply; 23+ messages in thread
From: Marc Fargas @ 2024-03-24 17:04 UTC (permalink / raw)
To: Carl Worth, notmuch
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
Hello,
El mié. 13 de mar. 2024, Carl escribió:
> (...)
> Could you put your fix together in the form of a git-appliable patch?
> Such as by applying it to the notmuch source, running `git commit` and
> then `git format-patch HEAD~` or similar.
Please disregard the previous patch, consider the one attached
here. Hope I did the "format-patch" thing properly.
I had to move the `without-restriction` call to the top of the
`with-temporary-notmuch-message-buffer` defmacro. It does work properly
now.
marc
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1799 bytes --]
From 48efd572e6b8e6d214fc8b4e7b28f001fc13345a Mon Sep 17 00:00:00 2001
From: Marc Fargas <telenieko@telenieko.com>
Date: Thu, 14 Mar 2024 15:56:49 +0100
Subject: [PATCH] Use `without-restriction` in
`with-temporary-notmuch-message-buffer`
This ensures that the temporary copy of the current message-mode
buffer is whole and not limited by a current restriction.
An example of such restriction is the default one established by
message-mode when composing a reply, that hides the References,
In-Reply-To and similar headers.
---
emacs/notmuch-maildir-fcc.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 5102078..cf50e85 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -145,14 +145,15 @@ Otherwise set it according to `notmuch-fcc-dirs'."
(defmacro with-temporary-notmuch-message-buffer (&rest body)
"Set-up a temporary copy of the current message-mode buffer."
- `(let ((case-fold-search t)
- (buf (current-buffer))
- (mml-externalize-attachments message-fcc-externalize-attachments))
- (with-current-buffer (get-buffer-create " *message temp*")
- (message-clone-locals buf) ;; for message-encoded-mail-cache
- (erase-buffer)
- (insert-buffer-substring buf)
- ,@body)))
+ `(without-restriction
+ (let ((case-fold-search t)
+ (buf (current-buffer))
+ (mml-externalize-attachments message-fcc-externalize-attachments))
+ (with-current-buffer (get-buffer-create " *message temp*")
+ (message-clone-locals buf) ;; for message-encoded-mail-cache
+ (erase-buffer)
+ (insert-buffer-substring buf)
+ ,@body))))
(defun notmuch-maildir-setup-message-for-saving ()
"Setup message for saving.
--
2.44.0
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-03-13 23:00 ` Carl Worth
2024-03-14 15:03 ` [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` Marc Fargas
2024-03-24 17:04 ` notmuch.el, needs without-restriction to properly save draft Marc Fargas
@ 2024-03-24 17:08 ` Marc Fargas
2 siblings, 0 replies; 23+ messages in thread
From: Marc Fargas @ 2024-03-24 17:08 UTC (permalink / raw)
To: Carl Worth, notmuch
[-- Attachment #1: Type: text/plain, Size: 606 bytes --]
Hello,
El mié. 13 de mar. 2024, Carl escribió:
> (...)
> Could you put your fix together in the form of a git-appliable patch?
> Such as by applying it to the notmuch source, running `git commit` and
> then `git format-patch HEAD~` or similar.
Please disregard the previous patch, consider the one attached
here. Hope I did the "format-patch" thing properly.
I had to move the `without-restriction` call to the top of the
`with-temporary-notmuch-message-buffer` defmacro. It does work properly
now.
marc
PS: Resent while properly attaching the patch file (I hope, and
apologies).
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-without-restriction-in-with-temporary-notmuch-me.patch --]
[-- Type: text/x-patch, Size: 1799 bytes --]
From 48efd572e6b8e6d214fc8b4e7b28f001fc13345a Mon Sep 17 00:00:00 2001
From: Marc Fargas <telenieko@telenieko.com>
Date: Thu, 14 Mar 2024 15:56:49 +0100
Subject: [PATCH] Use `without-restriction` in
`with-temporary-notmuch-message-buffer`
This ensures that the temporary copy of the current message-mode
buffer is whole and not limited by a current restriction.
An example of such restriction is the default one established by
message-mode when composing a reply, that hides the References,
In-Reply-To and similar headers.
---
emacs/notmuch-maildir-fcc.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 5102078..cf50e85 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -145,14 +145,15 @@ Otherwise set it according to `notmuch-fcc-dirs'."
(defmacro with-temporary-notmuch-message-buffer (&rest body)
"Set-up a temporary copy of the current message-mode buffer."
- `(let ((case-fold-search t)
- (buf (current-buffer))
- (mml-externalize-attachments message-fcc-externalize-attachments))
- (with-current-buffer (get-buffer-create " *message temp*")
- (message-clone-locals buf) ;; for message-encoded-mail-cache
- (erase-buffer)
- (insert-buffer-substring buf)
- ,@body)))
+ `(without-restriction
+ (let ((case-fold-search t)
+ (buf (current-buffer))
+ (mml-externalize-attachments message-fcc-externalize-attachments))
+ (with-current-buffer (get-buffer-create " *message temp*")
+ (message-clone-locals buf) ;; for message-encoded-mail-cache
+ (erase-buffer)
+ (insert-buffer-substring buf)
+ ,@body))))
(defun notmuch-maildir-setup-message-for-saving ()
"Setup message for saving.
--
2.44.0
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-03-24 17:04 ` notmuch.el, needs without-restriction to properly save draft Marc Fargas
@ 2024-03-24 17:54 ` Marc Fargas
2024-04-04 11:13 ` Marc Fargas
2024-06-15 17:57 ` David Bremner
0 siblings, 2 replies; 23+ messages in thread
From: Marc Fargas @ 2024-03-24 17:54 UTC (permalink / raw)
To: Carl Worth, notmuch, david
[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]
Hi again,
El dom. 24 de mar. 2024, Marc escribió:
> El mié. 13 de mar. 2024, Carl escribió:
>> (...)
>> Could you put your fix together in the form of a git-appliable patch?
>> Such as by applying it to the notmuch source, running `git commit` and
>> then `git format-patch HEAD~` or similar.
>
> Please disregard the previous patch, consider the one attached
> here. Hope I did the "format-patch" thing properly.
>
> I had to move the `without-restriction` call to the top of the
> `with-temporary-notmuch-message-buffer` defmacro. It does work properly
> now.
I just saw on the archives that David Bremner replied to my original
patch, I have no idea why that email didn't reach me :(
David:
> Although it is significantly more work, it would be very helpful if
> you could come up with an automated test in the style of those in
> T630-emacs-draft.sh. There is one that checks for an internal header,
> so perhaps it could be modified to check for In-Reply-To?
I am attaching a new patch that includes an additional test on
T630-emacs-draft.sh.
On the test only `References` is at the top (hence hidden by emacs), not
`In-Reply-To`. I guess that does rely on some configuration.
In any case, the test reproduces the problem (lost headers on draft
save), and the patch fixes it!
Hope all is good!! :D
marc
[-- Attachment #2: 0001-Use-without-restriction-in-with-temporary-notmuch-me.patch --]
[-- Type: text/x-patch, Size: 3435 bytes --]
From 77e8a775571458962ff11af549d1a0428a17435e Mon Sep 17 00:00:00 2001
From: Marc Fargas <telenieko@telenieko.com>
Date: Thu, 14 Mar 2024 15:56:49 +0100
Subject: [PATCH] Use `without-restriction` in
`with-temporary-notmuch-message-buffer`
This ensures that the temporary copy of the current message-mode
buffer is whole and not limited by a current restriction.
An example of such restriction is the default one established by
message-mode when composing a reply, that hides the References,
In-Reply-To and similar headers.
---
emacs/notmuch-maildir-fcc.el | 17 +++++++++--------
test/T630-emacs-draft.sh | 32 ++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 5102078..cf50e85 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -145,14 +145,15 @@ Otherwise set it according to `notmuch-fcc-dirs'."
(defmacro with-temporary-notmuch-message-buffer (&rest body)
"Set-up a temporary copy of the current message-mode buffer."
- `(let ((case-fold-search t)
- (buf (current-buffer))
- (mml-externalize-attachments message-fcc-externalize-attachments))
- (with-current-buffer (get-buffer-create " *message temp*")
- (message-clone-locals buf) ;; for message-encoded-mail-cache
- (erase-buffer)
- (insert-buffer-substring buf)
- ,@body)))
+ `(without-restriction
+ (let ((case-fold-search t)
+ (buf (current-buffer))
+ (mml-externalize-attachments message-fcc-externalize-attachments))
+ (with-current-buffer (get-buffer-create " *message temp*")
+ (message-clone-locals buf) ;; for message-encoded-mail-cache
+ (erase-buffer)
+ (insert-buffer-substring buf)
+ ,@body))))
(defun notmuch-maildir-setup-message-for-saving ()
"Setup message for saving.
diff --git a/test/T630-emacs-draft.sh b/test/T630-emacs-draft.sh
index c443f41..1fad58a 100755
--- a/test/T630-emacs-draft.sh
+++ b/test/T630-emacs-draft.sh
@@ -71,4 +71,36 @@ Fcc: MAIL_DIR/sent
<#secure method=pgpmime mode=sign>
EOF
test_expect_equal_file EXPECTED OUTPUT.clean
+
+add_email_corpus attachment
+test_begin_subtest "Saving a draft keeps hidden headers"
+test_emacs '(notmuch-mua-new-reply "id:874llc2bkp.fsf@curie.anarc.at")
+ (message-goto-subject)
+ (delete-line)
+ (insert "Subject: draft-test-reply\n")
+ (test-output "DRAFT")
+ (notmuch-draft-postpone)
+ (notmuch-show "subject:draft-test-reply")
+ (notmuch-show-resume-message)
+ (test-output)'
+notmuch_dir_sanitize OUTPUT > OUTPUT.clean
+
+cat <<EOF > EXPECTED
+References: <87d10042pu.fsf@curie.anarc.at> <87woy8vx7i.fsf@tesseract.cs.unb.ca> <87a7v42bv9.fsf@curie.anarc.at> <874llc2bkp.fsf@curie.anarc.at>
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+To: Antoine Beaupré <anarcat@orangeseeds.org>
+Subject: draft-test-reply
+In-Reply-To: <874llc2bkp.fsf@curie.anarc.at>
+Fcc: MAIL_DIR/sent
+--text follows this line--
+Antoine Beaupré <anarcat@orangeseeds.org> writes:
+
+> And obviously I forget the frigging attachment.
+>
+>
+> PS: don't we have a "you forgot to actually attach the damn file" plugin
+> when we detect the word "attachment" and there's no attach? :p
+EOF
+test_expect_equal_file EXPECTED OUTPUT.clean
+
test_done
--
2.44.0
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-03-24 17:54 ` Marc Fargas
@ 2024-04-04 11:13 ` Marc Fargas
2024-06-15 17:57 ` David Bremner
1 sibling, 0 replies; 23+ messages in thread
From: Marc Fargas @ 2024-04-04 11:13 UTC (permalink / raw)
To: Carl Worth, notmuch, david
Hi all,
El dom. 24 de mar. 2024, Marc escribió:
> I am attaching a new patch that includes an additional test on
> T630-emacs-draft.sh.
>
> On the test only `References` is at the top (hence hidden by emacs), not
> `In-Reply-To`. I guess that does rely on some configuration.
>
> In any case, the test reproduces the problem (lost headers on draft
> save), and the patch fixes it!
Following up on this, has anyone had a chance to review the proposed
patch (the one including tests)?
Let me know if there's anything else I can do to get the fix into
notmuch!
Marc\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-03-24 17:54 ` Marc Fargas
2024-04-04 11:13 ` Marc Fargas
@ 2024-06-15 17:57 ` David Bremner
2024-06-17 9:27 ` Michael J Gruber
1 sibling, 1 reply; 23+ messages in thread
From: David Bremner @ 2024-06-15 17:57 UTC (permalink / raw)
To: Marc Fargas, Carl Worth, notmuch
Marc Fargas <telenieko@telenieko.com> writes:
> Hi again,
>
> El dom. 24 de mar. 2024, Marc escribió:
>> El mié. 13 de mar. 2024, Carl escribió:
>>> (...)
>>> Could you put your fix together in the form of a git-appliable patch?
>>> Such as by applying it to the notmuch source, running `git commit` and
>>> then `git format-patch HEAD~` or similar.
>>
>> Please disregard the previous patch, consider the one attached
>> here. Hope I did the "format-patch" thing properly.
>>
>> I had to move the `without-restriction` call to the top of the
>> `with-temporary-notmuch-message-buffer` defmacro. It does work properly
>> now.
Applied to master. Sorry for the long-ish silence.
d\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-06-15 17:57 ` David Bremner
@ 2024-06-17 9:27 ` Michael J Gruber
2024-06-17 9:53 ` Marc Fargas
0 siblings, 1 reply; 23+ messages in thread
From: Michael J Gruber @ 2024-06-17 9:27 UTC (permalink / raw)
To: David Bremner; +Cc: Marc Fargas, notmuch
Am Sa., 15. Juni 2024 um 19:57 Uhr schrieb David Bremner <david@tethera.net>:
>
> Marc Fargas <telenieko@telenieko.com> writes:
>
> > Hi again,
> >
> > El dom. 24 de mar. 2024, Marc escribió:
> >> El mié. 13 de mar. 2024, Carl escribió:
> >>> (...)
> >>> Could you put your fix together in the form of a git-appliable patch?
> >>> Such as by applying it to the notmuch source, running `git commit` and
> >>> then `git format-patch HEAD~` or similar.
> >>
> >> Please disregard the previous patch, consider the one attached
> >> here. Hope I did the "format-patch" thing properly.
> >>
> >> I had to move the `without-restriction` call to the top of the
> >> `with-temporary-notmuch-message-buffer` defmacro. It does work properly
> >> now.
>
> Applied to master. Sorry for the long-ish silence.
>
Does this depend on emacs version by any chance, i.e. is
`without-restriction` defined on all emacsen? In Fedora's copr
infrastructure, all builds succeed but some tests fail with
`Symbol'€™s function definition is void: without-restriction`. The
picture is the following:
PASS:
centos-stream+epel-next-8 with emacs 26.1-11.el8
rhel+epel-8 with emacs 26.1-11.el8
fedora-39 with emacs 29.3-1.fc39
(plus all newer fedoras)
FAIL:
centos-stream+epel-next-9 with emacs 27.2-9.el9
rhel+epel-9 with emacs 27.2-9.el9
Yes, RHEL 8 is EOled.
I find it strange that tests pass on both emacs 26 and 29 but not
27.2. But said code path is not executed on emacs 26 at all?
The failing 42 tests are mostly around json and crypto, but not all.
Cheers
Michael\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-06-17 9:27 ` Michael J Gruber
@ 2024-06-17 9:53 ` Marc Fargas
2024-06-17 10:27 ` David Bremner
2024-06-17 11:37 ` Marc Fargas
0 siblings, 2 replies; 23+ messages in thread
From: Marc Fargas @ 2024-06-17 9:53 UTC (permalink / raw)
To: Michael J Gruber, David Bremner; +Cc: notmuch
Hi,
El lun. 17 de jun. 2024, Michael escribió:
>> (...)
>
> Does this depend on emacs version by any chance, i.e. is
> `without-restriction` defined on all emacsen? In Fedora's copr
> infrastructure, all builds succeed but some tests fail with
> `Symbol'€™s function definition is void: without-restriction`. The
> picture is the following:
Apparently it was introduced in Emacs 29[1]. Strange that tests pass at
all on previous versions.
What is the earliest Emacs version supported by notmuch? I can't find
any specific version in notmuch documentation.
The patch could be updated to only use without-restriction when
available, of course.
marc
[1]: https://github.com/emacs-mirror/emacs/blob/7be66d8223e49489b2803c0ff027f1824d774441/etc/NEWS.29#L3512\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-06-17 9:53 ` Marc Fargas
@ 2024-06-17 10:27 ` David Bremner
2024-06-17 10:29 ` David Bremner
2024-06-17 11:37 ` Marc Fargas
1 sibling, 1 reply; 23+ messages in thread
From: David Bremner @ 2024-06-17 10:27 UTC (permalink / raw)
To: Marc Fargas, Michael J Gruber; +Cc: notmuch
Marc Fargas <telenieko@telenieko.com> writes:
> Hi,
>
> El lun. 17 de jun. 2024, Michael escribió:
>>> (...)
>>
>> Does this depend on emacs version by any chance, i.e. is
>> `without-restriction` defined on all emacsen? In Fedora's copr
>> infrastructure, all builds succeed but some tests fail with
>> `Symbol'€™s function definition is void: without-restriction`. The
>> picture is the following:
>
> Apparently it was introduced in Emacs 29[1]. Strange that tests pass at
> all on previous versions.
>
> What is the earliest Emacs version supported by notmuch? I can't find
> any specific version in notmuch documentation.
According to the docs, it is supposed to work with 25.1. Personally I
would be fine updating this to 26.x or 27.x, but of course that won't
help you here.\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-06-17 10:27 ` David Bremner
@ 2024-06-17 10:29 ` David Bremner
0 siblings, 0 replies; 23+ messages in thread
From: David Bremner @ 2024-06-17 10:29 UTC (permalink / raw)
To: Marc Fargas, Michael J Gruber; +Cc: notmuch
David Bremner <david@tethera.net> writes:
> Marc Fargas <telenieko@telenieko.com> writes:
>
>> Hi,
>>
>> El lun. 17 de jun. 2024, Michael escribió:
>>>> (...)
>>>
>>> Does this depend on emacs version by any chance, i.e. is
>>> `without-restriction` defined on all emacsen? In Fedora's copr
>>> infrastructure, all builds succeed but some tests fail with
>>> `Symbol'€™s function definition is void: without-restriction`. The
>>> picture is the following:
>>
>> Apparently it was introduced in Emacs 29[1]. Strange that tests pass at
>> all on previous versions.
>>
>> What is the earliest Emacs version supported by notmuch? I can't find
>> any specific version in notmuch documentation.
>
> According to the docs, it is supposed to work with 25.1. Personally I
> would be fine updating this to 26.x or 27.x, but of course that won't
> help you here.
Using "docs", loosly here. This is the most recent announcement in NEWS,
which matches emacs/notmuch-pkg.el.tmpl\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-06-17 9:53 ` Marc Fargas
2024-06-17 10:27 ` David Bremner
@ 2024-06-17 11:37 ` Marc Fargas
2024-06-17 14:04 ` [PATCH] Replace `without-restriction` with `save-restriction` michaeljgruber+grubix+git
2024-06-17 14:28 ` notmuch.el, needs without-restriction to properly save draft David Bremner
1 sibling, 2 replies; 23+ messages in thread
From: Marc Fargas @ 2024-06-17 11:37 UTC (permalink / raw)
To: David Bremner; +Cc: notmuch, Michael J Gruber
Hi,
El lun. 17 de jun. 2024, Marc escribió:
>
> El lun. 17 de jun. 2024, Michael escribió:
>>> (...)
>>
>> Does this depend on emacs version by any chance, i.e. is
>> `without-restriction` defined on all emacsen? In Fedora's copr
>> infrastructure, all builds succeed but some tests fail with
>> `Symbol'€™s function definition is void: without-restriction`. The
>> picture is the following:
So, I will have to update the patch in order to make the use of
`without-restriction` conditional on its availability.
I asked on Emacs chat @ Matrix on how to do this nicely and yantar92
(org contributor) proposed the following macro:
(defmacro notmuch--without-restriction (&rest body)
"Run BODY within `without-restriction', when it is available."
(declare (debug (body)))
(if (fboundp 'without-restriction)
`(without-restriction ,@body)
`(progn ,@body)))
David, would such solution be OK? If so I'll prepare a new patch.
Marc\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] Replace `without-restriction` with `save-restriction`
2024-06-17 11:37 ` Marc Fargas
@ 2024-06-17 14:04 ` michaeljgruber+grubix+git
2024-06-17 19:28 ` [PATCH v2 1/2] " michaeljgruber+grubix+git
2024-06-17 19:28 ` [PATCH v2 2/2] Replace `delete-line` with its definition michaeljgruber+grubix+git
2024-06-17 14:28 ` notmuch.el, needs without-restriction to properly save draft David Bremner
1 sibling, 2 replies; 23+ messages in thread
From: michaeljgruber+grubix+git @ 2024-06-17 14:04 UTC (permalink / raw)
To: notmuch; +Cc: Michael J Gruber
From: Michael J Gruber <git@grubix.eu>
37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
introduced a fix for draft saving in a way which is supported on Emacs
29 and above only. Replace this with a construct which we have used
before, so that we keep the same compatibility level.
---
So, this fixes one incompatibility, and as per the emacs docs, those
should be equivalent.
Alas: T630-emacs-draft introduced another incompatibility by using
`delete-line`, it seems. I haven't checked versions nor substitutes
yet.
emacs/notmuch-maildir-fcc.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index cf50e855..c7b403cf 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -145,7 +145,8 @@ Otherwise set it according to `notmuch-fcc-dirs'."
(defmacro with-temporary-notmuch-message-buffer (&rest body)
"Set-up a temporary copy of the current message-mode buffer."
- `(without-restriction
+ `(save-restriction
+ (widen)
(let ((case-fold-search t)
(buf (current-buffer))
(mml-externalize-attachments message-fcc-externalize-attachments))
--
2.45.2.749.g54362de8d7
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: notmuch.el, needs without-restriction to properly save draft
2024-06-17 11:37 ` Marc Fargas
2024-06-17 14:04 ` [PATCH] Replace `without-restriction` with `save-restriction` michaeljgruber+grubix+git
@ 2024-06-17 14:28 ` David Bremner
1 sibling, 0 replies; 23+ messages in thread
From: David Bremner @ 2024-06-17 14:28 UTC (permalink / raw)
To: Marc Fargas; +Cc: notmuch, Michael J Gruber
Marc Fargas <telenieko@telenieko.com> writes:
> Hi,
>
> El lun. 17 de jun. 2024, Marc escribió:
>>
>> El lun. 17 de jun. 2024, Michael escribió:
>>>> (...)
>>>
>>> Does this depend on emacs version by any chance, i.e. is
>>> `without-restriction` defined on all emacsen? In Fedora's copr
>>> infrastructure, all builds succeed but some tests fail with
>>> `Symbol'€™s function definition is void: without-restriction`. The
>>> picture is the following:
>
> So, I will have to update the patch in order to make the use of
> `without-restriction` conditional on its availability.
>
> I asked on Emacs chat @ Matrix on how to do this nicely and yantar92
> (org contributor) proposed the following macro:
>
> (defmacro notmuch--without-restriction (&rest body)
> "Run BODY within `without-restriction', when it is available."
> (declare (debug (body)))
> (if (fboundp 'without-restriction)
> `(without-restriction ,@body)
> `(progn ,@body)))
Assuming fboundp works for macros (without-restriction is a macro), then
sure\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 1/2] Replace `without-restriction` with `save-restriction`
2024-06-17 14:04 ` [PATCH] Replace `without-restriction` with `save-restriction` michaeljgruber+grubix+git
@ 2024-06-17 19:28 ` michaeljgruber+grubix+git
2024-06-17 19:28 ` [PATCH v2 2/2] Replace `delete-line` with its definition michaeljgruber+grubix+git
1 sibling, 0 replies; 23+ messages in thread
From: michaeljgruber+grubix+git @ 2024-06-17 19:28 UTC (permalink / raw)
To: notmuch; +Cc: Michael J Gruber
From: Michael J Gruber <git@grubix.eu>
37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
introduced a fix for draft saving in a way which is supported on Emacs
29 and above only. Replace this with a construct which we have used
before, so that we keep the same compatibility level.
---
unchanged
emacs/notmuch-maildir-fcc.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index cf50e855..c7b403cf 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -145,7 +145,8 @@ Otherwise set it according to `notmuch-fcc-dirs'."
(defmacro with-temporary-notmuch-message-buffer (&rest body)
"Set-up a temporary copy of the current message-mode buffer."
- `(without-restriction
+ `(save-restriction
+ (widen)
(let ((case-fold-search t)
(buf (current-buffer))
(mml-externalize-attachments message-fcc-externalize-attachments))
--
2.45.2.749.g54362de8d7
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 2/2] Replace `delete-line` with its definition
2024-06-17 14:04 ` [PATCH] Replace `without-restriction` with `save-restriction` michaeljgruber+grubix+git
2024-06-17 19:28 ` [PATCH v2 1/2] " michaeljgruber+grubix+git
@ 2024-06-17 19:28 ` michaeljgruber+grubix+git
2024-06-17 22:49 ` David Bremner
2024-06-19 10:48 ` David Bremner
1 sibling, 2 replies; 23+ messages in thread
From: michaeljgruber+grubix+git @ 2024-06-17 19:28 UTC (permalink / raw)
To: notmuch; +Cc: Michael J Gruber
From: Michael J Gruber <git@grubix.eu>
37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
introduced `delete-line` in a test, but this is Emacs 29 and above only.
Replace it with its (almost) definition.
---
With this one, all my reported chroots build again.
test/T630-emacs-draft.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/T630-emacs-draft.sh b/test/T630-emacs-draft.sh
index 1fad58a8..7d0da21a 100755
--- a/test/T630-emacs-draft.sh
+++ b/test/T630-emacs-draft.sh
@@ -76,7 +76,7 @@ add_email_corpus attachment
test_begin_subtest "Saving a draft keeps hidden headers"
test_emacs '(notmuch-mua-new-reply "id:874llc2bkp.fsf@curie.anarc.at")
(message-goto-subject)
- (delete-line)
+ (delete-region (line-beginning-position) (line-beginning-position 2))
(insert "Subject: draft-test-reply\n")
(test-output "DRAFT")
(notmuch-draft-postpone)
--
2.45.2.749.g54362de8d7
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v2 2/2] Replace `delete-line` with its definition
2024-06-17 19:28 ` [PATCH v2 2/2] Replace `delete-line` with its definition michaeljgruber+grubix+git
@ 2024-06-17 22:49 ` David Bremner
2024-06-18 5:58 ` Marc Fargas
2024-06-19 10:48 ` David Bremner
1 sibling, 1 reply; 23+ messages in thread
From: David Bremner @ 2024-06-17 22:49 UTC (permalink / raw)
To: michaeljgruber+grubix+git, notmuch; +Cc: Marc Fargas
michaeljgruber+grubix+git@gmail.com writes:
> From: Michael J Gruber <git@grubix.eu>
>
> 37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
> introduced `delete-line` in a test, but this is Emacs 29 and above only.
> Replace it with its (almost) definition.
The changes look reasonable to me. But so did the last ones ;P. Any
feedback Marc?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 2/2] Replace `delete-line` with its definition
2024-06-17 22:49 ` David Bremner
@ 2024-06-18 5:58 ` Marc Fargas
2024-06-18 14:33 ` Michael J Gruber
0 siblings, 1 reply; 23+ messages in thread
From: Marc Fargas @ 2024-06-18 5:58 UTC (permalink / raw)
To: David Bremner, michaeljgruber+grubix+git, notmuch
Hi,
El lun. 17 de jun. 2024, David escribió:
>
>> From: Michael J Gruber <git@grubix.eu>
>>
>> 37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
>> introduced `delete-line` in a test, but this is Emacs 29 and above only.
>> Replace it with its (almost) definition.
>
> The changes look reasonable to me. But so did the last ones ;P. Any
> feedback Marc?
Ok for me! And sorry for not considering backwards compatibility on my
patch :(
marc\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 2/2] Replace `delete-line` with its definition
2024-06-18 5:58 ` Marc Fargas
@ 2024-06-18 14:33 ` Michael J Gruber
0 siblings, 0 replies; 23+ messages in thread
From: Michael J Gruber @ 2024-06-18 14:33 UTC (permalink / raw)
To: Marc Fargas; +Cc: notmuch
Am Di., 18. Juni 2024 um 07:58 Uhr schrieb Marc Fargas
<telenieko@telenieko.com>:
>
> Hi,
>
> El lun. 17 de jun. 2024, David escribió:
> >
> >> From: Michael J Gruber <git@grubix.eu>
> >>
> >> 37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
> >> introduced `delete-line` in a test, but this is Emacs 29 and above only.
> >> Replace it with its (almost) definition.
> >
> > The changes look reasonable to me. But so did the last ones ;P.
:-)
Builds: https://copr.fedorainfracloud.org/coprs/mjg/notmuch-git/build/7621439/
Source: https://copr-dist-git.fedorainfracloud.org/cgit/mjg/notmuch-git/notmuch.git/tree/?id=365e56a86826e13bdb6f716993ad33d5d570b7b6
>> Any
> > feedback Marc?
>
> Ok for me! And sorry for not considering backwards compatibility on my
> patch :(
I just happen to test against old versions because I maintain notmuch
for Fedora and EPEL, i.e. extra packages for RHEL and such, and they
often come with older versions as a stable base platform.
Cheers
Michael\r
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 2/2] Replace `delete-line` with its definition
2024-06-17 19:28 ` [PATCH v2 2/2] Replace `delete-line` with its definition michaeljgruber+grubix+git
2024-06-17 22:49 ` David Bremner
@ 2024-06-19 10:48 ` David Bremner
1 sibling, 0 replies; 23+ messages in thread
From: David Bremner @ 2024-06-19 10:48 UTC (permalink / raw)
To: michaeljgruber+grubix+git, notmuch; +Cc: Michael J Gruber
michaeljgruber+grubix+git@gmail.com writes:
> From: Michael J Gruber <git@grubix.eu>
>
> 37c022ae ("Use `without-restriction` in `with-temporary-notmuch-message-buffer`", 2024-03-14)
> introduced `delete-line` in a test, but this is Emacs 29 and above only.
> Replace it with its (almost) definition.
both v2 patches applied to master.
d
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2024-06-19 10:48 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 16:32 notmuch.el, needs without-restriction to properly save draft Marc Fargas
2024-03-13 23:00 ` Carl Worth
2024-03-14 15:03 ` [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` Marc Fargas
2024-03-15 8:33 ` Marc Fargas
2024-03-15 9:59 ` David Bremner
2024-03-24 17:04 ` notmuch.el, needs without-restriction to properly save draft Marc Fargas
2024-03-24 17:54 ` Marc Fargas
2024-04-04 11:13 ` Marc Fargas
2024-06-15 17:57 ` David Bremner
2024-06-17 9:27 ` Michael J Gruber
2024-06-17 9:53 ` Marc Fargas
2024-06-17 10:27 ` David Bremner
2024-06-17 10:29 ` David Bremner
2024-06-17 11:37 ` Marc Fargas
2024-06-17 14:04 ` [PATCH] Replace `without-restriction` with `save-restriction` michaeljgruber+grubix+git
2024-06-17 19:28 ` [PATCH v2 1/2] " michaeljgruber+grubix+git
2024-06-17 19:28 ` [PATCH v2 2/2] Replace `delete-line` with its definition michaeljgruber+grubix+git
2024-06-17 22:49 ` David Bremner
2024-06-18 5:58 ` Marc Fargas
2024-06-18 14:33 ` Michael J Gruber
2024-06-19 10:48 ` David Bremner
2024-06-17 14:28 ` notmuch.el, needs without-restriction to properly save draft David Bremner
2024-03-24 17:08 ` Marc Fargas
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).