[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vile] Vile saves twice
From: |
Thomas Dickey |
Subject: |
Re: [vile] Vile saves twice |
Date: |
Tue, 10 Mar 2009 09:53:59 -0400 (EDT) |
On Tue, 10 Mar 2009, Paul van Tilburg wrote:
Excellent. I overlook ~force. Another question. I now have the
following macro:
; Special variant of find-next-error that uses a specific .err file
; as error buffer.
store-procedure find-next-error-from-err-file "move to the next \"error\" in the
error file"
~local %cbufname
~local %errfile
setv %errfile &cat &path "root" $cfilname ".err"
setv %cbufname $cbufname
kill-buffer %errfile
~quiet edit-file %errfile
error-buffer %errfile
buffer %cbufname
~force find-next-error
~if ¬ $status
write-message &cat &cat "[No (more) errors in " %errfile " buffer]"
~endif
~endm
bind-key find-next-error-from-err-file ^X-l
So, in a common situation I edit paper.tex and save it, it will be
compiled asynchronously and if there are errors they are put in
paper.err. Using ^X-l I can jump to an error, fix it and save again to
trigger a new compile. However, since paper.err can be changed
asynchronously, I have to do a kill-buffer and edit-file of %errfile to
make it reload every time I run the macro, because a plain edit-file
doesn't seem to reload. The result is that
find-next-error-from-err-file will only jump to the first error in
%errfile, even if it doesn't change between calls. How can I make it
reload the file only if it has changed?
I think we need a new builtin-function to provide the information whether
the file has changed. vile does know that it's changed, but it's not
visible to the scripting. (This isn't a big change to implement...)
Given that, I'd say to reload the file as needed, but to try to make the
macro a little smarter by then setting the same line-number as it was
before the reload. (Though that might not be the best choice, since you'd
already have fixed some errors).
Another issue: sometimes I start vile with several buffers, paper.tex,
01chapter1.tex.inc, 02chapter2.tex.inc, etc. If I'm editing
02chapter2.tex.inc, I'd still like ^X-l to examine paper.err, not
attempt to use 02chapter2.tex.err which will not be generated. Now, to
make it even remotely possible to get this working, I can agree to
always have the main file, in this case paper.tex, as the first file
on the commond line, but I am not sure how I can fix %errfile for this
session. Any ideas/suggestions?
Some - to make vile see the first file on the command-line as the "first"
buffer", you'd turn autobuffer off. (You could in principle do this in
the macro, though I'm not sure if it would be a nice behavior to make it
restore the autobuffer setting on exit from the macro...). Then the
macro could use "for-buffers" to call a macro that checks for the
existence of the ".err" file, e.g,. something like
{unset %errfile}
for-buffers {macro to test if %errfile is unset, or if file exists, set
%errfile}
{test if %errfile is set}
error-buffer %errfile
If I can solve the above two issues, this would lead to the perfect
(La)TeX editing setup for me. I hope I can attain it. :)
Kind regards,
Paul
--
PhD Student @ Eindhoven | email: address@hidden
University of Technology, The Netherlands | JID: address@hidden
Using the Power of Debian GNU/Linux <<< | GnuPG key ID: 0x50064181
_______________________________________________
vile mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/vile
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net