bug-auctex
[Top][All Lists]
Advanced

[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: Ikumi Keita
Subject: bug#35964: TeX-strip-extension not doing what's documented, TeX-master-file always returning relative name
Date: Thu, 20 Jun 2019 19:42:13 +0900

Hi Jan,

Please keep address@hidden in Cc: when you reply.

>>>>> Jan Seeger <address@hidden> writes:
> If there is a better way to get the absolute path of the master file,
> let me know!

How about "%a" defined in `TeX-expand-list-builtin' instead of your
"%(abs)"?
(Ah, but it seems to my eyes not to return the expected file name when
used with partical typeset like C-c C-r and so on...  If that is
problematic for you, please let us know.)

> To explain some backstory: I've added a custom viewer (Foxit) with an
> argument that allows automatic reloading on Windows. However, Foxit is
> a multi-document application, so the working directory of the current
> Foxit instance might not be the same as that of Emacs. So Foxit
> requires the absolute path to be able to open the file.

[ ... ]

> During this, I found out that `TeX-master-file` will not return
> absolute paths, even if the `nondirectory` argument is nil.

I have an impression that many part of of AUCTeX expects master file
name to be without directory part.  So I don't think that it is a good
idea to change `TeX-master-file' to return absolute path every time its
third argument is nil.

>> Sorry, I don't quite understand what you write here:
>> (1) The line 2332 in tex.el of the current git master branch is just
>> (defun TeX-master-file (&optional extension nondirectory ask)
>> .

> This might be a version difference, I'll paste the modified code here
> for convenience:
> -----
>   (let ((my-name (if (buffer-file-name)
>                    (TeX-strip-extension nil (list
> TeX-default-extension) nondirectory)
>                  "<none>")))
> -----
> The existing code left out the `nondirectory` argument, causing
> `TeX-strip-extension` to return a relative filename again.

Thanks, I see.

>> (2) Presuming that your NONDIR actually means NONDIRECTORY of
>> `TeX-master-file', that must be non-nil in order to make difference in
>> the behavior of `TeX-master-file' if NONDIRECTORY is forwarded to
>> `TeX-strip-extension'.  So the case that NONDIRECTORY is nil is not
>> relevant.

> The original line is this:
> -----
> (let ((my-name (if (buffer-file-name)
>                    (TeX-strip-extension nil (list TeX-default-extension) t)
>                  "<none>")))
> -----
> which means that `my-name` is always the non-directory name, which is
> not what the documentation of TeX-master-file states.

IMHO, the sentence "If optional second argument NONDIRECTORY is non-nil,
do not include the directory." in the doc string of `TeX-master-file'
does not gurantee that it returns absolute path if NONDIRECTORY is nil.
It just states the case when NONDIRECTORY is non-nil, and nothing when
NONDIRECTORY is nil.  I think `TeX-master-file' is designed so that
(TeX-master-file) returns "main" in the buffer of main.tex and
"../master" in the buffer of sub.tex with local variable specification
%%% TeX-master: "../master"
.

Regards,
Ikumi Keita





reply via email to

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