GNU bug report logs -
#64143
29.0.60; find-function-search-for-symbol truncates library path
Previous Next
Reported by: Troy Brown <brownts <at> troybrown.dev>
Date: Sun, 18 Jun 2023 04:46:02 UTC
Severity: normal
Found in version 29.0.60
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#64143: 29.0.60; find-function-search-for-symbol truncates library path
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 64143 <at> debbugs.gnu.org.
--
64143: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64143
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
> From: Troy Brown <brownts <at> troybrown.dev>
> Date: Sun, 18 Jun 2023 13:39:05 -0400
> Cc: 64143 <at> debbugs.gnu.org
>
> > Does the patch below fix this problem?
> >
>
> Indeed, it does.
Thanks, installed on the emacs-29 branch, and closing the bug.
[Message part 3 (message/rfc822, inline)]
When user-emacs-directory contains "emacs.el" in it's path (e.g.,
"~/.emacs.elpa"), which is much easier these days with the availability
of --init-directory, the find-function-search-for-symbol truncates the
library path after "emacs".
I was experimenting with a different user directory (i.e.,
"--init-directory=~/.emacs.elpa") and was surprised to find out that the
Help system was breaking when using this path. When looking up a symbol
in the Help system (e.g., "C-h f company-mode RET") and then attempting
to visit the source file from the help window (i.e., help-view-source),
if the symbol belongs to an installed package (where the source is
under the "elpa" directory beneath user-emacs-directory), it will
generate the following error message:
Can't find library: /home/troy/.emacs
Toggling "debug-on-error" and repeating the above, I can generate a
backtrace for this as follows:
Debugger entered--Lisp error: (file-error "Can't find library"
"/home/troy/.emacs")
find-library-name("/home/troy/.emacs")
#<subr find-function-search-for-symbol>(company-mode nil
"/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el")
ad-Advice-find-function-search-for-symbol(#<subr
find-function-search-for-symbol> company-mode nil
"/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el")
apply(ad-Advice-find-function-search-for-symbol #<subr
find-function-search-for-symbol> (company-mode nil
"/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el"))
find-function-search-for-symbol(company-mode nil
"/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el")
help-function-def--button-function(company-mode
"/home/troy/.emacs.elpa/elpa/company-20230416.2034/company.el" nil)
help-view-source()
funcall-interactively(help-view-source)
call-interactively(help-view-source nil nil)
command-execute(help-view-source)
I believe the following snippet of code in
find-function-search-for-symbol is to blame for this:
(when (string-match "\\.emacs\\(.el\\)" library)
(setq library (substring library 0 (match-beginning 1))))
The regex likely should be improved to only match .emacs or .emacs.el at
the end of the path, not in the middle of it.
This bug report was last modified 1 year and 336 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.