Some of Debian's patches might be worth including into teTeX

[email protected] (Frank Küster) Tue, 23 Nov 2004 17:18:46 +0100
Newsgroups gmane.comp.tex.tetex.beta
Message-ID <[email protected]>
Dear Thomas, dear all,

while I was working on the creation of Debian packages of the current
beta, I found some patches that we apply to 2.0.2 and would also use for
3.0, which might be interesting for you.

The first is for viewing compressed files with texdoc (in Debian, all
files below /usr/share/doc that are larger than a certain limit are
compressed). In an older form, against the 2.0.2 texdoc, it has been
tested for years. The new variant (against current texdoc, handing
dvi.gz directly to xdvi without uncompressing, and going into the
background even for compressed files) is not yet tested much:


The following texmf.cnf snippet goes with it: 

,----
| % the default extensions for documentation
| TEXDOCSSUFFIX = .pdf:.dvi:.ps:.txt
| % we allow some compression methods
| TEXDOCSCOMPRESS = :.gz:.bz2
| % put html at the very end, to avoid showing the Catalogue:
| TEXDOCHTML = .html
| % and put that all now together
| TEXDOCEXT = {$TEXDOCSSUFFIX}{$TEXDOCSCOMPRESS}:{$TEXDOCHTML}{$TEXDOCSCOMPRESS}
`----

(by the way, Debian uses a mailcap mechanism similar to Darwin's "open")


The other one is a small addition to mktexpk - I have no idea why this
was introduced and who tested or uses it:

--- texk/kpathsea/mktexpk.orig	Thu Nov 18 22:16:12 2004
+++ texk/kpathsea/mktexpk	Thu Nov 18 22:16:12 2004
@@ -116,8 +116,10 @@
      100) MODE=nextscrn;;
      180) MODE=toshiba;;
      300) MODE=cx;;
+     360) MODE=epstylus;;
      400) MODE=nexthi;;
      600) MODE=ljfour;;
+     720) MODE=epscszz;;
     1270) MODE=linoone;;
     8000) MODE=dpdfezzz;;
        *) echo "$progname: Can't guess mode for $BDPI dpi devices." >&2

Regards, Frank

-- 
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer
patch-texdoc (text/x-patch, 3.6 KB)
--- texk/tetex/texdoc.orig	Tue Nov 23 16:56:45 2004
+++ texk/tetex/texdoc	Tue Nov 23 16:56:45 2004
@@ -14,6 +14,16 @@
 #
 # Changes for web2c-7.2 resp. teTeX-0.9 and portability fixes by
 # Thomas Esser <[email protected]>, Jun 14 1998
+#
+# Debian specific changes:
+#    Denis Barbier <[email protected]>, Feb 15 2000
+#  * accept gzipped files on input
+#  * temporary directory set according to TMPDIR
+#    
+#    Frank Küster <[email protected]>, 2004-11-23
+#  * do not uncompress dvi.gz, xdvi can handle this
+#  * go to background with uncompressed files
+
 
 test -f /bin/sh5 && test -z "$RUNNING_SH5" \
   && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
@@ -40,15 +50,25 @@
 	;;
   *)
 	: ${TEXDOCVIEW_dvi='xdvi %s &'}
-	: ${TEXDOCVIEW_pdf='acroread %s &'}
-	: ${TEXDOCVIEW_ps='(gv %s || ghostview %s) &'}
-	: ${TEXDOCVIEW_html='mozilla -remote openURL'"'(%s)'"' 2>/dev/null || mozilla %s &'}
+	: ${TEXDOCVIEW_pdf='(see %s ) &'}
+	: ${TEXDOCVIEW_ps='(see %s ) &'}
+	: ${TEXDOCVIEW_html='(see %s ) &'}
 	: ${TEXDOCVIEW_txt="${PAGER-more} %s"}
 	: ${TEXDOCVIEW_="${PAGER-more} %s"} # no extension, default to pager
         extlist='.dvi .pdf .ps .txt .html'
+
+        # Commands run to uncompress files, according to filename extension.
+	: ${TEXDOCUNZIP_gz='gzip -d -c'}
+	: ${TEXDOCUNZIP_bz2='bzip2 -d -c'}
+	: ${TEXDOCUNZIP_zip='unzip -p'}
+ 
 	;;
 esac
 
+extlist=`kpsewhich --expand-brace='$TEXDOCEXT'`
+test -z "$extlist" && \
+extlist='.dvi.gz:.pdf.gz:.ps.gz:.txt.gz:.dvi:.pdf:.ps:.txt:.html:'
+
 mode=viewer
 help='Usage: texdoc [OPTION]... [NAME]...
   Search for NAME in the TeX documentation and start a viewer.
@@ -80,6 +100,19 @@
     ;;
 esac
 
+tmpdir=`mktemp -d -t texdoc.XXXXXXXX`
+trap 'rc=$?; rm -rf $tmpdir; exit $rc' 1 2 6 13 15
+
+clean_tmp ()
+{
+  # is the temporary directory empty? If not, texdoc was called with 
+  # two or more arguments, and one viewer is still running
+  if test "`echo $tmpdir/*`" = $tmpdir/'*'
+  then
+    rm -rf $tmpdir
+  fi
+}
+
 for name
 do
   case $mode in
@@ -96,8 +129,9 @@
   esac
 
   found=false
+  OIFS=$IFS
+  IFS=':'
   for ext in "" $extlist; do
-
     filename=`kpsewhich -format='TeX system documentation' $name$ext 2>/dev/null`
     test -z "$filename" && continue
     found=true
@@ -105,16 +139,29 @@
     if test $mode = list; then
       echo $filename
     else
+      dir=`echo $filename | sed 's%/[^/]*$%%'`
       ext=`echo $filename | sed -n 's%.*\.\([^/]*\)$%\1%p'`
+      eval uncompress="\$TEXDOCUNZIP_$ext"
+      if test -n "$uncompress"
+      then
+        ext=`echo $filename | sed -e "s|\\.$ext\$||" | sed 's%.*\.%%'`
+      fi
       viewer=\$"TEXDOCVIEW_$ext"
-      viewer=`eval echo $viewer | sed -e "s|%s|$filename|g"`
+      if [ -n "$uncompress" ] && [ "$ext" != "dvi" ]; then
+	# (xdvi is able to read gzipped files)
+        src=`echo "$filename" | sed -e 's%.*/%%' -e 's%\.[^.]*$%%'`
+        eval "$uncompress $filename > $tmpdir/$src"
+        filename=$tmpdir/$src
+	viewer=`eval echo $viewer | sed -e "s|%s|$filename; rm -f $filename; clean_tmp|"`
+      else
+	viewer=`eval echo $viewer | sed -e "s|%s|$filename|g"`
+      fi
       if test -z "$viewer"
       then 
         echo "Don't know how to view file type $ext" 1>&2
         echo "(matching file was $filename)" 1>&2
       else 
         $verbosemode && echo $viewer
-        dir=`echo "$filename" | sed 's%/[^/]*$%%'`
         test -n "$dir" && test -d "$dir" && cd "$dir"
         eval $viewer
         break     # just stop after the first usable extension
@@ -123,5 +170,8 @@
 
   done
   $found || echo "Can't find documentation for \`$name'" 1>&2
+  IFS=$OIFS
 done
+clean_tmp
+
 exit 0