bug-zile
[Top][All Lists]
Advanced

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

Re: [Bug-zile] Fix Me: Warn when file changes on disk


From: Gary V. Vaughan
Subject: Re: [Bug-zile] Fix Me: Warn when file changes on disk
Date: Thu, 20 Mar 2014 16:15:24 +1300

[[Resend to Zile Bugs List]]

Hi Garnaik,

On Mar 20, 2014, at 8:28 AM, Garnaik Sumeet <address@hidden> wrote:
>          Do we have any function for printing alert messages on the screen or 
> just use the standard printing functions of luaposix.curses

Yes... and no.

Most terminal types have a mode called 'alternate screen', which is why when 
you start most curses apps you'll see the entire screen change over to display 
the app, and then when the app exits, the original display output is restored 
to your show your shell history undamaged by whatever screen drawing curses did.

Consequently Zmacs and Zz also switch to the alternate screen, but at least 
save any Lua error message and traceback that causes abnormal termination, for 
display on the normal screen after curses has exited.  This means, of course, 
that anything you print to the stderr and stdout by bypassing the curses 
display functions, while curses is managing the alternate screen display, will 
probably be wholly or partially removed shortly afterwards by the curses 
display update algorithms, and then lost entirely when switching out of the 
'alternate screen' mode when they exit.

Here are a couple of tricks I use to work around this when debugging:

 1. send any debug messages to stderr with `io.stderr:write ("var = " .. value 
.. "\n")` (note the final \n is required to ensure the output is flushed when 
stderr is in its default line-buffered mode) and then run Zmacs with 
`lib/zmacs/zmacs 2>log`, which saves the stderr output to a log file that 
survives screen switching.
 2. send debug messages to the '*Messages*' buffer, either using `minibuf_echo 
("var = " .. value .. "\n")`, and then split the screen into two buffers and 
visit '*Messages*' with one of them so I can watch the debug messages as they 
arrive.
 3. write a test-case for the problem I'm having (in Specl for a test that is 
worth keeping, or just x.lua for a throwaway check), and use it to run zmacs in 
batch mode (zmacs --batch --load x.lua) so that `minibuf_echo` output is 
displayed on stderr without switching to the alternate screen.

Hope that helps!

Cheers,
-- 
Gary V. Vaughan (gary AT vaughan DOT pe)

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

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