comparison src/redisplay.c @ 853:2b6fa2618f76

[xemacs-hg @ 2002-05-28 08:44:22 by ben] merge my stderr-proc ws make-docfile.c: Fix places where we forget to check for EOF. code-init.el: Don't use CRLF conversion by default on process output. CMD.EXE and friends work both ways but Cygwin programs don't like the CRs. code-process.el, multicast.el, process.el: Removed. Improvements to call-process-internal: -- allows a buffer to be specified for input and stderr output -- use it on all systems -- implement C-g as documented -- clean up and comment call-process-region uses new call-process facilities; no temp file. remove duplicate funs in process.el. comment exactly how coding systems work and fix various problems. open-multicast-group now does similar coding-system frobbing to open-network-stream. dumped-lisp.el, faces.el, msw-faces.el: Fix some hidden errors due to code not being defined at the right time. xemacs.mak: Add -DSTRICT. ================================================================ ALLOW SEPARATION OF STDOUT AND STDERR IN PROCESSES ================================================================ Standard output and standard error can be processed separately in a process. Each can have its own buffer, its own mark in that buffer, and its filter function. You can specify a separate buffer for stderr in `start-process' to get things started, or use the new primitives: set-process-stderr-buffer process-stderr-buffer process-stderr-mark set-process-stderr-filter process-stderr-filter Also, process-send-region takes a 4th optional arg, a buffer. Currently always uses a pipe() under Unix to read the error output. (#### Would a PTY be better?) sysdep.h, sysproc.h, unexfreebsd.c, unexsunos4.c, nt.c, emacs.c, callproc.c, symsinit.h, sysdep.c, Makefile.in.in, process-unix.c: Delete callproc.c. Move child_setup() to process-unix.c. wait_for_termination() now only needed on a few really old systems. console-msw.h, event-Xt.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.h, process-nt.c, process-unix.c, process.c, process.h, procimpl.h: Rewrite the process methods to handle a separate channel for error input. Create Lstreams for reading in the error channel. Many process methods need change. In general the changes are fairly clear as they involve duplicating what's used for reading the normal stdout and changing for stderr -- although tedious, as such changes are required throughout the entire process code. Rewrote the code that reads process output to do two loops, one for stdout and one for stderr. gpmevent.c, tooltalk.c: set_process_filter takes an argument for stderr. ================================================================ NEW ERROR-TRAPPING MECHANISM ================================================================ Totally rewrite error trapping code to be unified and support more features. Basic function is call_trapping_problems(), which lets you specify, by means of flags, what sorts of problems you want trapped. these can include -- quit -- errors -- throws past the function -- creation of "display objects" (e.g. buffers) -- deletion of already-existing "display objects" (e.g. buffers) -- modification of already-existing buffers -- entering the debugger -- gc -- errors->warnings (ala suspended errors) etc. All other error funs rewritten in terms of this one. Various older mechanisms removed or rewritten. window.c, insdel.c, console.c, buffer.c, device.c, frame.c: When creating a display object, added call to note_object_created(), for use with trapping_problems mechanism. When deleting, call check_allowed_operation() and note_object deleted(). The trapping-problems code records the objects created since the call-trapping-problems began. Those objects can be deleted, but none others (i.e. previously existing ones). bytecode.c, cmdloop.c: internal_catch takes another arg. eval.c: Add long comments describing the "five lists" used to maintain state (backtrace, gcpro, specbind, etc.) in the Lisp engine. backtrace.h, eval.c: Implement trapping-problems mechanism, eliminate old mechanisms or redo in terms of new one. frame.c, gutter.c: Flush out the concept of "critical display section", defined by the in_display() var. Use an internal_bind() to get it reset, rather than just doing it at end, because there may be a non-local exit. event-msw.c, event-stream.c, console-msw.h, device.c, dialog-msw.c, frame.c, frame.h, intl.c, toolbar.c, menubar-msw.c, redisplay.c, alloc.c, menubar-x.c: Make use of new trapping-errors stuff and rewrite code based on old mechanisms. glyphs-widget.c, redisplay.h: Protect calling Lisp in redisplay. insdel.c: Protect hooks against deleting existing buffers. frame-msw.c: Use EQ, not EQUAL in hash tables whose keys are just numbers. Otherwise we run into stickiness in redisplay because internal_equal() can QUIT. ================================================================ SIGNAL, C-G CHANGES ================================================================ Here we change the way that C-g interacts with event reading. The idea is that a C-g occurring while we're reading a user event should be read as C-g, but elsewhere should be a QUIT. The former code did all sorts of bizarreness -- requiring that no QUIT occurs anywhere in event-reading code (impossible to enforce given the stuff called or Lisp code invoked), and having some weird system involving enqueue/dequeue of a C-g and interaction with Vquit_flag -- and it didn't work. Now, we simply enclose all code where we want C-g read as an event with {begin/end}_dont_check_for_quit(). This completely turns off the mechanism that checks (and may remove or alter) C-g in the read-ahead queues, so we just get the C-g normal. Signal.c documents this very carefully. cmdloop.c: Correct use of dont_check_for_quit to new scheme, remove old out-of-date comments. event-stream.c: Fix C-g handling to actually work. device-x.c: Disable quit checking when err out. signal.c: Cleanup. Add large descriptive comment. process-unix.c, process-nt.c, sysdep.c: Use QUIT instead of REALLY_QUIT. It's not necessary to use REALLY_QUIT and just confuses the issue. lisp.h: Comment quit handlers. ================================================================ CONS CHANGES ================================================================ free_cons() now takes a Lisp_Object not the result of XCONS(). car and cdr have been renamed so that they don't get used directly; go through XCAR(), XCDR() instead. alloc.c, dired.c, editfns.c, emodules.c, fns.c, glyphs-msw.c, glyphs-x.c, glyphs.c, keymap.c, minibuf.c, search.c, eval.c, lread.c, lisp.h: Correct free_cons calling convention: now takes Lisp_Object, not Lisp_Cons chartab.c: Eliminate direct use of ->car, ->cdr, should be black box. callint.c: Rewrote using EXTERNAL_LIST_LOOP to avoid use of Lisp_Cons. ================================================================ USE INTERNAL-BIND-* ================================================================ eval.c: Cleanups of these funs. alloc.c, fileio.c, undo.c, specifier.c, text.c, profile.c, lread.c, redisplay.c, menubar-x.c, macros.c: Rewrote to use internal_bind_int() and internal_bind_lisp_object() in place of whatever varied and cumbersome mechanisms were formerly there. ================================================================ SPECBIND SANITY ================================================================ backtrace.h: - Improved comments backtrace.h, bytecode.c, eval.c: Add new mechanism check_specbind_stack_sanity() for sanity checking code each time the catchlist or specbind stack change. Removed older prototype of same mechanism. ================================================================ MISC ================================================================ lisp.h, insdel.c, window.c, device.c, console.c, buffer.c: Fleshed out authorship. device-msw.c: Correct bad Unicode-ization. print.c: Be more careful when not initialized or in fatal error handling. search.c: Eliminate running_asynch_code, an FSF holdover. alloc.c: Added comments about gc-cons-threshold. dialog-x.c: Use begin_gc_forbidden() around code to build up a widget value tree, like in menubar-x.c. gui.c: Use Qunbound not Qnil as the default for gethash. lisp-disunion.h, lisp-union.h: Added warnings on use of VOID_TO_LISP(). lisp.h: Use ERROR_CHECK_STRUCTURES to turn on ERROR_CHECK_TRAPPING_PROBLEMS and ERROR_CHECK_TYPECHECK lisp.h: Add assert_with_message. lisp.h: Add macros for gcproing entire arrays. (You could do this before but it required manual twiddling the gcpro structure.) lisp.h: Add prototypes for new functions defined elsewhere.
author ben
date Tue, 28 May 2002 08:45:36 +0000
parents e7ee5f8bde58
children 804517e16990
comparison
equal deleted inserted replaced
852:d83885ef293b 853:2b6fa2618f76
31 /* This file has been Mule-ized. */ 31 /* This file has been Mule-ized. */
32 32
33 /***************************************************************************** 33 /*****************************************************************************
34 The Golden Rules of Redisplay 34 The Golden Rules of Redisplay
35 35
36 First: It Is Better To Be Correct Than Fast 36 First: It Is Better To Be Correct Than Fast
37 Second: Thou Shalt Not Run Elisp From Within Redisplay 37 Second: Thou Shalt Use Due Caution When Running Elisp From Within Redisplay
38 Third: It Is Better To Be Fast Than Not To Be 38 Third: It Is Better To Be Fast Than Not To Be
39 ****************************************************************************/ 39 ****************************************************************************/
40
41 /* Note: The second rule used to prohibit running Elisp from within redisplay,
42 but that's not correct.
43
44 Use
45
46 callN_trapping_problems (..., INHIBIT_GC
47 | INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY)
48
49 instead.
50
51 --ben
52 */
40 53
41 #include <config.h> 54 #include <config.h>
42 #include "lisp.h" 55 #include "lisp.h"
43 56
44 #include "buffer.h" 57 #include "buffer.h"
45 #include "commands.h" 58 #include "commands.h"
46 #include "debug.h" 59 #include "debug.h"
47 #include "device.h" 60 #include "device.h"
48 #include "elhash.h" 61 #include "elhash.h"
62 #include "events.h"
49 #include "extents.h" 63 #include "extents.h"
50 #include "faces.h" 64 #include "faces.h"
51 #include "frame.h" 65 #include "frame.h"
52 #include "glyphs.h" 66 #include "glyphs.h"
53 #include "gutter.h" 67 #include "gutter.h"
6484 6498
6485 if (lrpos >= pos) 6499 if (lrpos >= pos)
6486 { 6500 {
6487 Lisp_Object window = wrap_window (w); 6501 Lisp_Object window = wrap_window (w);
6488 6502
6489 va_run_hook_with_args_in_buffer (XBUFFER (w->buffer), 6503 va_run_hook_with_args_in_buffer_trapping_problems
6490 Qredisplay_end_trigger_functions, 6504 ("Error in redisplay end trigger",
6491 2, window, 6505 XBUFFER (w->buffer),
6492 w->redisplay_end_trigger); 6506 Qredisplay_end_trigger_functions,
6507 2, window,
6508 w->redisplay_end_trigger,
6509 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
6493 w->redisplay_end_trigger = Qnil; 6510 w->redisplay_end_trigger = Qnil;
6494 } 6511 }
6495 } 6512 }
6496 6513
6497 return 0; 6514 return 0;
6501 6518
6502 int 6519 int
6503 redisplay_frame (struct frame *f, int preemption_check) 6520 redisplay_frame (struct frame *f, int preemption_check)
6504 { 6521 {
6505 struct device *d = XDEVICE (f->device); 6522 struct device *d = XDEVICE (f->device);
6523 int depth;
6506 6524
6507 if (preemption_check 6525 if (preemption_check
6508 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_DONT_PREEMPT_REDISPLAY)) 6526 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_DONT_PREEMPT_REDISPLAY))
6509 { 6527 {
6510 /* The preemption check itself takes a lot of time, 6528 /* The preemption check itself takes a lot of time,
6539 adjust_frame_size (f); 6557 adjust_frame_size (f);
6540 assert (!f->size_slipped); 6558 assert (!f->size_slipped);
6541 } 6559 }
6542 6560
6543 /* The menubar, toolbar, and icon updates must be done before 6561 /* The menubar, toolbar, and icon updates must be done before
6544 hold_frame_size_changes is called and we are officially 6562 enter_redisplay_critical_section is called and we are officially
6545 'in_display'. They may eval lisp code which may call Fsignal. 6563 'in_display'. They may eval lisp code which may call Fsignal.
6546 If in_display is set Fsignal will abort. */ 6564 If in_display is set Fsignal will abort. */
6547 6565
6548 #ifdef HAVE_MENUBARS 6566 #ifdef HAVE_MENUBARS
6549 /* Update the menubar. It is done first since it could change 6567 /* Update the menubar. It is done first since it could change
6578 { 6596 {
6579 /* we have to do this so the gutter gets regenerated. */ 6597 /* we have to do this so the gutter gets regenerated. */
6580 reset_gutter_display_lines (f); 6598 reset_gutter_display_lines (f);
6581 } 6599 }
6582 6600
6583 hold_frame_size_changes (); 6601 depth = enter_redisplay_critical_section ();
6584 6602
6585 /* ----------------- BEGIN CRITICAL REDISPLAY SECTION ---------------- */ 6603 /* ----------------- BEGIN CRITICAL REDISPLAY SECTION ---------------- */
6586 /* Within this section, we are defenseless and assume that the 6604 /* Within this section, we are defenseless and assume that the
6587 following cannot happen: 6605 following cannot happen:
6588 6606
6589 1) garbage collection 6607 1) garbage collection
6590 2) Lisp code evaluation 6608 2) Lisp code evaluation
6591 3) frame size changes 6609 3) frame size changes
6592 6610
6593 We ensure (3) by calling hold_frame_size_changes(), which 6611 We ensure (3) by calling enter_redisplay_critical_section(), which
6594 will cause any pending frame size changes to get put on hold 6612 will cause any pending frame size changes to get put on hold
6595 till after the end of the critical section. (1) follows 6613 till after the end of the critical section. (1) follows
6596 automatically if (2) is met. #### Unfortunately, there are 6614 automatically if (2) is met. #### Unfortunately, there are
6597 some places where Lisp code can be called within this section. 6615 some places where Lisp code can be called within this section.
6598 We need to remove them. 6616 We need to remove them.
6642 if (!f->size_change_pending) 6660 if (!f->size_change_pending)
6643 f->size_changed = 0; 6661 f->size_changed = 0;
6644 6662
6645 /* ----------------- END CRITICAL REDISPLAY SECTION ---------------- */ 6663 /* ----------------- END CRITICAL REDISPLAY SECTION ---------------- */
6646 6664
6647 /* Allow frame size changes to occur again. 6665 /* Allow frame size changes to occur again. */
6648 6666 exit_redisplay_critical_section (depth);
6649 #### what happens if changes to other frames happen? */
6650 unhold_one_frame_size_changes (f);
6651 6667
6652 map_windows (f, call_redisplay_end_triggers, 0); 6668 map_windows (f, call_redisplay_end_triggers, 0);
6653 return 0; 6669 return 0;
6654 } 6670 }
6655 6671
6748 d->size_changed = 0; 6764 d->size_changed = 0;
6749 6765
6750 return 0; 6766 return 0;
6751 } 6767 }
6752 6768
6753 static Lisp_Object
6754 restore_profiling_redisplay_flag (Lisp_Object val)
6755 {
6756 profiling_redisplay_flag = XINT (val);
6757 return Qnil;
6758 }
6759
6760 /* Ensure that all windows on all frames on all devices are displaying 6769 /* Ensure that all windows on all frames on all devices are displaying
6761 the current contents of their respective buffers. */ 6770 the current contents of their respective buffers. */
6762 6771
6763 static void 6772 static void
6764 redisplay_without_hooks (void) 6773 redisplay_without_hooks (void)
6766 Lisp_Object devcons, concons; 6775 Lisp_Object devcons, concons;
6767 int size_change_failed = 0; 6776 int size_change_failed = 0;
6768 int count = specpdl_depth (); 6777 int count = specpdl_depth ();
6769 6778
6770 if (profiling_active) 6779 if (profiling_active)
6771 { 6780 internal_bind_int (&profiling_redisplay_flag, 1);
6772 record_unwind_protect (restore_profiling_redisplay_flag,
6773 make_int (profiling_redisplay_flag));
6774 profiling_redisplay_flag = 1;
6775 }
6776 6781
6777 if (asynch_device_change_pending) 6782 if (asynch_device_change_pending)
6778 handle_asynch_device_change (); 6783 handle_asynch_device_change ();
6779 6784
6780 if (!GLOBAL_REDISPLAY_FLAGS_CHANGEDP && 6785 if (!GLOBAL_REDISPLAY_FLAGS_CHANGEDP &&
6824 #ifdef ERROR_CHECK_DISPLAY 6829 #ifdef ERROR_CHECK_DISPLAY
6825 sledgehammer_check_redisplay_structs (); 6830 sledgehammer_check_redisplay_structs ();
6826 #endif /* ERROR_CHECK_DISPLAY */ 6831 #endif /* ERROR_CHECK_DISPLAY */
6827 } 6832 }
6828 6833
6834 /* Note: All places in the C code that call redisplay() are prepared
6835 to handle GCing. However, we can't currently handle GC inside the
6836 guts of redisplay (#### someone should fix this), so we need to use
6837 INHIBIT_GC when calling Lisp.
6838
6839 #### We probably can't handle any deletion of existing buffers, frames,
6840 windows, devices, consoles, text changes, etc. either. We should
6841
6842 (a) Create the appropriate INHIBIT_ flags for this.
6843 (b) In the longer run, fix redisplay to handle this.
6844
6845 (#### What about other external entry points to the redisplay code?
6846 Someone should go through and make sure that all callers can handle
6847 GC there, too.)
6848 */
6849
6829 void 6850 void
6830 redisplay (void) 6851 redisplay (void)
6852 {
6853 run_pre_idle_hook ();
6854 redisplay_no_pre_idle_hook ();
6855 }
6856
6857 void
6858 redisplay_no_pre_idle_hook (void)
6831 { 6859 {
6832 if (last_display_warning_tick != display_warning_tick && 6860 if (last_display_warning_tick != display_warning_tick &&
6833 !inhibit_warning_display) 6861 !inhibit_warning_display)
6834 { 6862 {
6835 /* If an error occurs during this function, oh well. 6863 /* If an error occurs during this function, oh well.
6836 If we report another warning, we could get stuck in an 6864 If we report another warning, we could get stuck in an
6837 infinite loop reporting warnings. */ 6865 infinite loop reporting warnings. */
6838 call0_trapping_errors (0, Qdisplay_warning_buffer); 6866 call0_trapping_problems
6867 (0, Qdisplay_warning_buffer,
6868 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
6839 last_display_warning_tick = display_warning_tick; 6869 last_display_warning_tick = display_warning_tick;
6840 } 6870 }
6841 /* The run_hook_trapping_errors functions are smart enough not 6871 /* The run_hook_trapping_problems functions are smart enough not
6842 to do any evalling if the hook function is empty, so there 6872 to do any evalling if the hook function is empty, so there
6843 should not be any significant time loss. All places in the 6873 should not be any significant time loss. */
6844 C code that call redisplay() are prepared to handle GCing,
6845 so we should be OK. */
6846 #ifndef INHIBIT_REDISPLAY_HOOKS 6874 #ifndef INHIBIT_REDISPLAY_HOOKS
6847 run_hook_trapping_errors ("Error in pre-redisplay-hook", 6875 run_hook_trapping_problems
6848 Qpre_redisplay_hook); 6876 ("Error in pre-redisplay-hook",
6877 Qpre_redisplay_hook,
6878 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
6849 #endif /* INHIBIT_REDISPLAY_HOOKS */ 6879 #endif /* INHIBIT_REDISPLAY_HOOKS */
6850 6880
6851 redisplay_without_hooks (); 6881 redisplay_without_hooks ();
6852 6882
6853 #ifndef INHIBIT_REDISPLAY_HOOKS 6883 #ifndef INHIBIT_REDISPLAY_HOOKS
6854 run_hook_trapping_errors ("Error in post-redisplay-hook", 6884 run_hook_trapping_problems
6855 Qpost_redisplay_hook); 6885 ("Error in post-redisplay-hook",
6886 Qpost_redisplay_hook,
6887 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
6856 #endif /* INHIBIT_REDISPLAY_HOOKS */ 6888 #endif /* INHIBIT_REDISPLAY_HOOKS */
6857 } 6889 }
6858 6890
6891 Lisp_Object
6892 eval_within_redisplay (Lisp_Object dont_trust_this_damn_sucker)
6893 {
6894 return
6895 eval_in_buffer_trapping_problems
6896 ("Error calling function within redisplay", current_buffer,
6897 dont_trust_this_damn_sucker,
6898 INHIBIT_GC | INHIBIT_ANY_CHANGE_AFFECTING_REDISPLAY);
6899 }
6859 6900
6860 /* Efficiently determine the window line number, and return a pointer 6901 /* Efficiently determine the window line number, and return a pointer
6861 to its printed representation. Do this regardless of whether 6902 to its printed representation. Do this regardless of whether
6862 line-number-mode is on. The first line in the buffer is counted as 6903 line-number-mode is on. The first line in the buffer is counted as
6863 1. If narrowing is in effect, the lines are counted from the 6904 1. If narrowing is in effect, the lines are counted from the
9012 Lisp_Object frmcons; 9053 Lisp_Object frmcons;
9013 9054
9014 DEVICE_FRAME_LOOP (frmcons, d) 9055 DEVICE_FRAME_LOOP (frmcons, d)
9015 { 9056 {
9016 struct frame *f = XFRAME (XCAR (frmcons)); 9057 struct frame *f = XFRAME (XCAR (frmcons));
9058 int depth;
9017 9059
9018 if (FRAME_REPAINT_P (f) && FRAME_HAS_MINIBUF_P (f)) 9060 if (FRAME_REPAINT_P (f) && FRAME_HAS_MINIBUF_P (f))
9019 { 9061 {
9020 Lisp_Object window = FRAME_MINIBUF_WINDOW (f); 9062 Lisp_Object window = FRAME_MINIBUF_WINDOW (f);
9021 9063
9030 if (f->echo_area_garbaged) 9072 if (f->echo_area_garbaged)
9031 { 9073 {
9032 MAYBE_DEVMETH (d, clear_frame, (f)); 9074 MAYBE_DEVMETH (d, clear_frame, (f));
9033 f->echo_area_garbaged = 0; 9075 f->echo_area_garbaged = 0;
9034 } 9076 }
9077 depth = enter_redisplay_critical_section ();
9035 redisplay_window (window, 0); 9078 redisplay_window (window, 0);
9079 exit_redisplay_critical_section (depth);
9036 MAYBE_DEVMETH (d, frame_output_end, (f)); 9080 MAYBE_DEVMETH (d, frame_output_end, (f));
9037 9081
9038 call_redisplay_end_triggers (XWINDOW (window), 0); 9082 call_redisplay_end_triggers (XWINDOW (window), 0);
9039 } 9083 }
9040 } 9084 }
9041 } 9085 }
9042 9086
9043 return Qnil;
9044 }
9045
9046 static Lisp_Object
9047 restore_disable_preemption_value (Lisp_Object value)
9048 {
9049 disable_preemption = XINT (value);
9050 return Qnil; 9087 return Qnil;
9051 } 9088 }
9052 9089
9053 DEFUN ("redraw-frame", Fredraw_frame, 0, 2, 0, /* 9090 DEFUN ("redraw-frame", Fredraw_frame, 0, 2, 0, /*
9054 Clear frame FRAME and output again what is supposed to appear on it. 9091 Clear frame FRAME and output again what is supposed to appear on it.
9061 { 9098 {
9062 struct frame *f = decode_frame (frame); 9099 struct frame *f = decode_frame (frame);
9063 int count = specpdl_depth (); 9100 int count = specpdl_depth ();
9064 9101
9065 if (!NILP (no_preempt)) 9102 if (!NILP (no_preempt))
9066 { 9103 internal_bind_int (&disable_preemption, 1 + disable_preemption);
9067 record_unwind_protect (restore_disable_preemption_value,
9068 make_int (disable_preemption));
9069 disable_preemption++;
9070 }
9071 9104
9072 f->clear = 1; 9105 f->clear = 1;
9073 redisplay_frame (f, 1); 9106 redisplay_frame (f, 1);
9074 9107
9075 /* See the comment in Fredisplay_frame. */ 9108 /* See the comment in Fredisplay_frame. */
9092 { 9125 {
9093 struct frame *f = decode_frame (frame); 9126 struct frame *f = decode_frame (frame);
9094 int count = specpdl_depth (); 9127 int count = specpdl_depth ();
9095 9128
9096 if (!NILP (no_preempt)) 9129 if (!NILP (no_preempt))
9097 { 9130 internal_bind_int (&disable_preemption, 1 + disable_preemption);
9098 record_unwind_protect (restore_disable_preemption_value,
9099 make_int (disable_preemption));
9100 disable_preemption++;
9101 }
9102 9131
9103 redisplay_frame (f, 1); 9132 redisplay_frame (f, 1);
9104 9133
9105 /* If we don't reset the global redisplay flags here, subsequent 9134 /* If we don't reset the global redisplay flags here, subsequent
9106 changes to the display will not get registered by redisplay 9135 changes to the display will not get registered by redisplay
9126 struct device *d = decode_device (device); 9155 struct device *d = decode_device (device);
9127 Lisp_Object frmcons; 9156 Lisp_Object frmcons;
9128 int count = specpdl_depth (); 9157 int count = specpdl_depth ();
9129 9158
9130 if (!NILP (no_preempt)) 9159 if (!NILP (no_preempt))
9131 { 9160 internal_bind_int (&disable_preemption, 1 + disable_preemption);
9132 record_unwind_protect (restore_disable_preemption_value,
9133 make_int (disable_preemption));
9134 disable_preemption++;
9135 }
9136 9161
9137 DEVICE_FRAME_LOOP (frmcons, d) 9162 DEVICE_FRAME_LOOP (frmcons, d)
9138 { 9163 {
9139 XFRAME (XCAR (frmcons))->clear = 1; 9164 XFRAME (XCAR (frmcons))->clear = 1;
9140 } 9165 }
9153 the device. 9178 the device.
9154 DEVICE defaults to the selected device if omitted. 9179 DEVICE defaults to the selected device if omitted.
9155 Normally, redisplay is preempted as normal if input arrives. However, 9180 Normally, redisplay is preempted as normal if input arrives. However,
9156 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for 9181 if optional second arg NO-PREEMPT is non-nil, redisplay will not stop for
9157 input and is guaranteed to proceed to completion. 9182 input and is guaranteed to proceed to completion.
9183
9184 Note: If you simply want everything redisplayed, the current idiom is
9185 `(sit-for 0)'.
9158 */ 9186 */
9159 (device, no_preempt)) 9187 (device, no_preempt))
9160 { 9188 {
9161 struct device *d = decode_device (device); 9189 struct device *d = decode_device (device);
9162 int count = specpdl_depth (); 9190 int count = specpdl_depth ();
9163 9191
9164 if (!NILP (no_preempt)) 9192 if (!NILP (no_preempt))
9165 { 9193 internal_bind_int (&disable_preemption, 1 + disable_preemption);
9166 record_unwind_protect (restore_disable_preemption_value,
9167 make_int (disable_preemption));
9168 disable_preemption++;
9169 }
9170 9194
9171 redisplay_device (d, 0); 9195 redisplay_device (d, 0);
9172 9196
9173 /* See the comment in Fredisplay_frame. */ 9197 /* See the comment in Fredisplay_frame. */
9174 RESET_CHANGED_SET_FLAGS; 9198 RESET_CHANGED_SET_FLAGS;