[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 9fdfe2c 01/15: Re-implement auto-detect of path
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 9fdfe2c 01/15: Re-implement auto-detect of path separator from kpsewhich output |
Date: |
Wed, 6 Dec 2017 09:48:32 -0500 (EST) |
branch: externals/auctex
commit 9fdfe2c3d466d0a37b2d46b94052516e16d2c0c5
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Re-implement auto-detect of path separator from kpsewhich output
* tex.el (TeX-kpathsea-path-delimiter): Accept t for Autodetect again
and make it default on w32 platform.
(TeX-tree-expand): Use heuristics as much as possible to determine the
path separator, paying attention to the case that it cannot be
determined.
---
tex.el | 48 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 39 insertions(+), 9 deletions(-)
diff --git a/tex.el b/tex.el
index 8eab9bc..f4f1b2e 100644
--- a/tex.el
+++ b/tex.el
@@ -2696,16 +2696,15 @@ If REGEXP is nil, or \"\", an error will occur."
(setq answers (cons entry answers))))
answers))
-(defcustom TeX-kpathsea-path-delimiter path-separator
+(defcustom TeX-kpathsea-path-delimiter
+ (if (memq system-type '(windows-nt cygwin)) t path-separator)
"Path delimiter for kpathsea output.
-nil means kpathsea is disabled."
+t means autodetect, nil means kpathsea is disabled."
:group 'TeX-file
:type '(choice (const ":")
(const ";")
+ (const :tag "Autodetect" t)
(const :tag "Off" nil)))
-;; backward compatibility
-(when (eq TeX-kpathsea-path-delimiter t)
- (setq TeX-kpathsea-path-delimiter path-separator))
(defun TeX-tree-expand (vars program &optional subdirs)
"Return directories corresponding to the kpathsea variables VARS.
@@ -2721,8 +2720,13 @@ are returned."
(let* ((exit-status 1)
(args `(,@(if program `("--progname" ,program))
"--expand-path"
- ,(mapconcat #'identity vars
- TeX-kpathsea-path-delimiter)))
+ ;; 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 ";")))
(path-list (ignore-errors
(with-output-to-string
(setq exit-status
@@ -2733,8 +2737,34 @@ are returned."
(if (not (zerop exit-status))
;; kpsewhich is not available. Disable subsequent usage.
(setq TeX-kpathsea-path-delimiter nil)
- (let ((separators (format "[\n\r%s]" TeX-kpathsea-path-delimiter))
- path input-dir-list)
+ (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)
(dolist (item (condition-case nil
(split-string path-list separators t)
;; COMPATIBILITY for XEmacs <= 21.4.15
- [elpa] externals/auctex updated (5f007f1 -> 3ac4a91), Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 9fdfe2c 01/15: Re-implement auto-detect of path separator from kpsewhich output,
Tassilo Horn <=
- [elpa] externals/auctex b01f2f2 02/15: Add style path explicitly, Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 478c987 03/15: Revert wrong test, Tassilo Horn, 2017/12/06
- [elpa] externals/auctex f0c4f4d 07/15: * style/longtable.el ("longtable"): Use `make-local-variable'., Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 8a12cae 06/15: * tex-ispell.el: Add entry for "xltabular" environment., Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 575078f 12/15: ; Release_11.92, Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 0aa3275 08/15: Get rid of `delete-dups', Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 1ea45c8 11/15: ; make change-history-commit, Tassilo Horn, 2017/12/06
- [elpa] externals/auctex 464e1b4 05/15: Fix style/xltabular.el, Tassilo Horn, 2017/12/06
- [elpa] externals/auctex acb5cf6 10/15: Prepare for upcoming release, Tassilo Horn, 2017/12/06
- [elpa] externals/auctex e195604 04/15: Reduce code duplication in tests, Tassilo Horn, 2017/12/06