all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: 66741@debbugs.gnu.org
Cc: eli zaretskii <eliz@gnu.org>
Subject: bug#66741: 30.0.50; [BUG] pdumper, global-font-lock-mode, and :init-value in define-minor-mode
Date: Wed, 25 Oct 2023 09:02:25 +0000	[thread overview]
Message-ID: <875y2vgjmm.fsf@localhost> (raw)

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>





             reply	other threads:[~2023-10-25  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  9:02 Ihor Radchenko [this message]
2023-10-26  9:18 ` bug#66741: 30.0.50; [BUG] pdumper, global-font-lock-mode, and :init-value in define-minor-mode Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875y2vgjmm.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=66741@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.