auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] Improve treatment of path separator of kpsewhich output a


From: Ikumi Keita
Subject: [AUCTeX-devel] Improve treatment of path separator of kpsewhich output and misc.
Date: Wed, 06 Sep 2017 00:32:09 +0900

Hello all,

The treatment of path separator of output of kpsewhich differs between
`TeX-tree-expand' and `TeX-search-files-kpathsea' and both of them have
trouble on w32 platform, which can mess up things.

A. `TeX-tree-expand' assumes that the separator is ";" if the output
begins with dos drive letter[1], but this is not the case if the first
component of the output is a relative directory name.

B. When `TeX-kpathsea-path-delimiter' is t, `TeX-search-files-kpathsea'
assumes that the separator is ";" if the output contains ";"[2], but
this is not the case if the output consists of only one componet,
especially when the function is called with `local' SCOPE argument.
Once this wrong assumption was made on w32 platform,
`TeX-kpathsea-path-delimiter' is set to the wrong value ":" and
subsequently this function always use ":" as path separator as long as
that emacs session runs.

I don't think that it is reliable to determine the path separator from
the output of kpsewhich command.  In fact, `TeX-tree-expand' even
presumes the separator when it supplies the argument to kpsewhich[3],
before the output is obtained.  Three different logics [1][2][3] is not
a good way to take.

So I propose the attached change which includes code refactoring of the
part related to kpathsea.  The changes are summarized below:
(1) Do not try to find the right separator from the output.  Instead,
just use `path-separator' as the default value for
`TeX-kpathsea-path-delimiter' and use it in the relavant two functions.
(2) Use `TeX-tree-expand' as a helper function in
`TeX-search-files-kpathsea'.  The former half of the current code of
`TeX-search-files-kpathsea' is quite similar to `TeX-tree-expand', so
they can and should be unified.

What do you think about this?  I would appreciate your thoughts and
comments.

Best regards,
Ikumi Keita

[1] Quote from `TeX-tree-expand':
      (let ((separators (if (string-match "^[A-Za-z]:" path-list)
                            "[\n\r;]"
                          "[\n\r:]"))

[2] Quote from `TeX-search-files-kpathsea':
           (when (eq TeX-kpathsea-path-delimiter t)
             (setq TeX-kpathsea-path-delimiter
                   (if (string-match ";" dirs) ";" ":")))

[3] Quote from `TeX-tree-expand':
                               (mapconcat #'identity vars
                                          (if (eq system-type 'windows-nt)
                                              ";" ":"))))))))

Attachment: kpathsea-refactoring-patch
Description: bug fix and refactor


reply via email to

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