GNU bug report logs - #31150
Entries in load-path should not have trailing slashes

Previous Next

Package: emacs;

Reported by: Radon Rosborough <radon.neon <at> gmail.com>

Date: Fri, 13 Apr 2018 23:29:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: 31150 <at> debbugs.gnu.org
Cc: radon <at> intuitiveexplanations.com
Subject: bug#31150: Entries in load-path should not have trailing slashes
Date: Wed, 06 Mar 2024 21:39:42 +0100
Hi all,

I'm forwarding a report from straight.el author originally submitted to
AUCTeX.  In short, AUCTeX adds directories to `load-path' with a
trailing slash, which is tolerated:

,----[ 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.
`----

and it seems that `find-library' can't handle "/foo/bar" and "/foo/bar/"
in `load-path' (see below).  I don't use straight.el and don't have a
recipe to reproduce this, maybe you can catch up on this with Radon.

TIA.  Best, Arash

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.
>
> Best regards,
> Radon Rosborough




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.