auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] New viewer selection backend


From: Ralf Angeli
Subject: [AUCTeX-devel] New viewer selection backend
Date: Sun, 04 Oct 2009 14:52:22 +0200

Hi,

today I checked in a new backend for the selection of viewers and the
construction of their command lines.  This is supposed to remedy for at
least two problems.

First, until now it was quite tedious to switch to another viewer.
Especially when xdvi was to be replaced by another DVI viewer in
`TeX-output-view-style' one had to change or get rid of a lot of
entries.  For the new backend there is now a sort of viewer database
provided by the variable `TeX-view-program-list-builtin'.  If you want
to switch to a different viewer, you simply select one of those (via
`TeX-view-program-selection') and don't have to worry about the
viewer-specific capabilities because those are being taken care of in
the viewer database.  For example in case of xdvi all the options for
the paper size and source specials are handled there.

This brings me to the second problem to be tackled by the new backend.
For SyncTeX and pdfsync we've used the %(outpage) expander together with
xpdf until now.  When the expander was introduced first, it returned ""
when none of those were active.  Since you cannot use such a return
value with a viewer like Evince which expects the page number as a
parameter of the -p command line option, %(outpage) was changed to
return "1" when no synchronization mechanism was enabled.  However, this
defeats the feature of Evince opening documents at the position they
were closed before.  Now, with the new backend you can tie a whole
command line part (option plus value) to a predicate.  Only if the
predicate is satisfied, the part will be added to the command line.  The
predicates are currently Lisp expressions (not functions) associated
with a symbol.  There are predefined predicates you can choose from in
`TeX-view-predicate-list-builtin'.  I used this approach instead of
using expressions or functions to be used directly in order to enable
users not familiar with Lisp programming to configure a viewer command
line by choosing from a set of predefined descriptive options.  Users
who are more familiar with Lisp hacking can override the predicates or
define new ones how they see fit.  A disadvantage is that stuff like
`or' and `and' are not supported, so the predicates have to be mutually
exclusive.  See the predicates for the paper options for an example of
where this makes things a bit more complicated.

The new backend is currently enabled by default.  The old one is still
available, though.  Simply switch from the %V expander to %vv for the
View command in `TeX-command-list'.

Also, all expanders still work.  The new backend returns an unexpanded
string which will be processed by the expansion facilities afterwards.

I'd be interested in hearing how you guys like this new scheme and how
it could be improved even further.  If you check the cvs diff of the
check-in you should see a few FIXME notes which might be worth
discussing, especially the possibility to allow regular functions to be
used as predicates but also as return values for viewers.

I'd also like to hear how you like the way a viewer command line is
specified, i.e. by defining the parts in a list like ("xdvi" (pre
"-paper a4") "file.tex")) or if you'd prefer a scheme with expanders
where you write the whole string beforehand and specify where in this
string stuff should be expanded, like ("xdvi %a file.tex" ("%a" pre
"-paper a4")).  Personally I think the latter one would be harder to
configure and harder to implement.

Note that this stuff has been the biggest road block for me on the way
to a new release.  (XeTeX support for preview.sty might be one as well.)
So once we have a good implementation of this I can document it and
prepare for the release.

-- 
Ralf




reply via email to

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