[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-texinfo] texi2dvi: AUC-TeX and depots
From: |
Akim Demaille |
Subject: |
Re: [help-texinfo] texi2dvi: AUC-TeX and depots |
Date: |
Thu, 22 Sep 2005 14:28:47 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
>>> "Karl" == Karl Berry <address@hidden> writes:
> (I pass on further debate about "repository", "depot", etc. :)
> I have one suggestion we might agree upon: --build-dir.
> Works for me. Thanks :).
Here's the patch.
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.61
diff -u -u -r1.61 texi2dvi
--- util/texi2dvi 20 Sep 2005 09:58:50 -0000 1.61
+++ util/texi2dvi 22 Sep 2005 12:28:23 -0000
@@ -1,6 +1,6 @@
#! /bin/sh
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources.
-# $Id: texi2dvi,v 1.61 2005/09/20 09:58:50 kasal Exp $
+# $Id: texi2dvi,v 1.60 2005/09/05 13:46:15 karl Exp $
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
# 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
@@ -32,7 +32,7 @@
unset RUNNING_KSH
# This string is expanded by rcs automatically when this file is checked out.
-rcs_revision='$Revision: 1.61 $'
+rcs_revision='$Revision: 1.60 $'
rcs_version=`set - $rcs_revision; echo $2`
program=`echo $0 | sed -e 's!.*/!!'`
version="texi2dvi (GNU Texinfo 4.8) $rcs_version
@@ -45,6 +45,7 @@
"
build_mode=${TEXI2DVI_BUILD_MODE:-local}
+build_dir=${TEXI2DVI_BUILD_DIRECTORY:-.}
usage="Usage: $program [OPTION]... FILE...
@@ -54,6 +55,11 @@
is used to determine its language ((La)TeX or Texinfo). To process
(e)plain TeX files, set the environment variable LATEX=tex.
+In order to make texi2dvi a drop-in replacement of TeX/LaTeX in AUC-TeX,
+the FILE may also be composed of the following simple TeX commands.
+ \`\\input{FILE}' the actual file to compile
+ \`\\nonstopmode\ same as --batch
+
Makeinfo is used to perform Texinfo macro expansion before running TeX
when needed.
@@ -79,23 +85,31 @@
or --texinfo=CMD multiple values accumulate
Build modes:
- --build=MODE specify the treatment of auxiliary files [$build_mode]
- --tidy same as --build=tidy
- -c, --clean same as --build=clean
+ --build=MODE specify the treatment of auxiliary files [$build_mode]
+ --tidy same as --build=tidy
+ -c, --clean same as --build=clean
+ --build-dir=DIR specify where the tidy compilation is performed.
+ implies --tidy
+ defaults to TEXI2DVI_BUILD_DIRECTORY [$build_dir]
The MODE specifies where the TeX compilation takes place, and, as a
consequence, how auxiliary files are treated. The build mode
can also be set using the environment variable TEXI2DVI_BUILD_MODE.
Valid MODEs are:
- \`local' compile in the current directory, leaving all the auxiliary
- files around.
- \`tidy' compile in a local *.t2d directory, where the auxiliary files
- are left. Output files are copied back to the original file.
- \`clean' same as \`tidy', but remove the auxiliary directory afterwards.
- Every compilation therefore requires the full cycle.
+ \`local' compile in the current directory, leaving all the auxiliary
+ files around. This is the traditional TeX use.
+ \`tidy' compile in a local *.t2d directory, where the auxiliary files
+ are left. Output files are copied back to the original file.
+ \`clean' same as \`tidy', but remove the auxiliary directory afterwards.
+ Every compilation therefore requires the full cycle.
Using the \`tidy' mode brings several advantages:
+ - the current directory is not cluttered with plethora of temporary files.
+ - clutter can be even reduced using --build-dir=dir: all the *.t2d
+ directories are stored there.
+ - clutter can be reduced to zero using --build-dir=/tmp/\$USER.t2d or
+ --build-dir=$HOME/.t2d.
- the output file is updated after every succesful TeX run, for
sake of concurrent visualization of the output. In a \`local' build
the viewer stops during the whole TeX run.
@@ -121,6 +135,7 @@
# Initialize variables for option overriding and otherwise.
# Don't use `unset' since old bourne shells don't have this command.
# Instead, assign them an empty value.
+line_error=true # Pass --file-line-error to TeX.
batch=false # true for batch mode
debug=false
escape="\\"
@@ -346,6 +361,9 @@
false:) _dest=;;
*:*) _dest=$_out_noext.$_file_ext;;
esac
+ if test ! -f "$1"; then
+ fatal 1 "no such file or directory: $1"
+ fi
if test -n "$_dest"; then
verbose "Copying $1 to $_dest"
cp -p "$1" "$_dest"
@@ -386,7 +404,7 @@
ensure_dir "$tex_help_dir"
tex_help=`cd "$tex_help_dir" >&6 && $tex --help </dev/null 2>&1`
fi
- case $tex_help in
+ $line_error && case $tex_help in
*file-line-error*) cmd="$cmd --file-line-error";;
esac
@@ -707,6 +725,7 @@
# Silently and without documentation accept -b and --b[atch] as synonyms.
-b | --b*) batch=true;;
-c | --c*) build_mode=clean;;
+ --build-dir) shift; build_dir=$1; build_mode=tidy;;
-D | --d*) debug=true;;
-e | -E | --e*) expand=t;;
-h | --h*) echo "$usage"; exit 0;;
@@ -749,8 +768,8 @@
# Pop the token
shift
-# clean: remove the t2d directory afterward.
-# tidy: compile in this t2d directory.
+# $tidy: compile in a t2d directory.
+# $clean: remove the t2d directory afterward.
case $build_mode in
local) clean=true; tidy=false;;
tidy) clean=false; tidy=true;;
@@ -851,21 +870,36 @@
echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >&6 \
|| command_line_filename="./$command_line_filename"
+ # See if we are run from within AUC-Tex, in which case we are
+ # passed `\input{FOO.tex}' or even `\nonstopmode\input{FOO.tex}'.
+ case $command_line_filename in
+ *\\nonstopmode*)
+ batch=true;;
+ esac
+ case $command_line_filename in
+ *\\input{*}*)
+ # Let AUC-TeX error parser deal with line numbers.
+ line_error=false
+ command_line_filename=`\
+ expr X"$command_line_filename" : X'.*input{\([^}]*\)}'`
+ ;;
+ esac
+
# See if the file exists. If it doesn't we're in trouble since, even
# though the user may be able to reenter a valid filename at the tex
# prompt (assuming they're attending the terminal), this script won't
# be able to find the right xref files and so forth.
+ pwd
if test ! -r "$command_line_filename"; then
- report "Could not read $command_line_filename, skipping."
+ report "cannot read $command_line_filename, skipping."
continue
fi
# Get the name of the current directory.
filename_dir=`func_dirname "$command_line_filename"`
+ filename_dir_abs=`cd "$filename_dir" >&6 && pwd`
# In a clean build, we `cd', so get an absolute file name.
- case $tidy in
- true) filename_dir=`cd "$filename_dir" >&6 && pwd` ;;
- esac
+ $tidy && filename_dir=$filename_dir_abs
# Strip directory part but leave extension.
filename_ext=`basename "$command_line_filename"`
@@ -879,12 +913,18 @@
# An auxiliary directory used for all the auxiliary tasks involved
# in compiling this document.
- t2ddir=$filename_noext.t2d
+ case $build_dir in
+ '' | . ) t2ddir=$filename_noext.t2d ;;
+ *) # Avoid collisions between multiple occurrences of the same
+ # file.
+ t2ddir=$build_dir/`echo "$filename_dir_abs/" | sed 's,/,!,g'`
+ t2ddir=$t2ddir$filename_noext.t2d;;
+ esac
# Remove it at exit if clean mode.
$clean &&
trap "cd / && rm -rf $t2ddir" 0 1 2 15
- ensure_dir "$t2ddir"
+ ensure_dir "$build_dir" "$t2ddir"
# We will change directory, better work with an absolute path...
t2ddir=`cd "$t2ddir" && pwd`
- [help-texinfo] texi2dvi: AUC-TeX and depots, Akim Demaille, 2005/09/19
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Karl Berry, 2005/09/19
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Akim Demaille, 2005/09/20
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Karl Berry, 2005/09/20
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Akim Demaille, 2005/09/21
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Karl Berry, 2005/09/21
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots,
Akim Demaille <=
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Karl Berry, 2005/09/22
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Akim Demaille, 2005/09/26
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Karl Berry, 2005/09/26
- Re: [help-texinfo] texi2dvi: AUC-TeX and depots, Akim Demaille, 2005/09/29
- Re: [help-texinfo] texi2dvi: AUC-TeX and depot, Karl Berry, 2005/09/29
- Re: [help-texinfo] texi2dvi: AUC-TeX and depot, Akim Demaille, 2005/09/30
- Re: [help-texinfo] texi2dvi: AUC-TeX and depot, Karl Berry, 2005/09/30
- [help-texinfo] Re: texi2dvi: AUC-TeX and depots, Reiner Steib, 2005/09/21
- [help-texinfo] Re: texi2dvi: AUC-TeX and depots, Akim Demaille, 2005/09/21
- [help-texinfo] Re: [Bug-AUCTeX] Re: texi2dvi: AUC-TeX and depots, Ralf Angeli, 2005/09/21