GNU bug report logs - #59813
29.0.60; function-history: M-. fails to jump to defun if straight.el straight-cache-autoloads is enabled

Previous Next

Package: emacs;

Reported by: Naofumi Yasufuku <naofumi <at> yasufuku.dev>

Date: Sun, 4 Dec 2022 09:45:02 UTC

Severity: normal

Tags: confirmed

Found in versions 29.0.60, 30.0.50

Full log


View this message in rfc822 format

From: Naofumi Yasufuku <naofumi <at> yasufuku.dev>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 59813 <at> debbugs.gnu.org
Subject: bug#59813: 29.0.60; function-history: M-. fails to jump to defun if straight.el straight-cache-autoloads is enabled
Date: Wed, 14 Dec 2022 05:20:20 +0900
Hello Stefan,

Stefan Kangas <stefankangas <at> gmail.com> writes:
>>
>> M-. fails to jump to defun if autoload forms are evaluated in init.el
>> without `load'; it is the way of straight.el autoloads cache feature
>> (enabled by default):
>>
>>   https://github.com/radian-software/straight.el/blob/master/straight.el
>>
>>   straight--activate-package-autoloads
>>   straight--read-package-autoloads
>
> What makes you think this is a bug in Emacs, and not in straight?
>

I thought that it could be an issue of Emacs-side because:

a) What straight.el does is just `eval' of autoload forms;
b) M-. failure is reproducible without straight.el;
c) Autoloading itself works fine even if autoload forms are evaluated
   without `load';
d) It works well with Emacs <= 28;

> Did you report this to the straight developers first?
>

No, I didn't.  But the following Github issue might be the same:

  C-h f for some functions link to the loading file instead of their source file:
  https://github.com/radian-software/straight.el/issues/1022


I tried to find more simple recipe.  Could you try this with emacs-29
or master?

----------------------------------------
1. Create the following file

~/.emacs.d/site-lisp/loadhist--foo.el

#+begin_src emacs-lisp
(defun loadhist--foo-inc (x) (1+ x))
(provide 'loadhist--foo)
#+end_src

----------------------------------------
2. emacs -Q

----------------------------------------
3. Insert the following to *scratch*

#+begin_src emacs-lisp
(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))
#+end_src

----------------------------------------
4. In *scratch*, M-x eval-buffer

----------------------------------------
5. M-. on `loadhist--foo-inc'
=>
xref--not-found-error: No definitions found for: loadhist--foo-inc

----------------------------------------
6. In *scratch*, M-x eval-buffer again

----------------------------------------
5. M-. on `loadhist--foo-inc'
=>
Jumps to defun in ~/.emacs.d/site-lisp/loadhist--foo.el

----------------------------------------


Best regards,
  Naofumi





This bug report was last modified 1 year and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.