help-gnu-emacs
[Top][All Lists]
Advanced

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

Follow-up: How to call tex-buffer & tex-print in an Elisp program


From: Joe Fineman
Subject: Follow-up: How to call tex-buffer & tex-print in an Elisp program
Date: Thu, 15 Feb 2007 01:32:06 GMT
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt)

Posting another complaint about tex-print reminded me that I had
neglected to follow up an earlier one (15 January 2005):

> I am using Emacs 21.3.1 under Windows XP.

> The documentation for the command tex-print says

>   Print the .dvi file made by M-x tex-region, M-x tex-buffer or M-x
>   tex-file.

> The printed TeX manual (ยง21.9.3), on the other hand, says s.v. C-c C-p

>   Print the output from the last C-c C-r, C-c C-b, or C-c C-f command
>   (tex-print).

> It appears the the first statement is misleading, and the second
> statement is literally true, that is, tex-print prints the output from
> the last such command keyed from the keyboard.  It does not not see
> the output of such commands if they are called within Elisp.  [...]

This received no reply, possibly because it contained a bad guess &
some bad temper.  But a little later, in another place, I happened on
the answer:

>   From: David Kastrup <dak@gnu.org>
>   Newsgroups: comp.emacs
>   Subject: Re: AUCTeX: More than one TeX-command in a function
>   Date: Tue, 15 Feb 2005 17:47:54 +0100

>   Niels Teglsbo <teglsbo@diku.dk> writes:

>   > What I wanted was something like TeX-command-master that would
>   > compile /and/ view in one operation, with one keypress.

>   This is not supported at the moment.  You have to be aware that all
>   AUCTeX commands (practically all) only _start_ a TeX process and
>   don't wait for its completion.  That is so that you can resume
>   editing while LaTeX is working in the background.  But that means
>   that starting sequences of commands is a rather complicated
>   procedure.  [...]

So the problem is that tex-print does not see the output of the
preceding tex-buffer, because it hasn't finished running at the time
that tex-print runs.  That is why it prints out the .dvi from job
before.  It has nothing to do with how either job was called.  The
moral is, give it time:

  (tex-buffer)
  (sleep-for 4)
  (tex-print)

I have found 4 s to be adequate.
-- 
---  Joe Fineman    joe_f@verizon.net

||:  The starting point of conversation is contradiction.  :||



reply via email to

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