Subject: bug#77502: 31.0.50; Should after-load-functions hook report .eln file names?

From: Sean Devlin <[email-masked]>
Date: Thu, 3 Apr 2025 13:35:19 -0500

Hi folks,

I am not sure if this is a bug or not, but the behavior was confusing to
me.

Recipe:

0. If necessary, rebuild Emacs with native compilation support.
1. Emacs -Q
2. In scratch, evaluate:

(setq force-load-messages t)
(add-hook 'after-load-functions
	  (lambda (file)
	    (message "after load: %s" file)))

3. M-x load-library RET org RET
4. C-h e

The messages buffer will show a lot of messages like this:

Loading find-func (native compiled elisp)...
after load: /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/find-func.elc
Loading find-func (native compiled elisp)...done

The load messages show that a native library was loaded, but the
after-load hook reports loading a byte-compiled file.

The documentation for after-load-functions says:

"Each function there is called with a single argument, the absolute name
of the file just loaded."

I do not understand the intricacies of the native compiler and loader,
so maybe this behavior is expected. But the result seemed misleading to
me, and I could not find documentation of the disparity between what
after-load-functions reports and what is actually loaded.

Is this a bug?

Cheers, and thanks for your help!

In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.4.0, NS
appkit-2575.50 Version 15.4 (Build 24E5238a)) of 2025-03-24 built on
beatrix.local
Repository revision: 068fa2ebf9351711ef15c6fdc3d83f2487bec8e2
Repository branch: spd-igc
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.4

Configured using:
'configure --with-ns --with-modules --with-native-compilation
--with-libgmp --with-tree-sitter --with-sqlite3 --with-mps=yes
--without-imagemagick --without-dbus CPPFLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib
PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig'

Configured features:
ACL GIF GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES MPS NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug lisp-mnt message mailcap yank-media puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils misearch multi-isearch compile
text-property-search comp-run bytecomp byte-compile comp-common org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie
treesit executable ob-comint org-pcomplete pcomplete comint ansi-osc
ansi-color ring org-list org-footnote org-faces org-entities time-date
subr-x noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle
org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs cal-menu
calendar cal-loaddefs org-version org-compat org-macs format-spec
cl-loaddefs cl-lib thingatpt find-func rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads kqueue cocoa ns lcms2 multi-tty make-network-process
tty-child-frames native-compile mps emacs)

Memory information:
((conses 24 0 0) (symbols 56 0 0) (strings 40 0 0) (string-bytes 1 0)
(vectors 24 0) (vector-slots 8 0 0) (floats 24 0 0)
(intervals 64 0 0) (buffers 1000 0))