[Top][All Lists]

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

Re: [AUCTeX-devel] How to check whether makeindex should be rerun?

From: Mosè Giordano
Subject: Re: [AUCTeX-devel] How to check whether makeindex should be rerun?
Date: Mon, 7 Sep 2015 12:58:54 +0200

Hi all,

finally here is my patch to suggest to run makeindex when needed.  In
a complex document with index and bibliography AUCTeX now suggests to


which is the same list suggested by Enrico Gregorio here:
Well, there is and extra LaTeX run at the end, but there is a warning
suggesting to run LaTeX once more.  For the record, latexmk for the
same document runs


Now, implementation of my patch:  there are two variables,
`TeX-idx-md5-alist' and `TeX-idx-changed-alist' (probably `LaTeX-*'
would be better names), which record the md5 hashes of idx files and
whether they changed after a LaTeX run.  md5 hash is calculated in
`TeX-run-TeX', and then checked again in `TeX-LaTeX-sentinel': if md5
hash changed, `TeX-idx-changed-alist' for current idx file is set to
t.  At this point, if `TeX-command-next' is one between "Dvips" and
`TeX-command-Show', then `TeX-command-default' suggest to run "Index",
because makeindex should be run when the document is almost complete,
not after the fist latex run as latexmk does.

A note about the fact I used alists instead of local variables for
`TeX-idx-md5-alist' and `TeX-idx-changed-alist'.  I first thought to
set local variables in idx files, but we need to open those files and
hope the user won't kill them.  Another possibility would be to set
those variables locally in output buffer since `TeX-command-default'
already requires that buffer to be still alive, but it seems local
variables are killed there before running a command.  My last choice
has been to use a global alist.  Does someone have better idea about
how to store md5 hash and the information about status of idx file?

Any other comment welcome.


2015-09-01 7:50 GMT+02:00 Tassilo Horn <address@hidden>:
> Mosè Giordano <address@hidden> writes:
> Hi Mosè,
>> differently from what it's said in section of the manual,
>> AUCTeX never suggests to run makeindex when needed.  Does someone know
>> how can we check whether we need to run makeindex?  The .idx file is
>> rewritten after every latex run, so it's useless to look to its
>> modification time, and no warning is emitted by the compiler.
>> A possibility is to store the md5 hash of the .idx file and check
>> whehter it's changed after running latex.  md5 is pretty fast compared
>> to other algorithms and I don't think this feature is security-wise.
>> If I recall correctly, latexmk does the same check.
> `md5' sounds reasonable for this purpose, and it's available in all
> emacsen we support.
> Bye,
> Tassilo
> _______________________________________________
> auctex-devel mailing list
> address@hidden

Attachment: suggest-index.patch
Description: Text Data

reply via email to

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