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

To reply to this bug, email your comments to 31150 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Fri, 13 Apr 2018 23:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Radon Rosborough <radon.neon <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Fri, 13 Apr 2018 23:29:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Radon Rosborough <radon.neon <at> gmail.com>
To: bug-auctex <at> gnu.org
Subject: Entries in load-path should not have trailing slashes
Date: Fri, 13 Apr 2018 16:27:24 -0700
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




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sat, 14 Apr 2018 12:39:01 GMT) Full text and rfc822 format available.

Message #8 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Radon Rosborough <radon.neon <at> gmail.com>
Cc: 31150 <at> debbugs.gnu.org, tino.calancha <at> gmail.com
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sat, 14 Apr 2018 21:37:51 +0900
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?
Thank you for the report.
I see in the sources of this package the following address to submit bug
reports: bug-auctex <at> gnu.org (`TeX-submit-bug-report').


> 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.
You could find this problem again with other packages in the future.
Maybe it's good idea to add some defensive code, for instance:
--8<-----------------------------cut here---------------start------------->8---
commit 3e1e25c888a28971d818d82270ce1116feb6fb75
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Sat Apr 14 21:35:49 2018 +0900

    Prevent from adding a dir with trailing slashes into load-path
    
    (straight--drop-trailing-slashes-from-load-path): New defun.
    (straight--add-package-to-load-path): Use it.

diff --git a/straight.el b/straight.el
index 3459057..e62a590 100644
--- a/straight.el
+++ b/straight.el
@@ -3300,12 +3300,25 @@ the reason this package is being built."
 
 ;;;; Loading packages
 
+(defun straight--drop-trailing-slashes-from-load-path ()
+  "Return a copy of `load-path' with stripped trailing slashes.
+For instance, change the directory `/foo/bar/' into `/foo/bar'."
+  (delete-dups
+   (mapcar
+    (lambda (dir)
+      (let ((len (length dir)))
+        (while (and (> len 0) (eq ?/ (aref dir (1- len))))
+          (setq dir (substring dir 0 -1)
+                len (1- len)))
+        dir)) load-path)))
+
 (defun straight--add-package-to-load-path (recipe)
   "Add the package specified by RECIPE to the `load-path'.
 RECIPE is a straight.el-style plist. It is assumed that the
 package has already been built."
   (straight--with-plist recipe
       (package)
+    (setf load-path (straight--drop-trailing-slashes-from-load-path))
     (add-to-list 'load-path (straight--build-dir package))))
 
 (defun straight--add-package-to-info-path (recipe)

--8<-----------------------------cut here---------------end--------------->8---




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sat, 14 Apr 2018 17:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Radon Rosborough <radon.neon <at> gmail.com>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 31150 <at> debbugs.gnu.org
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sat, 14 Apr 2018 10:05:51 -0700
> I see in the sources of this package the following address to submit
> bug reports

I did several Google searches along the lines of "auctex bug tracker",
and did not find this command. Perhaps some SEO would be in order.

> You could find this problem again with other packages in the future.
> Maybe it's good idea to add some defensive code

Thanks, I might consider this. (straight.el supports Windows, so I
would need to generalize your patch to use the OS-independent path
manipulation functions.) For now, however, I think I'll leave things
be, since out of the ~114 packages I use, only AUCTeX and Geiser had
this problem (and it should really be fixed upstream).




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sat, 14 Apr 2018 17:36:02 GMT) Full text and rfc822 format available.

Message #14 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: David Kastrup <dak <at> gnu.org>
To: Radon Rosborough <radon.neon <at> gmail.com>
Cc: 31150 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sat, 14 Apr 2018 19:34:49 +0200
Radon Rosborough <radon.neon <at> gmail.com> writes:

>> I see in the sources of this package the following address to submit
>> bug reports
>
> I did several Google searches along the lines of "auctex bug tracker",
> and did not find this command. Perhaps some SEO would be in order.

For crying out loud, one does not have to look in the "sources of this"
package or use "Google" searches.  The package has documentation.  The
documentation is available in the usual places (Info) and also in the
menus of the package (like in the LaTeX menu).

The menus of the package also contain an entry for submitting bug
reports.

Perhaps some minimal trust in the package authors would be in order.

> Thanks, I might consider this. (straight.el supports Windows, so I
> would need to generalize your patch to use the OS-independent path
> manipulation functions.) For now, however, I think I'll leave things
> be, since out of the ~114 packages I use, only AUCTeX and Geiser had
> this problem (and it should really be fixed upstream).

How about reading the documentation of load-path?

    load-path is a variable defined in ‘C source code’.
    Its value is

    [...]

    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.

I repeat:

However, Lisp programs that process this list should tolerate
directories both with and without trailing slashes.

And there is good reason for that: XEmacs used to do things differently
(and wasn't tolerant about it as opposed to Emacs if I remember
correctly) and thus many packages used that behavior.  XEmacs may be
mostly history, but many packages are historic as well.  It's good to
remind AUCTeX that it can adapt to standard behavior now, but as a
package manager, your code _certainly_ should adhere to the instructions
in load-path documentation.

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sat, 14 Apr 2018 21:43:01 GMT) Full text and rfc822 format available.

Message #17 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Radon Rosborough <radon.neon <at> gmail.com>
To: David Kastrup <dak <at> gnu.org>
Cc: 31150 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sat, 14 Apr 2018 14:41:52 -0700
> For crying out loud, one does not have to look in the "sources of
> this" package or use "Google" searches. The package has
> documentation.

Most people use search engines to find documentation these days.
That's not a value judgement; it's just a statement of fact.

> The documentation is available in the usual places (Info)

Info is not as standard as you make it out to be. I investigated the
486 packages that I have installed, and found that 297 of them have at
least minimal documentation hosted on GitHub in the form of a
README.md, while only 26 of them include any Info documentation.

> The menus of the package also contain an entry for submitting bug
> reports.

That is true, but the vast majority of packages do not contain any
such menu entries. Furthermore, many users do not use the Emacs menus.

> However, Lisp programs that process this list should tolerate
> directories both with and without trailing slashes. [...] as a
> package manager, your code _certainly_ should adhere to the
> instructions in load-path documentation.

My package manager does not exactly fall under the rubric of "Lisp
programs that process this list". It does not do any processing,
really; it just adds an entry. If that is counted as processing, then
every time any Lisp program adds anything to `load-path', it should be
checking to make sure there is not a duplicate entry with a trailing
slash. Since nobody does that, I inferred that it doesn't make much
sense in this case either.

---

Looking at the summary page for the bug-auctex list, I see that it
does indeed mention M-x TeX-submit-bug-report, so it was a mistake for
me to say that it didn't. Sorry about that.

---

Best regards,
Radon Rosborough




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sat, 14 Apr 2018 22:08:01 GMT) Full text and rfc822 format available.

Message #20 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: David Kastrup <dak <at> gnu.org>
To: Radon Rosborough <radon.neon <at> gmail.com>
Cc: 31150 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sun, 15 Apr 2018 00:06:57 +0200
Radon Rosborough <radon.neon <at> gmail.com> writes:

>> For crying out loud, one does not have to look in the "sources of
>> this" package or use "Google" searches. The package has
>> documentation.
>
> Most people use search engines to find documentation these days.

But it takes an extraordinary amount of chutzpah to blame the package
authors when the results are crap.  Basically you think the package
authors too stupid to create useful documentation and instead ask the
next person on the street.  And then you blame the package author for
not talking to enough persons on the street to render this hearsay
useful.

> That's not a value judgement; it's just a statement of fact.
>
>> The documentation is available in the usual places (Info)
>
> Info is not as standard as you make it out to be.

Info is the standard information format for Elisp packages.  And
complaining about lack of documentation and bug reporting instructions
when both are in the package's top level menu structure also is not
exactly a sign that the package authors are to blame.

> That is true, but the vast majority of packages do not contain any
> such menu entries. Furthermore, many users do not use the Emacs menus.

Users who don't use the menus and don't read the delivered documentation
then complain that the package authors should do more search engine
optimization.

Sorry, go and cry to Google that their algorithms are too stupid to pick
up the standard documentation of packages then.

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sun, 15 Apr 2018 04:03:02 GMT) Full text and rfc822 format available.

Message #23 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Radon Rosborough <radon.neon <at> gmail.com>
To: David Kastrup <dak <at> gnu.org>
Cc: 31150 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sat, 14 Apr 2018 21:01:28 -0700
> For crying out loud, one does not have to look in the "sources of
> this" package or use "Google" searches.

> Perhaps some minimal trust in the package authors would be in order.

> How about reading the documentation of load-path?

> it takes an extraordinary amount of chutzpah to blame the package
> authors when the results are crap. Basically you think the package
> authors too stupid to create useful documentation

> Sorry, go and cry to Google that their algorithms are too stupid to
> pick up the standard documentation of packages then.

It does not seem productive for us to continue this discussion
further, and I am not particularly interested in continuing to be
insulted. I will not reply to further messages along the above lines.

Let me know if you require any more information relevant to the bug
report.

Best regards,
Radon




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sun, 15 Apr 2018 04:22:02 GMT) Full text and rfc822 format available.

Message #26 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Reinhard Kotucha <reinhard.kotucha <at> web.de>
To: Radon Rosborough <radon.neon <at> gmail.com>
Cc: David Kastrup <dak <at> gnu.org>, 31150 <at> debbugs.gnu.org,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sun, 15 Apr 2018 06:21:30 +0200
On 2018-04-14 at 14:41:52 -0700, Radon Rosborough wrote:

 > Most people use search engines to find documentation these days.
 > That's not a value judgement; it's just a statement of fact.

Dear Radon,
it's true that most poeple use search engines nowadays but it's
actually the worst thing one can do.  The quality of the results is
quite arbitrary.  In most cases saerch engines return old stuff which
isn't relevant anymore or wrong answers from poeple who just believe
that they groked something.

A definite answer is and can only be provided by the documentation
shipped with a particular package.  Everything else is less helpful or
not helpful at all.

Regards,
  Reinhard

-- 
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha <at> web.de
------------------------------------------------------------------




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Sun, 15 Apr 2018 06:40:01 GMT) Full text and rfc822 format available.

Message #29 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Reinhard Kotucha <reinhard.kotucha <at> web.de>
To: Radon Rosborough <radon.neon <at> gmail.com>
Cc: David Kastrup <dak <at> gnu.org>, 31150 <at> debbugs.gnu.org,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Sun, 15 Apr 2018 08:39:28 +0200
On 2018-04-14 at 21:01:28 -0700, Radon Rosborough wrote:

 > > For crying out loud, one does not have to look in the "sources of
 > > this" package or use "Google" searches.
 > 
 > > Perhaps some minimal trust in the package authors would be in order.
 > 
 > > How about reading the documentation of load-path?
 > 
 > > it takes an extraordinary amount of chutzpah to blame the package
 > > authors when the results are crap. Basically you think the package
 > > authors too stupid to create useful documentation
 > 
 > > Sorry, go and cry to Google that their algorithms are too stupid to
 > > pick up the standard documentation of packages then.
 > 
 > It does not seem productive for us to continue this discussion
 > further, and I am not particularly interested in continuing to be
 > insulted. I will not reply to further messages along the above lines.

As someone who met David many times in person at various conferences,
I can assure you that it's definitely not David's intention to insult
you or anybody else in any way.

I know many people who acknowledge David's helpfulness very much.
But it's also well known that David immediately gets pissed-off if
he's blamed for things he isn't responsible for.  Admittedly, his
mail messages often sound quite harsh.  Don't worry.

It's a pity that you didn't have the opportunity to meet David in
person.  The internet is a great thing because it allows you to
communicate with everybody in the world.  But it's also the cause of
many problems which are avoidable if poeple simply meet physically as
we did when I was young.

I know David very well and can assure you that the least thing he had
in mind is to insult you.  Don't worry if his mails sound quite harsh.

I'm looking forward to meet you both at BachoTeX-2018.

Regards,
  Reinhard

-- 
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha <at> web.de
------------------------------------------------------------------




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Wed, 06 Mar 2024 09:18:02 GMT) Full text and rfc822 format available.

Message #32 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Radon Rosborough <radon.neon <at> gmail.com>, Radian LLC
 <contact+straight <at> radian.codes>
Cc: 31150 <at> debbugs.gnu.org
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Wed, 06 Mar 2024 10:15:46 +0100
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.




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Wed, 06 Mar 2024 16:59:01 GMT) Full text and rfc822 format available.

Message #35 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: "Radon Rosborough" <radon <at> intuitiveexplanations.com>
To: "Arash Esbati" <arash <at> gnu.org>
Cc: 31150 <at> debbugs.gnu.org
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Wed, 06 Mar 2024 08:24:07 -0800
[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)]

Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Wed, 06 Mar 2024 20:21:01 GMT) Full text and rfc822 format available.

Message #38 received at 31150 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: "Radon Rosborough" <radon <at> intuitiveexplanations.com>
Cc: 31150 <at> debbugs.gnu.org
Subject: Re: bug#31150: Entries in load-path should not have trailing slashes
Date: Wed, 06 Mar 2024 21:19:41 +0100
"Radon Rosborough" <radon <at> intuitiveexplanations.com> writes:

> I guess it can be considered an Emacs bug, yes.

Thanks for your response.  I will forward your original report to Emacs
tracker (with you in CC) and reassign it.  Hopefully the people there
have an idea.

Best, Arash




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Wed, 06 Mar 2024 20:41:02 GMT) Full text and rfc822 format available.

Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: "emacs-bugs" <bug-gnu-emacs <at> gnu.org>
Cc: 31150 <at> debbugs.gnu.org, Radon Rosborough <radon <at> intuitiveexplanations.com>
Subject: Re: 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




Information forwarded to bug-auctex <at> gnu.org:
bug#31150; Package auctex. (Wed, 06 Mar 2024 20:41:02 GMT) Full text and rfc822 format available.

bug reassigned from package 'auctex' to 'emacs'. Request was from Arash Esbati <arash <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 06 Mar 2024 20:44:02 GMT) Full text and rfc822 format available.

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.