Subject: bug#76701: closed (Re: bug#76701: 31.0.50; recent regression in [global] font-lock-mode?)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 04 Mar 2025 15:16:03 +0000

Your bug report

#76701: 31.0.50; recent regression in [global] font-lock-mode?

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76701: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76701
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#76701: 31.0.50; recent regression in [global] font-lock-mode?
From: Eli Zaretskii <[email-masked]>
To: Madhu <[email-masked]>
Cc: [email-masked]
Date: Tue, 04 Mar 2025 17:15:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Madhu <[email-masked]>
> Date: Tue, 04 Mar 2025 17:54:43 +0530
> 
> 
> This bug report can be closed without being opened.
> 
> The question has been answered in
> https://lists.gnu.org/archive/html/help-gnu-emacs/2025-03/msg00050.html
> 
>         "The commit changes the macro-expansion of
> 	`define-globalized-minor-mode`, so it will only manifest after
> 	you recompile the file that uses `define-globalized-minor-mode`
> 	to define the minor mode."
> 
> and subthreads.
> 
> This is in reference to the commit 17e26cf57e1 2024-04-13 20:01:28
> "(define-globalized-minor-mode): Require the use of `run-mode-hooks`"
> 
> [the effects didn't show up in incremental builds until this year,
> when it took effect probably after the copyright updates.]

Thanks, closing.

Subject: 31.0.50; recent regression in [global] font-lock-mode?
From: Madhu <[email-masked]>
To: [email-masked]
Date: Mon, 03 Mar 2025 08:45:05 +0530 (IST)
List-Id: <debbugs-submit.debbugs.gnu.org>

[I posted a query
https://lists.gnu.org/archive/html/help-gnu-emacs/2025-03/msg00005.html
on help-gnu-emacs but the discussion didn't proceed, so I'm reposting
here]

Attached is a test case named `debug-font-lock-foo-spec-mode.el' which
sets up a minor-mode foo-spec-mode for *.foospec files which
highlights the string "FOO-SPEC" with font-lock-warning-space.

On invoking the following sequence
```
echo FOO-SPEC > /tmp/foo.foospec
emacs -Q -l debug-font-lock-foo-spec-mode.el /tmp/foo.foospec
```

I expect to open "/tmp/foo.foospec" in a buffer and have it fontified
in red.  However the buffer ends up with font-lock-mode: nil even
though global-font-lock-mode is t (under emacs -Q).

I think this used to work until recently. Is this a possible
regression or is the testcase flawed because of some recent changes?
--Best Regards, Madhu

(defvar foo-spec-mode-font-lock-keywords
  (list
   (cons "^FOO-SPEC$"  '(0 font-lock-warning-face))))

(defun foo-spec-mode ()
  (interactive)
  (kill-all-local-variables)
  (setq major-mode 'foo-spec-mode)
  (setq mode-name "FooSpec")
  (setq-local font-lock-defaults '(foo-spec-mode-font-lock-keywords nil t))
  (run-hooks 'foo-spec-mode-hook))

(add-to-list 'auto-mode-alist '("\\.foospec$" . foo-spec-mode))