GNU bug report logs -
#31150
Entries in load-path should not have trailing slashes
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
I guess it can be considered an Emacs bug, yes.
On Wed, Mar 6, 2024, at 1:15 AM, Arash Esbati wrote:
> Radon Rosborough <radon.neon <at> gmail.com> writes:
>
> > When I perform a fresh build of AUCTeX from Git, I get the following
> > code as part of tex-site.el:
> >
> > (defvar TeX-lisp-directory
> > (expand-file-name "auctex" (file-name-directory load-file-name))
> > "The directory where most of the AUCTeX lisp files are located.
> > For the location of lisp files associated with
> > styles, see the variables TeX-style-* (hand-generated lisp) and
> > TeX-auto-* (automatically generated lisp).")
> >
> > (add-to-list 'load-path TeX-lisp-directory)
> >
> > This is problematic. As the documentation for `load-path' states:
> >
> > Use ‘directory-file-name’ when adding items to this path.
> >
> > But `TeX-lisp-directory' has a trailing slash. This seems like a bug
> > to me. Can it be fixed?
> >
> > The reason this came up is that I maintain an Emacs package manager,
> > straight.el. Once straight.el builds a package, it adds the directory
> > to `load-path', using `directory-file-name' as specified by the
> > documentation of `load-path'. But since AUCTeX insists on also adding
> > its own entry to `load-path', and does so with a superfluous trailing
> > slash, we end up with two duplicate entries. Under some
> > configurations, this causes duplicate entries to appear when using M-x
> > find-library.
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> Is this issue still present? Looking at the docstring:
>
> ,----[ C-h v load-path RET ]
> | load-path is a variable defined in ‘C source code’.
> |
> | Its value is shown below.
> |
> | List of directories to search for files to load.
> | Each element is a string (directory file name) or nil (meaning
> | ‘default-directory’).
> | This list is consulted by the ‘require’ function.
> | Initialized during startup as described in Info node ‘(elisp)Library Search’.
> | Use ‘directory-file-name’ when adding items to this path. However, Lisp
> | programs that process this list should tolerate directories both with
> | and without trailing slashes.
> |
> | This variable may be risky if used as a file-local variable.
> | Probably introduced at or before Emacs version 1.12.
> |
> `----
>
> You're correct about `directory-file-name', but the version with
> trailing slash is also tolerated. If `find-library' is confused by
> "/foo/bar" and "/foo/bar/", isn't this more an Emacs issue?
>
> Best, Arash
>
> P.S. I also added another mail address of yours to this message. Sorry
> if you get this message twice.
>
[Message part 2 (text/html, inline)]
This bug report was last modified 1 year and 103 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.