From: Alan Mackenzie <acm@muc.de>
To: Nonax <nonax@posteo.net>
Cc: acm@muc.de, 43116@debbugs.gnu.org
Subject: bug#43116: 27.1; with-eval-after-load executes BODY multiple times for fortran
Date: 31 Aug 2020 11:34:28 -0000 [thread overview]
Message-ID: <20200831113428.96126.qmail@mail.muc.de> (raw)
In-Reply-To: <mailman.1792.1598806565.2469.bug-gnu-emacs@gnu.org>
Hello, Nonax.
In article <mailman.1792.1598806565.2469.bug-gnu-emacs@gnu.org> you wrote:
> Hello,
> The following command will reproduce the bug: emacs -Q -l mwe.el f.f
> f.f does not have to exist, it just serves to open a buffer and enable
> fortran-mode. The file mwe.el contains the following:
> (with-eval-after-load 'fortran
> (if (boundp 'fortran-canary)
> (message "..is cursed.")
> (message "FORTRAN.."))
> (defvar fortran-canary t))
> ;;; end of mwe.el
> The following message will appear in the *Message* buffer:
> FORTRAN..
> ..is cursed.
> suggesting BODY has been executed twice. This problem seems to persist
> across multiple versions of Emacs. It seems to only apply to fortran
> specifically, however. I could not reproduce it with other features.
> Kind regards,
> N.
> In GNU Emacs 27.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
> 3.24.21, cairo version 1.16.0)
> of 2020-08-20 built on buildvm-x86-24.iad2.fedoraproject.org
> Windowing system distributor 'Fedora Project', version 11.0.12008000
> System Description: Fedora 32 (Workstation Edition)
[ .... ]
Diagnosis:
1. At a fairly low level, (load "fortran") gets called.
2. In fortran.el L658 in (defvar fortran-mode-map ....) there's a form
,(custom-menu-create 'fortran). This gets evaluated during the load.
3. custom-menu-create's call stack (pertinent part) looks like:
(do-after-load-evaluation "path/to/fortran.elc")
(require 'fortran) <=========================================
(custom-load-symbol 'fortran)
(custom-menu-create 'fortran)
4. The above do-after-load-evaluation eventually calls the fortran
eval-after-load function that outputs "FORTRAN..".
5. At a later stage of the load, do-after-load-evaluation gets called by
load normally. This calls the eval-after-load function again, which
outputs "..is cursed.".
In a nutshell, the problem is the recursive (require 'fortran) called
from within (load "fortran").
I don't yet have any idea on how to fix this bug.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2020-08-31 11:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-30 16:18 bug#43116: 27.1; with-eval-after-load executes BODY multiple times for fortran Nonax
[not found] ` <mailman.1792.1598806565.2469.bug-gnu-emacs@gnu.org>
2020-08-31 11:34 ` Alan Mackenzie [this message]
2021-06-12 12:46 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200831113428.96126.qmail@mail.muc.de \
--to=acm@muc.de \
--cc=43116@debbugs.gnu.org \
--cc=nonax@posteo.net \
/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 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).