[Top][All Lists]

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

bug#35964: TeX-strip-extension not doing what's documented, TeX-master-f

From: Jan Seeger
Subject: bug#35964: TeX-strip-extension not doing what's documented, TeX-master-file always returning relative name
Date: Tue, 28 May 2019 17:40:59 +0200
User-agent: Roundcube Webmail/1.2.3


While trying to get TeX-master-file to produce an absolute path, I found that the `nodir` argument to TeX-strip-extension was not doing what was expected. The filename was still getting stripped, and the code on lines 4393 to 4398 in `tex.el` was responsible for that.

`TeX-strip-extension` is documented in the function's docstring to remove the directory name from the file name if (and only if):

(1) The NODIR argument is `t`
(2) The NODIR argument is `'path`, and the file is in the current directory or in the LaTeX macro path.

However, the second case check is implemented without regard for the special value 'path, and strips the directory even when NODIR is nil.

I've modified the check to

    (if (or (eq nodir t)
            (and (eq nodir 'path)
                  (string-equal dir (expand-file-name "./"))
                  (member dir TeX-macro-global)
                  (member dir TeX-macro-private))))
        (file-name-nondirectory strip)

and this gives me an absolute path from `TeX-strip-extension`.

Relatedly, `TeX-master-file` also fails to return an absolute path to the master file if the `NONDIR` argument is nil because the `NONDIR` argument is not forwarded to TeX-strip-extension, and thus always returns a filename without directory part. The relevant line is line 2332 in `tex.el`.

I hope these fixes make sense, if you need any more info please do not hesitate to ask.

Best regards,

reply via email to

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