auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slash at the end of directory (was Re: oddity with TeX-style-private


From: Ikumi Keita
Subject: Re: Slash at the end of directory (was Re: oddity with TeX-style-private ?)
Date: Sun, 25 Oct 2020 21:55:57 +0900

Hi Tassilo,

>>>>> Tassilo Horn <tsdh@gnu.org> writes:
> IMHO, `TeX-strip-extension' and `TeX-parse-path' should better test with
> (member dir (mapcar #'file-name-as-directory TeX-style-global)) etc.  It
> shouldn't be the user's job to ensure that directory names are written
> with a trailing slash.

OK, then how about the following patch?

Regards,
Ikumi Keita

diff --git a/tex-site.el.in b/tex-site.el.in
index fd28869d..12287d51 100644
--- a/tex-site.el.in
+++ b/tex-site.el.in
@@ -75,7 +75,6 @@ TeX-auto-* (automatically generated lisp).")
 (defcustom TeX-auto-global
     @lispautodir@
   "*Directory containing automatically generated information.
-Must end with a directory separator.
 
 For storing automatic extracted information about the TeX macros
 shared by all users of a site."
diff --git a/tex.el b/tex.el
index 43cc8d11..d722587e 100644
--- a/tex.el
+++ b/tex.el
@@ -2612,6 +2612,9 @@ If REGEXP is nil, or \"\", an error will occur."
                       (TeX-split-string
                        (if (string-match ";" value) ";" ":")
                        value)))
+        (global (append '("/" "\\")
+                        (mapcar #'file-name-as-directory
+                                TeX-macro-global)))
         entry
         answers)
     (while entries
@@ -2622,7 +2625,7 @@ If REGEXP is nil, or \"\", an error will occur."
                       (substring entry 0 (match-beginning 0))
                     entry)))
       (or (not (file-name-absolute-p entry))
-         (member entry (append '("/" "\\") TeX-macro-global))
+         (member entry global)
          (setq answers (cons entry answers))))
     answers))
 
@@ -4483,8 +4486,9 @@ If EXTENSIONS is not specified or nil, the value of
 (defun TeX-strip-extension (&optional string extensions nodir nostrip)
   "Return STRING without any trailing extension in EXTENSIONS.
 If NODIR is t, also remove directory part of STRING.
-If NODIR is `path', remove directory part of STRING if it is equal to
-the current directory, `TeX-macro-private' or `TeX-macro-global'.
+If NODIR is `path', remove directory part of STRING if it is
+equal to the current directory or is a member of
+`TeX-macro-private' or `TeX-macro-global'.
 If NOSTRIP is set, do not remove extension after all.
 STRING defaults to the name of the current buffer.
 EXTENSIONS defaults to `TeX-file-extensions'."
@@ -4502,8 +4506,8 @@ EXTENSIONS defaults to `TeX-file-extensions'."
         (dir (expand-file-name (or (file-name-directory strip) "./"))))
     (if (or (eq nodir t)
            (string-equal dir (expand-file-name "./"))
-           (member dir TeX-macro-global)
-           (member dir TeX-macro-private))
+           (member dir (mapcar #'file-name-as-directory TeX-macro-global))
+           (member dir (mapcar #'file-name-as-directory TeX-macro-private)))
        (file-name-nondirectory strip)
       strip)))
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]