You can have the errors reported by piping the output from the call to
pdflatexinto some command line tool. Exactly what tool to use is less clear. The natural choice for SubEthaEdit would be the
seecommand line too, but it's not very convenient, and has some real problems. Beyond that, calling out to
seerepeatedly will produce a new window each time, which is just annoying.
The Python mode has a nicer behavior. It has a Check Syntax command that always writes to a window named Python Check Syntax, opening it if need be or overwriting the contents otherwise. The Lua mode has an analogous Check Syntax command with similar behavior.
Let's make a shell script that does something similar. First, I encapsulate the relevant bits of AppleScript from the Python and Lua modes into some simple handlers. Second, I embed those into a shell script using the approach recently discussed here. The resulting script I call
seeless, as it is usable as something like the
lesspager. I'll defer the text of the script until the end, first describing the usage.
Basic usage is just to pipe in some text:
echo Hello World! | seeless
This writes the text Hello World into a SubEthaEdit window titled seeless message, opening a new window if necessary or replacing the text in an existing window. Multiple windows with the same title are a bit problematic, with no guarantee that the window you want will be the one written to. Don't do that.
The title of the window can be specified:
echo Hello World! | seeless -t"A message for you, direct from the shell"
Appropriate choice of title allows a SubEthaEdit mode to establish its own reporting window.
The window is normally brought to the front when it is written to. Call
echo Hello World! | seeless -b
to leave the window in the background. This allows, e.g., a reporting window to be kept out of the way as a tab and only checked when something seems to be wrong.
There are two different modes, insert and append, for writing to the window. For insert mode, the window is cleared before writing the text from
stdin, while append mode just appends to any existing text. To set append more, use:
echo Hello World! | seeless -a
Insert mode is the default, but a flag exists for it, too:
echo Hello World! | seeless -i
Multiple flags for the insert and append mode can be given, with the final one determining the behavior.
In append mode, the text from a second call to
seelessfollows immediately after the text from the first. To give some visual space, specify a separator:
echo Hello World! | seeless -s"----------"
When a separator is given with the
-sflag, append mode is automatically set. It is also possible to use a separator in insert mode, giving a form of header. For example,
echo Hello World! | seeless -s"$(date)" -i
shows the time when
seelesswas called. Another possibility would be to have a cluster of related programs writing to the same window, and using the separator to specify the program that wrote the latest text.
Let's take a look at how I put those options into use with the LaTeX mode. I set
SEE_LATEX_COMPILERto: Note that I have redirected the output of each call to
/dev/nulland made the calls asynchronous with
&—SubEthaEdit hangs without doing this, requiring a force quit.
With the above settings, the LaTeX mode will cause SubEthaEdit to open up a report window titled LaTeX Messages whenever a document is typeset,
bibtexis run, or the auxiliary files are cleaned up. I can put it out of the way, either as a tab or background document; because I've used the
-bflag for each call, the report window will stay out of the way until I want it brought to the front. I've used a separator to show which feature was most recently used and at what time it was called. I've set insert mode with an
-iflag, so I only see the latest call; by eliminating this flag, I'd have a chronological record of all the calls made (in the current editing session, anyway).
I haven't been using this very long, so there may be some bugs. However, it seems quite solid, and is definitely useful already. Download it here.
As promised above, I'll give the text of the script here, too. I've formatted the script as a shell script, to better show how the shell variables are used to adapt the behavior of the embedded AppleScript.