[OS X TeX] Flashmode for Emacs : Whizzytex + Enrico Franconi's Carbon Enhanced Emacs + TeXniscope

Joachim Kock jkock at ya.com
Sat Apr 9 23:13:54 EDT 2005

> > (Two empty lines?  Usually tex needs only one empty line to delimit a
> > paragraph.)

> You misunderstand.  The word "paragraph" here has a special meaning : it
> does not refer to the layout of the compiled document, but instead it
> refers to a 'slicing mode' - one of several ways in which whizzytex
> 'slices' the source tex-file .
> One other option is 'paragraph' : one 'paragraph' ( in the emacs buffer)
> ends and a new 'paragraph' begins where there are two empty lines in the
> emacs buffer.  I changed the default of 2 empty lines to 4 empty lines (
> see instructions).  This makes it easier to separate 'paragraphs'.

I think I did understand that much.  What I don't understand is why two
lines are needed to separate paragraphs.  For example in a typical tex
document there might not be any double-blank lines at all, so whizzytex
would compile the whole document even in paragraph-slice mode.  Right?

> > An important principle of the flash script in Alpha is that no alterations
> > are required in the tex documents, and that the script never writes to your
> > tex document or saves it for you or anything.  In this way the document
> > remains *yours* and you have complete control over it.
> Well, you only have to add one line at the beginning - not a big deal, is it ? 
> You can add it to your template.  And, of course, you still have "control" 
> over your tex-file !

Not a big deal, neither to add extra tags at ths beginning, nor to insert
extra blank lines throughout the document.  But the *principle* should be
that you should not have to change *anything* in your tex source in order
to use a flash mode.

> > This looks like a strange shortcoming.  Does it mean that if you suddenly
> > decide to use flash for some minutes you have to restart emacs from the
> > xterm?!
> No.
> When using whizzytex with TeXniscope, of course you don't need X11( for what ?!)

At this point we are talking X11, not TeXniscope.  Reading your answer I
conclude that if you started emacs by double clicking on it (as I guess
would be the standard way in OSX), and then decide to turn on whizzytex
for a document, then you have to quit emacs and restart it from xterm.

> frequently, when running applications that require X11, special
> care has to be taken.  For example, an obvious problem might be that the
> DISPLAY variable is not set correctly.

When I say it's a strange shortcoming I mean that this DISPLAY problem
should be something the programme could solve itself, instead of requiring
the user to change his habits.  Technically, one solution is to look among 
the open sockets.  Here is how it is done in Alpha:

proc determineX11Display {} {
    # The open displays are sockets listed in /tmp/.X11-unix/
    # of names Xn for some nonegative integer n.  Pick the
    # first one owned by the current user.
    foreach socket [glob -nocomplain /tmp/.X11-unix/X*] {
	if { [file owned $socket] &&
	   [regsub {/tmp/\.X11-unix/X} $socket ":" display] } {
	    return $display

You could have whizzytex perform such a check whenever it is activated.
(I think you can easily read this little proc (Tcl is easy to read, 
isn't it?) and write the analogue in lisp.)

> But even with previewers requiring X11 you only have to open emacs once, at
> the beginning of your emacs session.  Then you may activate, stop and
> reactivate whizzytex as many times as you want.  You don't have to "restart
> emacs" each time.

Understood.  Once you have been through the xterm trick once, the DISPLAY
variable is correctly set.  So the remaining issue is whether 'once' is
a reasonable value...

> Still, if you could make your flashmode work together with Enrico Francon's
> Carbon Enhanced Emacs , that would be fantastic.  I am not quite sure,
> though - does it work with pdftex ?

Yes, it works with pdftex and TeXniscope as viewer, but it's another
script (mostly identical, but with a few internal differences due exactly
to the different nature of TeXniscope from xdvi.  The TeXniscope variant
was mentionned on the list on January 11th.  (Obviously, in the long run,
the two scripts should be merged into a single one, splitting cases with
the help of an internal variable when needed.)

There is not much hope of getting this particular script to work in emacs,
unless emacs embeds a Tcl interpreter (which is not impossible, I guess --
nothing is impossible in emacs), or by rewriting the script in lisp.  But
it is really crucial for both simplicity and speed that the script runs
internally in the editor, in order to have direct access to the state of
the buffer.

> If your flashmode could be made to work with Enrico Franconi's Carbon
> Enhanced Emacs, and if it supported pdftex, and if it was faster than
> whizzytex, I would be using it instead of whizzytex.

You should definitely stay with whizzytex, if that works well for you.

My point was just not to let your detailed description stand as the last
word concerning flashing.  Other people should not think that those
difficulties are inherent to getting a flash mechanism to work (complicated
installation involving makefiles, aliases, PATH setting; necessity of
starting the editor in a particular way; necessity of adapting the tex
source file...)

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list