GNU bug report logs - #70671
30.0.50; mhtml-mode ignores delay-mode-hooks

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Tue, 30 Apr 2024 13:26:01 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70671 in the body.
You can then email your comments to 70671 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70671; Package emacs. (Tue, 30 Apr 2024 13:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ihor Radchenko <yantar92 <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 30 Apr 2024 13:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; mhtml-mode ignores delay-mode-hooks
Date: Tue, 30 Apr 2024 13:25:30 +0000
Hello,

mhtml-mode unconditionally runs prog-mode-hooks:

;; This is sort of a prog-mode as well as a text mode.
  (run-hooks 'prog-mode-hook)

As a result, running

(delay-mode-hooks (mhtml-mode)) does not prevent prog-mode-hook from
being delayed.

May mhtml-mode be changed to use (run-mode-hooks 'prog-mode-hook)
instead, so that `delay-mode-hooks' is honoured?


Original report:
https://orgmode.org/list/87tu21hsuk.fsf <at> localhost


In GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-04-30 built on localhost
Repository revision: eaaa7b4a1aeaf978d5c12be81c175abcbe62bc02
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Gentoo Linux


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70671; Package emacs. (Thu, 02 May 2024 09:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 70671 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 70671 <at> debbugs.gnu.org
Subject: Re: bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
Date: Thu, 02 May 2024 12:51:38 +0300
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Tue, 30 Apr 2024 13:25:30 +0000
> 
> mhtml-mode unconditionally runs prog-mode-hooks:
> 
> ;; This is sort of a prog-mode as well as a text mode.
>   (run-hooks 'prog-mode-hook)
> 
> As a result, running
> 
> (delay-mode-hooks (mhtml-mode)) does not prevent prog-mode-hook from
> being delayed.
> 
> May mhtml-mode be changed to use (run-mode-hooks 'prog-mode-hook)
> instead, so that `delay-mode-hooks' is honoured?
> 
> 
> Original report:
> https://orgmode.org/list/87tu21hsuk.fsf <at> localhost

Stefan, WDYT?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70671; Package emacs. (Thu, 02 May 2024 13:17:01 GMT) Full text and rfc822 format available.

Message #11 received at 70671 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 70671 <at> debbugs.gnu.org
Subject: Re: bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
Date: Thu, 02 May 2024 09:15:45 -0400
>> mhtml-mode unconditionally runs prog-mode-hooks:
>> 
>> ;; This is sort of a prog-mode as well as a text mode.
>>   (run-hooks 'prog-mode-hook)
>> 
>> As a result, running
>> 
>> (delay-mode-hooks (mhtml-mode)) does not prevent prog-mode-hook from
>> being delayed.
>> 
>> May mhtml-mode be changed to use (run-mode-hooks 'prog-mode-hook)
>> instead, so that `delay-mode-hooks' is honoured?
>> 
>> 
>> Original report:
>> https://orgmode.org/list/87tu21hsuk.fsf <at> localhost
>
> Stefan, WDYT?

It should use `run-mode-hooks`, indeed, thanks,


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70671; Package emacs. (Fri, 03 May 2024 07:48:02 GMT) Full text and rfc822 format available.

Message #14 received at 70671 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70671 <at> debbugs.gnu.org
Subject: Re: bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
Date: Fri, 03 May 2024 07:48:29 +0000
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> May mhtml-mode be changed to use (run-mode-hooks 'prog-mode-hook)
>>> instead, so that `delay-mode-hooks' is honoured?
>> ...
>> Stefan, WDYT?
>
> It should use `run-mode-hooks`, indeed, thanks,

See the attached patch.

[0001-mhtml-mode-Use-run-mode-hook-to-run-prog-mode-hook-b.patch (text/x-patch, inline)]
From a73131234019d51b93cf6422fc86218d962167d4 Mon Sep 17 00:00:00 2001
Message-ID: <a73131234019d51b93cf6422fc86218d962167d4.1714722480.git.yantar92 <at> posteo.net>
From: Ihor Radchenko <yantar92 <at> posteo.net>
Date: Fri, 3 May 2024 10:46:22 +0300
Subject: [PATCH] mhtml-mode: Use `run-mode-hook' to run `prog-mode-hook'
 (bug#70671)

* lisp/textmodes/mhtml-mode.el (mhtml-mode): When running hooks
simulating inheritance from `prog-mode', use `run-mode-hooks' that
honors `delay-mode-hooks' macro.  Note that `delay-mode-hooks' is bound
to non-nil when major mode body is evaluated, so there is no chance that
any major mode-related hooks are executed twice.
---
 lisp/textmodes/mhtml-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 0b5c6756ab9..e2de6959dc6 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -359,7 +359,7 @@ mhtml-mode
   (add-hook 'before-change-functions #'c-foreign-truncate-lit-pos-cache nil t)
 
   ;; This is sort of a prog-mode as well as a text mode.
-  (run-hooks 'prog-mode-hook))
+  (run-mode-hooks 'prog-mode-hook))
 
 (put 'mhtml-mode 'flyspell-mode-predicate #'mhtml--flyspell-check-word)
 
-- 
2.44.0

[Message part 3 (text/plain, inline)]
-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 03 May 2024 15:05:02 GMT) Full text and rfc822 format available.

Notification sent to Ihor Radchenko <yantar92 <at> posteo.net>:
bug acknowledged by developer. (Fri, 03 May 2024 15:05:02 GMT) Full text and rfc822 format available.

Message #19 received at 70671-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70671-done <at> debbugs.gnu.org
Subject: Re: bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
Date: Fri, 03 May 2024 11:03:46 -0400
Thanks, pushed to `master`.
Closing,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 01 Jun 2024 11:24:18 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.