* emacs-notmuch: notmuch-show-hook runs too early
@ 2020-12-29 14:58 yoctocell
0 siblings, 0 replies; 8+ messages in thread
From: yoctocell @ 2020-12-29 14:58 UTC (permalink / raw)
To: notmuch
[-- Attachment #1.1: Type: text/plain, Size: 1278 bytes --]
I am using a package called gnus-article-treat-patch[0] which colorizes
patches in emails. It works expected when I manually call
`ft/gnus-article-treat-patch` in a notmuch-show buffer, but it doesn't
work when I add it as a hook.
(add-hook 'notmuch-show-hook 'ft/gnus-article-treat-patch)
`notmuch-show-hook` seems to be called too early so
`ft/gnus-article-treat-patch` isn't able to read the contents of the
message and apply any highlighting.
I managed to get it to work with the following patch.
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 056c4e30..f9f3bdb1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1317,11 +1317,11 @@ If no messages match the query return NIL."
(notmuch-sanitize
(notmuch-show-strip-re
(notmuch-show-get-subject)))))
- (run-hooks 'notmuch-show-hook)
(if state
(notmuch-show-apply-state state)
;; With no state to apply, just go to the first message.
- (notmuch-show-goto-first-wanted-message)))
+ (notmuch-show-goto-first-wanted-message))
+ (run-hooks 'notmuch-show-hook))
;; Report back to the caller whether any messages matched.
forest))
--
yoctocell
8B88 2502 31D7 03B1 68BC 2691 3851 020D 7E61 BBC2
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* emacs-notmuch: notmuch-show-hook runs too early
@ 2020-12-29 14:59 yoctocell
2020-12-29 15:03 ` yoctocell
0 siblings, 1 reply; 8+ messages in thread
From: yoctocell @ 2020-12-29 14:59 UTC (permalink / raw)
To: notmuch
[-- Attachment #1.1: Type: text/plain, Size: 1278 bytes --]
I am using a package called gnus-article-treat-patch[0] which colorizes
patches in emails. It works expected when I manually call
`ft/gnus-article-treat-patch` in a notmuch-show buffer, but it doesn't
work when I add it as a hook.
(add-hook 'notmuch-show-hook 'ft/gnus-article-treat-patch)
`notmuch-show-hook` seems to be called too early so
`ft/gnus-article-treat-patch` isn't able to read the contents of the
message and apply any highlighting.
I managed to get it to work with the following patch.
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 056c4e30..f9f3bdb1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1317,11 +1317,11 @@ If no messages match the query return NIL."
(notmuch-sanitize
(notmuch-show-strip-re
(notmuch-show-get-subject)))))
- (run-hooks 'notmuch-show-hook)
(if state
(notmuch-show-apply-state state)
;; With no state to apply, just go to the first message.
- (notmuch-show-goto-first-wanted-message)))
+ (notmuch-show-goto-first-wanted-message))
+ (run-hooks 'notmuch-show-hook))
;; Report back to the caller whether any messages matched.
forest))
--
yoctocell
8B88 2502 31D7 03B1 68BC 2691 3851 020D 7E61 BBC2
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: emacs-notmuch: notmuch-show-hook runs too early
2020-12-29 14:59 yoctocell
@ 2020-12-29 15:03 ` yoctocell
0 siblings, 0 replies; 8+ messages in thread
From: yoctocell @ 2020-12-29 15:03 UTC (permalink / raw)
To: notmuch
[-- Attachment #1.1: Type: text/plain, Size: 1481 bytes --]
On Tue, Dec 29 2020, yoctocell wrote:
> I am using a package called gnus-article-treat-patch[0] which colorizes
> patches in emails. It works expected when I manually call
> `ft/gnus-article-treat-patch` in a notmuch-show buffer, but it doesn't
> work when I add it as a hook.
>
> (add-hook 'notmuch-show-hook 'ft/gnus-article-treat-patch)
>
> `notmuch-show-hook` seems to be called too early so
> `ft/gnus-article-treat-patch` isn't able to read the contents of the
> message and apply any highlighting.
>
> I managed to get it to work with the following patch.
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 056c4e30..f9f3bdb1 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1317,11 +1317,11 @@ If no messages match the query return NIL."
> (notmuch-sanitize
> (notmuch-show-strip-re
> (notmuch-show-get-subject)))))
> - (run-hooks 'notmuch-show-hook)
> (if state
> (notmuch-show-apply-state state)
> ;; With no state to apply, just go to the first message.
> - (notmuch-show-goto-first-wanted-message)))
> + (notmuch-show-goto-first-wanted-message))
> + (run-hooks 'notmuch-show-hook))
> ;; Report back to the caller whether any messages matched.
> forest))
>
> --
> yoctocell
> 8B88 2502 31D7 03B1 68BC 2691 3851 020D 7E61 BBC2
Sorry, forgot the provide the link.
[0]: https://github.com/velkyel/gnus-article-treat-patch
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* emacs-notmuch: notmuch-show-hook runs too early
@ 2021-01-05 8:45 yoctocell
2021-01-08 20:23 ` David Bremner
2021-01-08 20:41 ` David Edmondson
0 siblings, 2 replies; 8+ messages in thread
From: yoctocell @ 2021-01-05 8:45 UTC (permalink / raw)
To: notmuch
[-- Attachment #1.1: Type: text/plain, Size: 1335 bytes --]
I am using a package called gnus-article-treat-patch[0] which colorizes
patches in emails. It works expected when I manually call
`ft/gnus-article-treat-patch' in a notmuch-show buffer, but it doesn't
work when I add it as a hook.
(add-hook 'notmuch-show-hook 'ft/gnus-article-treat-patch)
`notmuch-show-hook' seems to be called too early so
`ft/gnus-article-treat-patch' isn't able to read the contents of the
message and apply any highlighting.
I managed to get it to work with the following patch.
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 056c4e30..f9f3bdb1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1317,11 +1317,11 @@ If no messages match the query return NIL."
(notmuch-sanitize
(notmuch-show-strip-re
(notmuch-show-get-subject)))))
- (run-hooks 'notmuch-show-hook)
(if state
(notmuch-show-apply-state state)
;; With no state to apply, just go to the first message.
- (notmuch-show-goto-first-wanted-message)))
+ (notmuch-show-goto-first-wanted-message))
+ (run-hooks 'notmuch-show-hook))
;; Report back to the caller whether any messages matched.
forest))
[0]: https://github.com/velkyel/gnus-article-treat-patch
--
yoctocell
8B88 2502 31D7 03B1 68BC 2691 3851 020D 7E61 BBC2
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: emacs-notmuch: notmuch-show-hook runs too early
2021-01-05 8:45 emacs-notmuch: notmuch-show-hook runs too early yoctocell
@ 2021-01-08 20:23 ` David Bremner
2021-01-08 20:38 ` yoctocell
2021-01-08 20:41 ` David Edmondson
1 sibling, 1 reply; 8+ messages in thread
From: David Bremner @ 2021-01-08 20:23 UTC (permalink / raw)
To: yoctocell, notmuch; +Cc: David Edmondson
yoctocell <public@yoctocell.xyz> writes:
> I am using a package called gnus-article-treat-patch[0] which colorizes
> patches in emails. It works expected when I manually call
> `ft/gnus-article-treat-patch' in a notmuch-show buffer, but it doesn't
> work when I add it as a hook.
>
> (add-hook 'notmuch-show-hook 'ft/gnus-article-treat-patch)
>
> `notmuch-show-hook' seems to be called too early so
> `ft/gnus-article-treat-patch' isn't able to read the contents of the
> message and apply any highlighting.
>
> I managed to get it to work with the following patch.
Can you have a look at
https://nmbug.notmuchmail.org/nmweb/show/20210108184004.781702-3-dme%40dme.org
and see if that approach would work with you?
At first glance I am more in favour of adding a hook than changing the
semantics of an existing one.
d
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs-notmuch: notmuch-show-hook runs too early
2021-01-08 20:23 ` David Bremner
@ 2021-01-08 20:38 ` yoctocell
0 siblings, 0 replies; 8+ messages in thread
From: yoctocell @ 2021-01-08 20:38 UTC (permalink / raw)
To: David Bremner, notmuch; +Cc: David Edmondson
On Fri, Jan 08 2021, David Bremner wrote:
> Can you have a look at
>
> https://nmbug.notmuchmail.org/nmweb/show/20210108184004.781702-3-dme%40dme.org
>
> and see if that approach would work with you?
>
> At first glance I am more in favour of adding a hook than changing the
> semantics of an existing one.
I works as expected. Thanks for pointing this out!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs-notmuch: notmuch-show-hook runs too early
2021-01-05 8:45 emacs-notmuch: notmuch-show-hook runs too early yoctocell
2021-01-08 20:23 ` David Bremner
@ 2021-01-08 20:41 ` David Edmondson
2021-01-08 20:58 ` yoctocell
1 sibling, 1 reply; 8+ messages in thread
From: David Edmondson @ 2021-01-08 20:41 UTC (permalink / raw)
To: yoctocell, notmuch
On Tuesday, 2021-01-05 at 09:45:52 +01, yoctocell wrote:
> I am using a package called gnus-article-treat-patch[0] which colorizes
> patches in emails. It works expected when I manually call
> `ft/gnus-article-treat-patch' in a notmuch-show buffer, but it doesn't
> work when I add it as a hook.
Is there a reason not to use notmuch-wash-convert-inline-patch-to-part?
It doesn't do quite as much (nothing for the header), but the patch
should be appropriately rendered.
> (add-hook 'notmuch-show-hook 'ft/gnus-article-treat-patch)
>
> `notmuch-show-hook' seems to be called too early so
> `ft/gnus-article-treat-patch' isn't able to read the contents of the
> message and apply any highlighting.
>
> I managed to get it to work with the following patch.
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 056c4e30..f9f3bdb1 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1317,11 +1317,11 @@ If no messages match the query return NIL."
> (notmuch-sanitize
> (notmuch-show-strip-re
> (notmuch-show-get-subject)))))
> - (run-hooks 'notmuch-show-hook)
> (if state
> (notmuch-show-apply-state state)
> ;; With no state to apply, just go to the first message.
> - (notmuch-show-goto-first-wanted-message)))
> + (notmuch-show-goto-first-wanted-message))
> + (run-hooks 'notmuch-show-hook))
> ;; Report back to the caller whether any messages matched.
> forest))
>
> [0]: https://github.com/velkyel/gnus-article-treat-patch
>
> --
> yoctocell
> 8B88 2502 31D7 03B1 68BC 2691 3851 020D 7E61 BBC2
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org
dme.
--
He caught a fleeting glimpse of a man, moving uphill pursued by a bus.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs-notmuch: notmuch-show-hook runs too early
2021-01-08 20:41 ` David Edmondson
@ 2021-01-08 20:58 ` yoctocell
0 siblings, 0 replies; 8+ messages in thread
From: yoctocell @ 2021-01-08 20:58 UTC (permalink / raw)
To: David Edmondson, notmuch
On Fri, Jan 08 2021, David Edmondson wrote:
> Is there a reason not to use notmuch-wash-convert-inline-patch-to-part?
I wasn't aware if this function. It seems to work great so I should
probably use this instead. Thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-07-30 12:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 8:45 emacs-notmuch: notmuch-show-hook runs too early yoctocell
2021-01-08 20:23 ` David Bremner
2021-01-08 20:38 ` yoctocell
2021-01-08 20:41 ` David Edmondson
2021-01-08 20:58 ` yoctocell
-- strict thread matches above, loose matches on Subject: below --
2020-12-29 14:59 yoctocell
2020-12-29 15:03 ` yoctocell
2020-12-29 14:58 yoctocell
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).