auctex-devel
[Top][All Lists]
Advanced

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

Re: TeX-master and TeX-output-master


From: Tohiko Looka
Subject: Re: TeX-master and TeX-output-master
Date: Wed, 17 Jun 2020 21:30:49 +0100

Hello again,

I was told that I should provide a rough sketch on what I am planning to do.

First let me discuss my current implementation for the custom output
directory (attached). The implementation was simplified a bit since my
previous email. The basic idea is to advise `TeX-active-master` to
return the build directory (from a custom variable `TeX-output-dir`)
whenever the extension is an output one (defined as matching one of
the outputs in `*TeX-clean-*-suffixes`). If `TeX-output-dir` is nil,
then `TeX-active-master` is called as usual. I also define a function
`TeX-master-output-file` that returns the value of `TeX-output-dir` of
the master-file (the variable's value of non-master files should be
irrelevant). In the attached script, I also added an example hook to
set the build directory and set `TeX-command-extra-options`
appropriately.

This works most of the time, except in cases where AUCTeX uses
`TeX-active-master` to get the master directory. For example,
`TeX-active-master` is called in `TeX-clean` without an extension and
then `file-name-directory` is called to extract the directory. In
these cases, the output directory should be used instead.

In order to implement this natively, I am planning to add the same
variable `TeX-output-dir` in AUCTeX. Then, I have two options:
1. Add a check at the beginning of `TeX-active-master` similar to the
one in my advice. If the extension is an output extension, return the
output directory instead of the master directory. I would also change
calls to TeX-active-master where a directory is needed so that an
extension is always passed (an output extension if the output
directory is needed like in `TeX-clean`, or a tex extension if not)
2. The second way to implement this is to simply replace the calls to
`TeX-active-master` in AUCTeX with calls to `TeX-master-output-file`
whenever the extension is an output one. Also, replace calls to
`TeX-active-master` in places where the output directory is needed
(like in TeX-clean).

There are a few issues that I am trying to figure out at the moment:
1. The latex compiler assumes that the output directory exists. I am
not sure where the best place to create it is.
2. I think creating an expansion variable (in `TeX-expand-list`) for
the output directory might be better than using
`TeX-command-extra-options`. This is for several reasons, most
importantly it seems that when I call `TeX-command` on a non-master
file, the local variable `TeX-command-extra-options` (from the
non-master file) is expanded rather than the one from the master file
as I would expect (As an aside, I propose that the value of the master
file be expanded instead).

Sorry for the long email, I appreciate any feedback. Especially on
which implementation is preferred.

-- Tohiko

Attachment: tex-output.el
Description: Text Data


reply via email to

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