[Top][All Lists]

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

Re: [AUCTeX] Is it possible to use the buffer-file-name in a local varia

From: Tassilo Horn
Subject: Re: [AUCTeX] Is it possible to use the buffer-file-name in a local variable ?
Date: Tue, 03 Feb 2015 08:54:44 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Denis Bitouzé <address@hidden> writes:

> I'd like to use the buffer-file-name in a local variable, like this:
>   ┌────
>   │ %%% Local Variables:
>   │ %%% mode: latex
>   │ %%% TeX-master: "main"
>   │ %%% LaTeX-command: "pdflatex 
> '\includeonly{<buffer-file-name>}\input{main}'"
>   │ %%% End:                                   ^^^^^^^^^^^^^^^^^^
>   └────
> Is it possible?

Yes, I think so.  You would use a local variable section with something

  %%% eval: (setq-local LaTeX-command
  %%%                   (concat "pdflatex '\includeonly{"
  %%%                           (buffer-file-name)
  %%%                           "}\input{main}'")

But I don't think `LaTeX-command' is the right variable.  Wouldn't it
suffice to add the \includeonly to `TeX-command-extra-options'?

And as yet another alternative: As I understand, your goal is to speed
up compilation by only compiling the chapter you're currently writing
on.  In that case, there are already predefined commands to do exactly
that.  See especially

,----[ (info "(auctex)Starting a Command") ]
| -- Command: LaTeX-command-section
|      ('C-c C-z') Query the user for a command, and apply it to the
|      current section (or part, chapter, subsection, paragraph, or
|      subparagraph).  What makes the current section is determined by
|      'LaTeX-command-section-level' which can be enlarged/shrunken using
|      'LaTeX-command-section-change-level' ('C-c M-z').  The given
|      numeric prefix arg is added to the current value of
|      'LaTeX-command-section-level'.  By default,
|      'LaTeX-command-section-level' is initialized with the current
|      document's 'LaTeX-largest-level'.  The buffer contents are written
|      into the region file, after extracting the header and trailer from
|      the master file.  The command is then actually run on the region
|      file.  See 'TeX-command-region' for details.

And that doesn't even require that you split your document into one file
per chapter.


reply via email to

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