auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. c27f60f4c69452bfc2752


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. c27f60f4c69452bfc2752b47539938c9f1fea7b0
Date: Sun, 3 Dec 2017 10:19:48 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  c27f60f4c69452bfc2752b47539938c9f1fea7b0 (commit)
      from  0aa32751c3694611aef5fdb1220c0c1830b59f32 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c27f60f4c69452bfc2752b47539938c9f1fea7b0
Author: Ikumi Keita <address@hidden>
Date:   Mon Dec 4 00:17:02 2017 +0900

    Fix auto detect of kpathsea delimeter
    
    * tex.el (TeX-kpathsea-detect-path-delimiter): New function.
    (TeX-kpathsea-path-delimiter): Use it to obtain the default value.
    (TeX-tree-expand): Use it to simplify auto detection method.
    Use `TeX-kpathsea-path-delimiter' for argument given to kpsewhich
    command.  Using constant ";" is completely wrong for most kpsewhich
    implementation.

diff --git a/tex.el b/tex.el
index f4f1b2e..5ee02b4 100644
--- a/tex.el
+++ b/tex.el
@@ -2696,8 +2696,28 @@ If REGEXP is nil, or \"\", an error will occur."
          (setq answers (cons entry answers))))
     answers))
 
+(defun TeX-kpathsea-detect-path-delimiter ()
+  "Auto detect the path delimiter for kpsewhich command.
+Usually return \":\" or \";\".  If auto detect fails for some reason,
+return nil."
+  (let ((res (ignore-errors
+              (with-output-to-string
+                (call-process "kpsewhich" nil
+                              (list standard-output nil) nil
+                              "--expand-path" "{.,..}")))))
+    ;; kpsewhich expands "{.,..}" to ".:SOMEDIR" or ".;SOMEDIR"
+    ;; according to its environment.
+    ;; Don't use "{.,.}" instead because kpsewhich of MiKTeX 2.9
+    ;; simplifies it to just a ".", not ".;.".
+    (and (stringp res) (> (length res) 0)
+        ;; Check whether ; is contained.  This should work even if
+        ;; some implementation of kpsewhich considers it sane to
+        ;; insert drive letters or directory separators or whatever
+        ;; else to the current directory.
+        (if (string-match ";" res) ";" ":"))))
+
 (defcustom TeX-kpathsea-path-delimiter
-  (if (memq system-type '(windows-nt cygwin)) t path-separator)
+  (TeX-kpathsea-detect-path-delimiter)
   "Path delimiter for kpathsea output.
 t means autodetect, nil means kpathsea is disabled."
   :group 'TeX-file
@@ -2716,17 +2736,15 @@ are returned."
   ;; FIXME: The GNU convention only uses "path" to mean "list of directories"
   ;; and uses "filename" for the name of a file even if it contains possibly
   ;; several elements separated by "/".
+  (if (eq TeX-kpathsea-path-delimiter t)
+      (setq TeX-kpathsea-path-delimiter
+           (TeX-kpathsea-detect-path-delimiter)))
   (when TeX-kpathsea-path-delimiter
     (let* ((exit-status 1)
           (args `(,@(if program `("--progname" ,program))
                   "--expand-path"
-                  ;; It seems that kpsewhich accepts semicolon as
-                  ;; path delimiter even on non-w32 platform and
-                  ;; converts it to colon if necessary.
-                  ;; Quote from texmf.cnf of TeXLive 2017:
-                  ;; "In this file, either ; or : can be used to
-                  ;; separate path components."
-                  ,(mapconcat #'identity vars ";")))
+                  ,(mapconcat #'identity vars
+                              TeX-kpathsea-path-delimiter)))
           (path-list (ignore-errors
                        (with-output-to-string
                          (setq exit-status
@@ -2737,34 +2755,8 @@ are returned."
       (if (not (zerop exit-status))
          ;; kpsewhich is not available.  Disable subsequent usage.
          (setq TeX-kpathsea-path-delimiter nil)
-       (let* ((delim
-               (cond
-                ;; If `TeX-kpathsea-path-delimiter' isn't t, use it
-                ;; for path delimiter.
-                ((not (eq TeX-kpathsea-path-delimiter t))
-                 TeX-kpathsea-path-delimiter)
-                ;; Otherwise, if the output begins with DOS drive
-                ;; letter or contains semicolon, we can set
-                ;; `TeX-kpathsea-path-delimiter' to ";" and use it
-                ;; for path delimiter.
-                ((string-match "^[A-Za-z]:\\|;" path-list)
-                 (setq TeX-kpathsea-path-delimiter ";"))
-                ;; Otherwise, if the output contains colon, we can set
-                ;; `TeX-kpathsea-path-delimiter' to ":" and use it
-                ;; for path delimiter.
-                ((string-match ":" path-list)
-                 (setq TeX-kpathsea-path-delimiter ":"))
-                ;; Otherwise, the output of this particular run
-                ;; happens to contain just one component (without any
-                ;; delimiter) of relative path (without DOS drive
-                ;; letter).
-                ;; It is safe to use ":" as delimiter for this case,
-                ;; but we cannot determine the value of
-                ;; `TeX-kpathsea-path-delimiter' now.
-                (t
-                 ":")))
-              (separators (format "[\n\r%s]" delim))
-              path input-dir-list)
+       (let ((separators (format "[\n\r%s]" TeX-kpathsea-path-delimiter))
+             path input-dir-list)
          (dolist (item (condition-case nil
                            (split-string path-list separators t)
                          ;; COMPATIBILITY for XEmacs <= 21.4.15

-----------------------------------------------------------------------

Summary of changes:
 tex.el | 64 ++++++++++++++++++++++++++++------------------------------------
 1 file changed, 28 insertions(+), 36 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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