From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ENwgB2m/+F87eQAA0tVLHw (envelope-from ) for ; Fri, 08 Jan 2021 20:24:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id cInbAmm/+F/XAQAAbx9fmQ (envelope-from ) for ; Fri, 08 Jan 2021 20:24:09 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 36C599403D2 for ; Fri, 8 Jan 2021 20:24:07 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4446B29DA9; Fri, 8 Jan 2021 15:23:59 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id CCF942852F for ; Fri, 8 Jan 2021 15:23:56 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 692E75FF47; Fri, 8 Jan 2021 15:23:55 -0500 (EST) Received: (nullmailer pid 2560418 invoked by uid 1000); Fri, 08 Jan 2021 20:23:53 -0000 From: David Bremner To: yoctocell , notmuch@notmuchmail.org Subject: Re: emacs-notmuch: notmuch-show-hook runs too early In-Reply-To: <875z4bvkjj.fsf@yoctocell.xyz> References: <875z4bvkjj.fsf@yoctocell.xyz> X-List-To: notmuch Date: Fri, 08 Jan 2021 16:23:53 -0400 Message-ID: <871rev89eu.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: WZ6GYCLUHU5FG4AVOPY4RT7P3VRISX47 X-Message-ID-Hash: WZ6GYCLUHU5FG4AVOPY4RT7P3VRISX47 X-MailFrom: david@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: David Edmondson X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.92 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 36C599403D2 X-Spam-Score: -1.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4dMgniS/vmig yoctocell 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