From: Naofumi Yasufuku <naofumi@yasufuku.dev>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 59813@debbugs.gnu.org, stefankangas@gmail.com
Subject: bug#59813: 29.0.60; function-history: M-. fails to jump to defun if straight.el straight-cache-autoloads is enabled
Date: Thu, 15 Dec 2022 02:24:00 +0900 [thread overview]
Message-ID: <86cz8l291r.fsf@yasufuku.dev> (raw)
In-Reply-To: <83h6xyoecl.fsf@gnu.org>
Hi Eli,
Eli Zaretskii <eliz@gnu.org> writes:
> I'm not sure I understand the issue, and I'm not familiar with
> straight.el, but if the above somehow prevents the function from being
> loaded, it is expected that M-. will fail. Its ELisp backend works
> only for loaded functions. If you want it to work for functions that
> aren't loaded, you need to manually switch the backend to etags.
>
The function `loadhist--foo-inc' is definitely loaded by autoload,
but M-. fails to find defun in the source file loadhist--foo.el.
> So if the above scenario worked with Emacs 28, I suggest to check
> whether the function was being loaded with Emacs 28.
I've tried to check the state of load-history (both 28 and 29) and
function-history (29-only). The following is the difference between
Emacs 28 and 29:
;;==========================================
;; Emacs 28.2.50
;; Step 1: Create ~/.emacs.d/site-lisp/loadhist--foo.el
;;------------------------------------------
;; (defun loadhist--foo-inc (x) (1+ x))
;; (provide 'loadhist--foo)
;;------------------------------------------
;; Step 2: emacs -Q
;; Step 3: In *scratch*, M-x eval-buffer
(setq load-path (cons (locate-user-emacs-file "site-lisp") load-path))
(autoload 'loadhist--foo-inc "loadhist--foo")
(message "(loadhist--foo-inc 1): %s" (loadhist--foo-inc 1))
;;------------------------------------------
;; Step 4: Check load-history
(symbol-file 'loadhist--foo-inc 'defun)
=> "/home/naofumi/.emacs.d/site-lisp/loadhist--foo.el"
(let (matches)
(pcase-dolist (`(,file . ,elems) load-history)
(when (rassq 'loadhist--foo-inc elems)
(push (cons file elems) matches)))
(nreverse matches))
=> ((nil (autoload . loadhist--foo-inc)) ("/home/naofumi/.emacs.d/site-lisp/loadhist--foo.el" (t . loadhist--foo-inc) (defun . loadhist--foo-inc) (provide . loadhist--foo)))
;;==========================================
;;==========================================
;; Emacs 29.0.60
;; Step 1: Create ~/.emacs.d/site-lisp/loadhist--foo.el
;;------------------------------------------
;; (defun loadhist--foo-inc (x) (1+ x))
;; (provide 'loadhist--foo)
;;------------------------------------------
;; Step 2: emacs -Q
;; Step 3: In *scratch*, M-x eval-buffer
(setq load-path (cons (locate-user-emacs-file "site-lisp") load-path))
(autoload 'loadhist--foo-inc "loadhist--foo")
(message "(loadhist--foo-inc 1): %s" (loadhist--foo-inc 1))
;;------------------------------------------
;; Step 4: Check load-history and function-history
(symbol-file 'loadhist--foo-inc 'defun)
=> nil
(let (matches)
(pcase-dolist (`(,file . ,elems) load-history)
(when (rassq 'loadhist--foo-inc elems)
(push (cons file elems) matches)))
(nreverse matches))
=> ((nil (defun . loadhist--foo-inc)) ("/home/naofumi/.emacs.d/site-lisp/loadhist--foo.el" (defun . loadhist--foo-inc) (provide . loadhist--foo)))
(get 'loadhist--foo-inc 'function-history)
=> ("/home/naofumi/.emacs.d/site-lisp/loadhist--foo.el" (autoload "loadhist--foo" nil nil nil))
;;==========================================
Best regaards,
Naofumi
next prev parent reply other threads:[~2022-12-14 17:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-04 9:44 bug#59813: 29.0.60; function-history: M-. fails to jump to defun if straight.el straight-cache-autoloads is enabled Naofumi Yasufuku
2022-12-13 1:20 ` Stefan Kangas
2022-12-13 20:20 ` Naofumi Yasufuku
2022-12-13 21:30 ` Stefan Kangas
2022-12-14 17:23 ` Naofumi Yasufuku
2022-12-14 3:26 ` Eli Zaretskii
2022-12-14 17:24 ` Naofumi Yasufuku [this message]
2022-12-14 17:34 ` Naofumi Yasufuku
2022-12-14 17:48 ` Naofumi Yasufuku
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=86cz8l291r.fsf@yasufuku.dev \
--to=naofumi@yasufuku.dev \
--cc=59813@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=stefankangas@gmail.com \
/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.