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

Bug#470380: feature request: --viewer=CMD option to texi2dvi



Package: texinfo
Version: 4.11.dfsg.1-4
Severity: wishlist
Tags: patch

Some DVI/PDF viewers (*cough* evince) are too stupid to redisplay the
document when the file changes, but will redisplay the document in the
same window if re-invoked with the same file name.  It would be nice,
therefore, if texi2dvi had a mode in which it automatically ran a viewer
at the end of every recompilation of a given document.

The attached patch implements just such an option, spelt --viewer=CMD.
(It may need a certain amount of polish; for instance, --viewer= with
no argument does nothing useful and does not give an error.  I'm not
comfortable enough with the coding style to do things like that.)

zw

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages texinfo depends on:
ii  libc6                         2.7-9      GNU C Library: Shared libraries

texinfo recommends no packages.

-- no debconf information
--- texi2dvi	2008-02-20 02:27:19.000000000 -0500
+++ texi2dvi	2008-03-10 16:10:06.000000000 -0400
@@ -99,6 +99,8 @@
   -t, --command=CMD          insert CMD in copy of input file
    or --texinfo=CMD          multiple values accumulate
       --translate-file=FILE  use given charset translation file for TeX
+      --viewer=CMD           invoke CMD on the rendered DVI or PDF file
+                             after processing is complete
 
 Build modes:
   --build=MODE         specify the treatment of auxiliary files [$build_mode]
@@ -172,6 +174,7 @@
 verb=false      # true for verbose mode
 translate_file= # name of charset translation file
 recode_from=    # if not empty, recode from this encoding to @documentencoding
+viewer=         # if not empty, run on rendered file after processing completes
 
 orig_pwd=`pwd`
 
@@ -1416,6 +1419,7 @@
     --tidy) build_mode=tidy;;
     -v | --vers*) echo "$version"; exit 0;;
     -V | --verb*) verb=true;;
+    --viewer ) shift; viewer="$1";;
     --) # What remains are not options.
       shift
       while test x"$1" != x"$arg_sep"; do
@@ -1654,6 +1658,9 @@
       # Compile the document.
       compile
       cleanup
+      if [ -n "$viewer" ]; then
+	($viewer $out_name < /dev/null &)  # background it and forget it
+      fi
       ;;
 
     mostly-clean)

Reply to: