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

From: Naofumi Yasufuku <[email-masked]>
Date: Thu, 15 Dec 2022 02:48:29 +0900

Naofumi Yasufuku <[email-masked]> writes:

>
> If 3rd (message .. (loadhist--foo-inc 1)) is not exist and only autoload
> is evaluated, there is no differnce between Emacs 28 and 29:
>

Sorry. In autoload-only case, the difference is just
Emacs 29 (defun. loadhist--foo-inc) and
Emacs 28 (autoload . loadhist--foo-inc).

`symbol-file' returns autoload file.

> ;;==========================================
> ;; Emacs 28.2.50
>
[..snip..]
>
> ;; 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")
>
> ;;------------------------------------------
> ;; Step 4: Check load-history
>
> (symbol-file 'loadhist--foo-inc 'defun)
> => "loadhist--foo"
>
> (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)))
>
> ;;==========================================
>
>
> ;;==========================================
> ;; Emacs 29.0.60
>
[..snip..]
>
> ;; 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")
>
> ;;------------------------------------------
> ;; Step 4: Check load-history and function-history
>
> (symbol-file 'loadhist--foo-inc 'defun)
> => "loadhist--foo"
>
> (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)))
>
> (get 'loadhist--foo-inc 'function-history)
> => nil
>
> ;;==========================================
>

Regards,
  Naofumi