screen-update - Force screen update
n screen-update (redraw)
screen-update updates the current screen, usually used in macros. The argument n can be used to change the behaviour of this command as follows:
negative n
0
1
2
3
The following macro demonstrates the problems encountered when trying to use screen variables in macros after the current position has changed. The first value printed is the starting cursor Y position and the next value should be one less than the first value due to the call to backward-line(2). But it is the same as the first because the screen (and its variables) have not been updated. The subsequent call to screen-update ensures that the third value is the correct one although by giving it an argument of 3 the screen is not visibly updated thus avoiding any annoying screen flicker:
define-macro test-screen-update set-variable #l0 $cursor-y backward-line set-variable #l1 $cursor-y 3 screen-update set-variable #l2 $cursor-y forward-line ml-write &spr "%d %d %d" #l0 #l1 #l2 !emacro
Every time the screen requires updating, MicroEmacs executes the redraw key, it is similar in mechanism to the user pressing C-l to refresh the screen. The user can therefore re-bind the redraw key to another command or macro, thereby allowing the user complete control of what is displayed. For example if redraw was bound to void(2) the screen would not be up-dated (Note: this is difficult to get out of and may require MicroEmacs to be killed).
This feature is often exploited by macros which take control of the input and output, such macros include gdiff(3), Metris(3), and Mahjongg(3).
Copyright (c) 1998-2006 JASSPA
Last Modified: 2006/07/28
Generated On: 2006/10/07