unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#66741: 30.0.50; [BUG] pdumper, global-font-lock-mode, and :init-value in define-minor-mode
@ 2023-10-25  9:02 Ihor Radchenko
  2023-10-26  9:18 ` Gerd Möllmann
  0 siblings, 1 reply; 2+ messages in thread
From: Ihor Radchenko @ 2023-10-25  9:02 UTC (permalink / raw)
  To: 66741; +Cc: eli zaretskii

X-Debbugs-CC: Eli Zaretskii <eliz@gnu.org>

Hi,

This is a followup after emacs-devel thread on using pdumper:
https://yhetil.org/emacs-devel/83msw8kw2f.fsf@gnu.org/

I was trying to create a simple Emacs dump via

------ dump.el -------
(dump-emacs-portable "/tmp/emacs-dumped.dmp")
----------------------
./src/emacs -q --batch -l ~/Downloads/dump.el

Similar to the problem described in
https://archive.casouri.cc/note/2020/painless-transition-to-portable-dumper/index.html
I got global-font-lock-mode disabled (and the value is nil) when
starting Emacs with the above dump file.

The first immediate surprise here is that lisp/loadup.el already has
(load "font-lock"). So, it should be pre-loaded already. I do not fully
understand why re-dumping changes Emacs behavior.

Trying to investigate a bit about the possible cause, I found the
following suspicious form in font-core.el:

(define-globalized-minor-mode global-font-lock-mode
  font-lock-mode turn-on-font-lock-if-desired
  ;; What was this :extra-args thingy for?  --Stef
  ;; :extra-args (dummy)
  :initialize 'custom-initialize-delay
  :init-value (not (or noninteractive emacs-basic-display))
  :group 'font-lock
  :version "22.1")

Note how :init-value is set according to `noninteractive', which is t
when creating the dump file.

It looks like either a bug in font-core.el that makes wrong assumptions
about :init-value evaluation time or a bug in `define-minor-mode' that
may need to arrange :init-value calculation to be evaluated at load
time.

-----------

Another (possible) problem appeared when I tried to work around the
above issue.  I attempted

(defun font-lock--enable-after-pdump ()
  "Re-initialize `global-font-lock-mode' after loading Emacs with dump file."
  (setq global-font-lock-mode (not (or noninteractive emacs-basic-display))))
(add-hook 'after-pdump-load-hook #'font-lock--enable-after-pdump)

But, to my surprise, it did not lead to font-lock-mode being active in
*scratch* buffer. Either I miss something important here or
`after-pdump-load-hook' may be evaluated too late in Emacs loading for
the purposes for setting up font-lock.

In GNU Emacs 30.0.50 (build 19, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2023-10-25 built on localhost
Repository revision: 8f00c9c3c6c4e76651c000e41582e002755e598b
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: Gentoo Linux

Configured using:
 'configure --with-native-compilation CFLAGS=-g3 --with-pdumper=yes'

-- 
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] 2+ messages in thread

* bug#66741: 30.0.50; [BUG] pdumper, global-font-lock-mode, and :init-value in define-minor-mode
  2023-10-25  9:02 bug#66741: 30.0.50; [BUG] pdumper, global-font-lock-mode, and :init-value in define-minor-mode Ihor Radchenko
@ 2023-10-26  9:18 ` Gerd Möllmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Möllmann @ 2023-10-26  9:18 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 66741, eli zaretskii

Ihor Radchenko <yantar92@posteo.net> writes:

> (define-globalized-minor-mode global-font-lock-mode
>   font-lock-mode turn-on-font-lock-if-desired
>   ;; What was this :extra-args thingy for?  --Stef
>   ;; :extra-args (dummy)
>   :initialize 'custom-initialize-delay
                 ^^^^^^^^^^^^^^^^^^^^^^^
                 
This at least is the same problem as for transient-mark-mode.
Don't know about the other things.





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

end of thread, other threads:[~2023-10-26  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25  9:02 bug#66741: 30.0.50; [BUG] pdumper, global-font-lock-mode, and :init-value in define-minor-mode Ihor Radchenko
2023-10-26  9:18 ` Gerd Möllmann

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