unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
@ 2024-04-30 13:25 Ihor Radchenko
  2024-05-02  9:51 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-04-30 13:25 UTC (permalink / raw)
  To: 70671

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@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>





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

* bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
  2024-04-30 13:25 bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks Ihor Radchenko
@ 2024-05-02  9:51 ` Eli Zaretskii
  2024-05-02 13:15   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-05-02  9:51 UTC (permalink / raw)
  To: Ihor Radchenko, Stefan Monnier; +Cc: 70671

> From: Ihor Radchenko <yantar92@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@localhost

Stefan, WDYT?





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

* bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
  2024-05-02  9:51 ` Eli Zaretskii
@ 2024-05-02 13:15   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-05-03  7:48     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-02 13:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Ihor Radchenko, 70671

>> 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@localhost
>
> Stefan, WDYT?

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


        Stefan






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

* bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
  2024-05-02 13:15   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-05-03  7:48     ` Ihor Radchenko
  2024-05-03 15:03       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-05-03  7:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 70671

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

Stefan Monnier <monnier@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mhtml-mode-Use-run-mode-hook-to-run-prog-mode-hook-b.patch --]
[-- Type: text/x-patch, Size: 1252 bytes --]

From a73131234019d51b93cf6422fc86218d962167d4 Mon Sep 17 00:00:00 2001
Message-ID: <a73131234019d51b93cf6422fc86218d962167d4.1714722480.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@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


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
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>

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

* bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks
  2024-05-03  7:48     ` Ihor Radchenko
@ 2024-05-03 15:03       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-05-03 15:03 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Eli Zaretskii, 70671-done

Thanks, pushed to `master`.
Closing,


        Stefan






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

end of thread, other threads:[~2024-05-03 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30 13:25 bug#70671: 30.0.50; mhtml-mode ignores delay-mode-hooks Ihor Radchenko
2024-05-02  9:51 ` Eli Zaretskii
2024-05-02 13:15   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-03  7:48     ` Ihor Radchenko
2024-05-03 15:03       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

	https://git.savannah.gnu.org/cgit/emacs.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).