xdisp.c 755 KB
Newer Older
Jim Blandy's avatar
Jim Blandy committed
1
/* Display generation from window structure and buffer text.
2 3
   Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995,
                 1997, 1998, 1999, 2000, 2001, 2002, 2003,
Glenn Morris's avatar
Glenn Morris committed
4
                 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Jim Blandy's avatar
Jim Blandy committed
5 6 7

This file is part of GNU Emacs.

8
GNU Emacs is free software: you can redistribute it and/or modify
Jim Blandy's avatar
Jim Blandy committed
9
it under the terms of the GNU General Public License as published by
10 11
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Jim Blandy's avatar
Jim Blandy committed
12 13 14 15 16 17 18

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
19
along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
Jim Blandy's avatar
Jim Blandy committed
20

Gerd Moellmann's avatar
Gerd Moellmann committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34
/* New redisplay written by Gerd Moellmann <gerd@gnu.org>.

   Redisplay.

   Emacs separates the task of updating the display from code
   modifying global state, e.g. buffer text.  This way functions
   operating on buffers don't also have to be concerned with updating
   the display.

   Updating the display is triggered by the Lisp interpreter when it
   decides it's time to do it.  This is done either automatically for
   you as part of the interpreter's command loop or as the result of
   calling Lisp functions like `sit-for'.  The C function `redisplay'
   in xdisp.c is the only entry into the inner redisplay code.  (Or,
Pavel Janík's avatar
Pavel Janík committed
35
   let's say almost---see the description of direct update
36
   operations, below.)
Gerd Moellmann's avatar
Gerd Moellmann committed
37 38 39 40 41 42 43 44 45 46 47 48

   The following diagram shows how redisplay code is invoked.  As you
   can see, Lisp calls redisplay and vice versa.  Under window systems
   like X, some portions of the redisplay code are also called
   asynchronously during mouse movement or expose events.  It is very
   important that these code parts do NOT use the C library (malloc,
   free) because many C libraries under Unix are not reentrant.  They
   may also NOT call functions of the Lisp interpreter which could
   change the interpreter's state.  If you don't follow these rules,
   you will encounter bugs which are very hard to explain.

	     (Direct functions, see below)
49
             direct_output_for_insert,
Gerd Moellmann's avatar
Gerd Moellmann committed
50 51 52 53
             direct_forward_char (dispnew.c)
   	  +---------------------------------+
          |                                 |
	  |                                 V
54
   +--------------+   redisplay     +----------------+
Gerd Moellmann's avatar
Gerd Moellmann committed
55 56 57 58 59 60 61 62 63 64 65
   | Lisp machine |---------------->| Redisplay code |<--+
   +--------------+   (xdisp.c)     +----------------+   |
	  ^				     |		 |
	  +----------------------------------+           |
	    Don't use this path when called		 |
	    asynchronously!				 |
                                                         |
                           expose_window (asynchronous)  |
                                                         |
			           X expose events  -----+

66
   What does redisplay do?  Obviously, it has to figure out somehow what
Gerd Moellmann's avatar
Gerd Moellmann committed
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
   has been changed since the last time the display has been updated,
   and to make these changes visible.  Preferably it would do that in
   a moderately intelligent way, i.e. fast.

   Changes in buffer text can be deduced from window and buffer
   structures, and from some global variables like `beg_unchanged' and
   `end_unchanged'.  The contents of the display are additionally
   recorded in a `glyph matrix', a two-dimensional matrix of glyph
   structures.  Each row in such a matrix corresponds to a line on the
   display, and each glyph in a row corresponds to a column displaying
   a character, an image, or what else.  This matrix is called the
   `current glyph matrix' or `current matrix' in redisplay
   terminology.

   For buffer parts that have been changed since the last update, a
   second glyph matrix is constructed, the so called `desired glyph
   matrix' or short `desired matrix'.  Current and desired matrix are
   then compared to find a cheap way to update the display, e.g. by
   reusing part of the display by scrolling lines.


   Direct operations.

Pavel Janík's avatar
Pavel Janík committed
90
   You will find a lot of redisplay optimizations when you start
Gerd Moellmann's avatar
Gerd Moellmann committed
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
   looking at the innards of redisplay.  The overall goal of all these
   optimizations is to make redisplay fast because it is done
   frequently.

   Two optimizations are not found in xdisp.c.  These are the direct
   operations mentioned above.  As the name suggests they follow a
   different principle than the rest of redisplay.  Instead of
   building a desired matrix and then comparing it with the current
   display, they perform their actions directly on the display and on
   the current matrix.

   One direct operation updates the display after one character has
   been entered.  The other one moves the cursor by one position
   forward or backward.  You find these functions under the names
   `direct_output_for_insert' and `direct_output_forward_char' in
   dispnew.c.

108

Gerd Moellmann's avatar
Gerd Moellmann committed
109 110 111 112 113 114 115 116 117 118 119 120 121
   Desired matrices.

   Desired matrices are always built per Emacs window.  The function
   `display_line' is the central function to look at if you are
   interested.  It constructs one row in a desired matrix given an
   iterator structure containing both a buffer position and a
   description of the environment in which the text is to be
   displayed.  But this is too early, read on.

   Characters and pixmaps displayed for a range of buffer text depend
   on various settings of buffers and windows, on overlays and text
   properties, on display tables, on selective display.  The good news
   is that all this hairy stuff is hidden behind a small set of
122
   interface functions taking an iterator structure (struct it)
Gerd Moellmann's avatar
Gerd Moellmann committed
123 124
   argument.

Pavel Janík's avatar
Pavel Janík committed
125
   Iteration over things to be displayed is then simple.  It is
Gerd Moellmann's avatar
Gerd Moellmann committed
126 127 128
   started by initializing an iterator with a call to init_iterator.
   Calls to get_next_display_element fill the iterator structure with
   relevant information about the next thing to display.  Calls to
Gerd Moellmann's avatar
Gerd Moellmann committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
   set_iterator_to_next move the iterator to the next thing.

   Besides this, an iterator also contains information about the
   display environment in which glyphs for display elements are to be
   produced.  It has fields for the width and height of the display,
   the information whether long lines are truncated or continued, a
   current X and Y position, and lots of other stuff you can better
   see in dispextern.h.

   Glyphs in a desired matrix are normally constructed in a loop
   calling get_next_display_element and then produce_glyphs.  The call
   to produce_glyphs will fill the iterator structure with pixel
   information about the element being displayed and at the same time
   produce glyphs for it.  If the display element fits on the line
   being displayed, set_iterator_to_next is called next, otherwise the
   glyphs produced are discarded.


   Frame matrices.

   That just couldn't be all, could it?  What about terminal types not
   supporting operations on sub-windows of the screen?  To update the
   display on such a terminal, window-based glyph matrices are not
   well suited.  To be able to reuse part of the display (scrolling
   lines up and down), we must instead have a view of the whole
   screen.  This is what `frame matrices' are for.  They are a trick.

   Frames on terminals like above have a glyph pool.  Windows on such
   a frame sub-allocate their glyph memory from their frame's glyph
   pool.  The frame itself is given its own glyph matrices.  By
   coincidence---or maybe something else---rows in window glyph
   matrices are slices of corresponding rows in frame matrices.  Thus
   writing to window matrices implicitly updates a frame matrix which
   provides us with the view of the whole screen that we originally
   wanted to have without having to move many bytes around.  To be
   honest, there is a little bit more done, but not much more.  If you
   plan to extend that code, take a look at dispnew.c.  The function
   build_frame_matrix is a good starting point.  */
Jim Blandy's avatar
Jim Blandy committed
167

168
#include <config.h>
Jim Blandy's avatar
Jim Blandy committed
169
#include <stdio.h>
170
#include <limits.h>
171
#include <setjmp.h>
172

Jim Blandy's avatar
Jim Blandy committed
173
#include "lisp.h"
174
#include "keyboard.h"
Jim Blandy's avatar
Jim Blandy committed
175
#include "frame.h"
Jim Blandy's avatar
Jim Blandy committed
176 177 178 179
#include "window.h"
#include "termchar.h"
#include "dispextern.h"
#include "buffer.h"
Kenichi Handa's avatar
Kenichi Handa committed
180
#include "character.h"
181
#include "charset.h"
Jim Blandy's avatar
Jim Blandy committed
182 183
#include "indent.h"
#include "commands.h"
184
#include "keymap.h"
Jim Blandy's avatar
Jim Blandy committed
185 186
#include "macros.h"
#include "disptab.h"
187
#include "termhooks.h"
188
#include "intervals.h"
189 190
#include "coding.h"
#include "process.h"
Andreas Schwab's avatar
Andreas Schwab committed
191
#include "region-cache.h"
Kenichi Handa's avatar
Kenichi Handa committed
192
#include "font.h"
Dave Love's avatar
Dave Love committed
193
#include "fontset.h"
194
#include "blockinput.h"
Andreas Schwab's avatar
Andreas Schwab committed
195

196
#ifdef HAVE_X_WINDOWS
Andreas Schwab's avatar
Andreas Schwab committed
197 198
#include "xterm.h"
#endif
199 200 201
#ifdef WINDOWSNT
#include "w32term.h"
#endif
202 203 204
#ifdef HAVE_NS
#include "nsterm.h"
#endif
205 206 207
#ifdef USE_GTK
#include "gtkutil.h"
#endif
Jim Blandy's avatar
Jim Blandy committed
208

209 210
#include "font.h"

211 212 213 214
#ifndef FRAME_X_OUTPUT
#define FRAME_X_OUTPUT(f) ((f)->output_data.x)
#endif

Gerd Moellmann's avatar
Gerd Moellmann committed
215 216
#define INFINITY 10000000

217
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
218
    || defined(HAVE_NS) || defined (USE_GTK)
219
extern void set_frame_menubar P_ ((struct frame *f, int, int));
220
extern int pending_menu_activation;
221 222
#endif

Jim Blandy's avatar
Jim Blandy committed
223 224 225
extern int interrupt_input;
extern int command_loop_level;

226 227
extern Lisp_Object do_mouse_tracking;

228
extern int minibuffer_auto_raise;
229
extern Lisp_Object Vminibuffer_list;
230

231
extern Lisp_Object Qface;
232
extern Lisp_Object Qmode_line, Qmode_line_inactive, Qheader_line;
233

234 235
extern Lisp_Object Voverriding_local_map;
extern Lisp_Object Voverriding_local_map_menu_flag;
Gerd Moellmann's avatar
Gerd Moellmann committed
236
extern Lisp_Object Qmenu_item;
237
extern Lisp_Object Qwhen;
238
extern Lisp_Object Qhelp_echo;
239
extern Lisp_Object Qbefore_string, Qafter_string;
240

241
Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
242
Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
243
Lisp_Object Qwindow_text_change_functions, Vwindow_text_change_functions;
244
Lisp_Object Qredisplay_end_trigger_functions, Vredisplay_end_trigger_functions;
245
Lisp_Object Qinhibit_point_motion_hooks;
246
Lisp_Object QCeval, QCfile, QCdata, QCpropertize;
Gerd Moellmann's avatar
Gerd Moellmann committed
247
Lisp_Object Qfontified;
248
Lisp_Object Qgrow_only;
249
Lisp_Object Qinhibit_eval_during_redisplay;
250
Lisp_Object Qbuffer_position, Qposition, Qobject;
251
Lisp_Object Qright_to_left, Qleft_to_right;
Gerd Moellmann's avatar
Gerd Moellmann committed
252

253 254 255
/* Cursor shapes */
Lisp_Object Qbar, Qhbar, Qbox, Qhollow;

Kenichi Handa's avatar
Kenichi Handa committed
256 257 258
/* Pointer shapes */
Lisp_Object Qarrow, Qhand, Qtext;

259 260
Lisp_Object Qrisky_local_variable;

261 262 263
/* Holds the list (error).  */
Lisp_Object list_of_error;

Gerd Moellmann's avatar
Gerd Moellmann committed
264 265 266 267 268
/* Functions called to fontify regions of text.  */

Lisp_Object Vfontification_functions;
Lisp_Object Qfontification_functions;

269
/* Non-nil means automatically select any window when the mouse
270
   cursor moves into it.  */
271
Lisp_Object Vmouse_autoselect_window;
272

273 274 275
Lisp_Object Vwrap_prefix, Qwrap_prefix;
Lisp_Object Vline_prefix, Qline_prefix;

Gerd Moellmann's avatar
Gerd Moellmann committed
276
/* Non-zero means draw tool bar buttons raised when the mouse moves
Gerd Moellmann's avatar
Gerd Moellmann committed
277 278
   over them.  */

Gerd Moellmann's avatar
Gerd Moellmann committed
279
int auto_raise_tool_bar_buttons_p;
Gerd Moellmann's avatar
Gerd Moellmann committed
280

281 282 283 284
/* Non-zero means to reposition window if cursor line is only partially visible.  */

int make_cursor_line_fully_visible_p;

285 286 287 288 289 290
/* Margin below tool bar in pixels.  0 or nil means no margin.
   If value is `internal-border-width' or `border-width',
   the corresponding frame parameter is used.  */

Lisp_Object Vtool_bar_border;

Gerd Moellmann's avatar
Gerd Moellmann committed
291
/* Margin around tool bar buttons in pixels.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
292

293
Lisp_Object Vtool_bar_button_margin;
Gerd Moellmann's avatar
Gerd Moellmann committed
294

Gerd Moellmann's avatar
Gerd Moellmann committed
295
/* Thickness of shadow to draw around tool bar buttons.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
296

297
EMACS_INT tool_bar_button_relief;
Gerd Moellmann's avatar
Gerd Moellmann committed
298

299 300
/* Non-nil means automatically resize tool-bars so that all tool-bar
   items are visible, and no blank lines remain.
Gerd Moellmann's avatar
Gerd Moellmann committed
301

302 303 304
   If value is `grow-only', only make tool-bar bigger.  */

Lisp_Object Vauto_resize_tool_bars;
305

306 307 308 309 310 311
/* Non-zero means draw block and hollow cursor as wide as the glyph
   under it.  For example, if a block cursor is over a tab, it will be
   drawn as wide as that tab on the display.  */

int x_stretch_cursor_p;

312 313 314 315
/* Non-nil means don't actually do any redisplay.  */

Lisp_Object Vinhibit_redisplay, Qinhibit_redisplay;

316 317
/* Non-zero means Lisp evaluation during redisplay is inhibited.  */

318
int inhibit_eval_during_redisplay;
319

Gerd Moellmann's avatar
Gerd Moellmann committed
320 321
/* Names of text properties relevant for redisplay.  */

Kenichi Handa's avatar
Kenichi Handa committed
322
Lisp_Object Qdisplay;
323
extern Lisp_Object Qface, Qinvisible, Qwidth;
Gerd Moellmann's avatar
Gerd Moellmann committed
324 325 326

/* Symbols used in text property values.  */

Kenichi Handa's avatar
Kenichi Handa committed
327
Lisp_Object Vdisplay_pixels_per_inch;
Gerd Moellmann's avatar
Gerd Moellmann committed
328
Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height;
329
Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise;
Kim F. Storm's avatar
Kim F. Storm committed
330
Lisp_Object Qslice;
Kenichi Handa's avatar
Kenichi Handa committed
331 332
Lisp_Object Qcenter;
Lisp_Object Qmargin, Qpointer;
333
Lisp_Object Qline_height;
334
extern Lisp_Object Qheight;
335
extern Lisp_Object QCwidth, QCheight, QCascent;
Kenichi Handa's avatar
Kenichi Handa committed
336
extern Lisp_Object Qscroll_bar;
337
extern Lisp_Object Qcursor;
Gerd Moellmann's avatar
Gerd Moellmann committed
338

339
/* Non-nil means highlight trailing whitespace.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
340

341
Lisp_Object Vshow_trailing_whitespace;
Gerd Moellmann's avatar
Gerd Moellmann committed
342

343 344
/* Non-nil means escape non-break space and hyphens.  */

345
Lisp_Object Vnobreak_char_display;
346

Kenichi Handa's avatar
Kenichi Handa committed
347 348 349 350 351 352 353 354 355 356
#ifdef HAVE_WINDOW_SYSTEM
extern Lisp_Object Voverflow_newline_into_fringe;

/* Test if overflow newline into fringe.  Called with iterator IT
   at or past right window margin, and with IT->current_x set.  */

#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it)	\
  (!NILP (Voverflow_newline_into_fringe)	\
   && FRAME_WINDOW_P (it->f)			\
   && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0	\
357 358
   && it->current_x == it->last_visible_x	\
   && it->line_wrap != WORD_WRAP)
Kenichi Handa's avatar
Kenichi Handa committed
359

360 361
#else /* !HAVE_WINDOW_SYSTEM */
#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0
Kenichi Handa's avatar
Kenichi Handa committed
362 363
#endif /* HAVE_WINDOW_SYSTEM */

364 365 366 367 368 369
/* Test if the display element loaded in IT is a space or tab
   character.  This is used to determine word wrapping.  */

#define IT_DISPLAYING_WHITESPACE(it)				\
  (it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))

Kenichi Handa's avatar
Kenichi Handa committed
370 371 372 373 374 375
/* Non-nil means show the text cursor in void text areas
   i.e. in blank areas after eol and eob.  This used to be
   the default in 21.3.  */

Lisp_Object Vvoid_text_area_pointer;

Gerd Moellmann's avatar
Gerd Moellmann committed
376 377 378 379
/* Name of the face used to highlight trailing whitespace.  */

Lisp_Object Qtrailing_whitespace;

380 381 382 383
/* Name and number of the face used to highlight escape glyphs.  */

Lisp_Object Qescape_glyph;

Juri Linkov's avatar
Juri Linkov committed
384 385
/* Name and number of the face used to highlight non-breaking spaces.  */

386
Lisp_Object Qnobreak_space;
Juri Linkov's avatar
Juri Linkov committed
387

Gerd Moellmann's avatar
Gerd Moellmann committed
388 389 390 391 392
/* The symbol `image' which is the car of the lists used to represent
   images in Lisp.  */

Lisp_Object Qimage;

Kenichi Handa's avatar
Kenichi Handa committed
393 394 395 396
/* The image map types.  */
Lisp_Object QCmap, QCpointer;
Lisp_Object Qrect, Qcircle, Qpoly;

Gerd Moellmann's avatar
Gerd Moellmann committed
397 398
/* Non-zero means print newline to stdout before next mini-buffer
   message.  */
Jim Blandy's avatar
Jim Blandy committed
399 400 401

int noninteractive_need_newline;

Gerd Moellmann's avatar
Gerd Moellmann committed
402
/* Non-zero means print newline to message log before next message.  */
403

404
static int message_log_need_newline;
405

406 407 408 409 410 411
/* Three markers that message_dolog uses.
   It could allocate them itself, but that causes trouble
   in handling memory-full errors.  */
static Lisp_Object message_dolog_marker1;
static Lisp_Object message_dolog_marker2;
static Lisp_Object message_dolog_marker3;
Gerd Moellmann's avatar
Gerd Moellmann committed
412 413 414 415 416

/* The buffer position of the first character appearing entirely or
   partially on the line of the selected window which contains the
   cursor; <= 0 if not known.  Set by set_cursor_from_row, used for
   redisplay optimization in redisplay_internal.  */
Jim Blandy's avatar
Jim Blandy committed
417

Gerd Moellmann's avatar
Gerd Moellmann committed
418
static struct text_pos this_line_start_pos;
Jim Blandy's avatar
Jim Blandy committed
419

Gerd Moellmann's avatar
Gerd Moellmann committed
420 421 422 423 424 425
/* Number of characters past the end of the line above, including the
   terminating newline.  */

static struct text_pos this_line_end_pos;

/* The vertical positions and the height of this line.  */
Jim Blandy's avatar
Jim Blandy committed
426 427

static int this_line_vpos;
Gerd Moellmann's avatar
Gerd Moellmann committed
428 429 430 431 432 433 434
static int this_line_y;
static int this_line_pixel_height;

/* X position at which this display line starts.  Usually zero;
   negative if first character is partially visible.  */

static int this_line_start_x;
Jim Blandy's avatar
Jim Blandy committed
435

Gerd Moellmann's avatar
Gerd Moellmann committed
436
/* Buffer that this_line_.* variables are referring to.  */
Jim Blandy's avatar
Jim Blandy committed
437 438 439

static struct buffer *this_line_buffer;

Gerd Moellmann's avatar
Gerd Moellmann committed
440 441
/* Nonzero means truncate lines in all windows less wide than the
   frame.  */
Jim Blandy's avatar
Jim Blandy committed
442

443
Lisp_Object Vtruncate_partial_width_windows;
Jim Blandy's avatar
Jim Blandy committed
444

445
/* A flag to control how to display unibyte 8-bit character.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
446

447
int unibyte_display_via_language_environment;
448

Gerd Moellmann's avatar
Gerd Moellmann committed
449 450 451
/* Nonzero means we have more than one non-mini-buffer-only frame.
   Not guaranteed to be accurate except while parsing
   frame-title-format.  */
452

453 454
int multiple_frames;

Jim Blandy's avatar
Jim Blandy committed
455 456
Lisp_Object Vglobal_mode_string;

Kenichi Handa's avatar
Kenichi Handa committed
457 458 459 460 461 462 463

/* List of variables (symbols) which hold markers for overlay arrows.
   The symbols on this list are examined during redisplay to determine
   where to display overlay arrows.  */

Lisp_Object Voverlay_arrow_variable_list;

Jim Blandy's avatar
Jim Blandy committed
464
/* Marker for where to display an arrow on top of the buffer text.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
465

Jim Blandy's avatar
Jim Blandy committed
466 467
Lisp_Object Voverlay_arrow_position;

Gerd Moellmann's avatar
Gerd Moellmann committed
468 469
/* String to display for the arrow.  Only used on terminal frames.  */

Jim Blandy's avatar
Jim Blandy committed
470 471
Lisp_Object Voverlay_arrow_string;

Kenichi Handa's avatar
Kenichi Handa committed
472 473 474
/* Values of those variables at last redisplay are stored as
   properties on `overlay-arrow-position' symbol.  However, if
   Voverlay_arrow_position is a marker, last-arrow-position is its
Gerd Moellmann's avatar
Gerd Moellmann committed
475 476
   numerical position.  */

Kenichi Handa's avatar
Kenichi Handa committed
477 478 479 480 481 482
Lisp_Object Qlast_arrow_position, Qlast_arrow_string;

/* Alternative overlay-arrow-string and overlay-arrow-bitmap
   properties on a symbol in overlay-arrow-variable-list.  */

Lisp_Object Qoverlay_arrow_string, Qoverlay_arrow_bitmap;
483

Gerd Moellmann's avatar
Gerd Moellmann committed
484 485
/* Like mode-line-format, but for the title bar on a visible frame.  */

486 487
Lisp_Object Vframe_title_format;

Gerd Moellmann's avatar
Gerd Moellmann committed
488 489
/* Like mode-line-format, but for the title bar on an iconified frame.  */

490 491
Lisp_Object Vicon_title_format;

492 493 494
/* List of functions to call when a window's size changes.  These
   functions get one arg, a frame on which one or more windows' sizes
   have changed.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
495

496 497
static Lisp_Object Vwindow_size_change_functions;

498
Lisp_Object Qmenu_bar_update_hook, Vmenu_bar_update_hook;
499

500
/* Nonzero if an overlay arrow has been displayed in this window.  */
Jim Blandy's avatar
Jim Blandy committed
501

Gerd Moellmann's avatar
Gerd Moellmann committed
502
static int overlay_arrow_seen;
Karl Heuer's avatar
Karl Heuer committed
503

504 505
/* Nonzero means highlight the region even in nonselected windows.  */

Gerd Moellmann's avatar
Gerd Moellmann committed
506 507 508 509 510
int highlight_nonselected_windows;

/* If cursor motion alone moves point off frame, try scrolling this
   many lines up or down if that will bring it back.  */

511
static EMACS_INT scroll_step;
Jim Blandy's avatar
Jim Blandy committed
512

513
/* Nonzero means scroll just far enough to bring point back on the
Gerd Moellmann's avatar
Gerd Moellmann committed
514 515
   screen, when appropriate.  */

516
static EMACS_INT scroll_conservatively;
517

Gerd Moellmann's avatar
Gerd Moellmann committed
518 519
/* Recenter the window whenever point gets within this many lines of
   the top or bottom of the window.  This value is translated into a
520 521
   pixel value by multiplying it with FRAME_LINE_HEIGHT, which means
   that there is really a fixed pixel height scroll margin.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
522

523
EMACS_INT scroll_margin;
524

Gerd Moellmann's avatar
Gerd Moellmann committed
525 526 527
/* Number of windows showing the buffer of the selected window (or
   another buffer with the same base buffer).  keyboard.c refers to
   this.  */
Jim Blandy's avatar
Jim Blandy committed
528 529 530

int buffer_shared;

Gerd Moellmann's avatar
Gerd Moellmann committed
531
/* Vector containing glyphs for an ellipsis `...'.  */
Jim Blandy's avatar
Jim Blandy committed
532

Gerd Moellmann's avatar
Gerd Moellmann committed
533
static Lisp_Object default_invis_vector[3];
Jim Blandy's avatar
Jim Blandy committed
534

535 536 537 538 539
/* Zero means display the mode-line/header-line/menu-bar in the default face
   (this slightly odd definition is for compatibility with previous versions
   of emacs), non-zero means display them using their respective faces.

   This variable is deprecated.  */
Jim Blandy's avatar
Jim Blandy committed
540 541 542

int mode_line_inverse_video;

Gerd Moellmann's avatar
Gerd Moellmann committed
543 544
/* Prompt to display in front of the mini-buffer contents.  */

545
Lisp_Object minibuf_prompt;
Jim Blandy's avatar
Jim Blandy committed
546

Gerd Moellmann's avatar
Gerd Moellmann committed
547 548 549
/* Width of current mini-buffer prompt.  Only set after display_line
   of the line that contains the prompt.  */

Jim Blandy's avatar
Jim Blandy committed
550
int minibuf_prompt_width;
Gerd Moellmann's avatar
Gerd Moellmann committed
551 552 553 554 555

/* This is the window where the echo area message was displayed.  It
   is always a mini-buffer window, but it may not be the same window
   currently active as a mini-buffer.  */

556 557
Lisp_Object echo_area_window;

558 559 560 561 562 563 564
/* List of pairs (MESSAGE . MULTIBYTE).  The function save_message
   pushes the current message and the value of
   message_enable_multibyte on the stack, the function restore_message
   pops the stack and displays MESSAGE again.  */

Lisp_Object Vmessage_stack;

565 566
/* Nonzero means multibyte characters were enabled when the echo area
   message was specified.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
567

568 569
int message_enable_multibyte;

570
/* Nonzero if we should redraw the mode lines on the next redisplay.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
571

Jim Blandy's avatar
Jim Blandy committed
572 573
int update_mode_lines;

Gerd Moellmann's avatar
Gerd Moellmann committed
574
/* Nonzero if window sizes or contents have changed since last
575
   redisplay that finished.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
576

Jim Blandy's avatar
Jim Blandy committed
577 578
int windows_or_buffers_changed;

579 580 581 582
/* Nonzero means a frame's cursor type has been changed.  */

int cursor_type_changed;

Gerd Moellmann's avatar
Gerd Moellmann committed
583 584 585
/* Nonzero after display_mode_line if %l was used and it displayed a
   line number.  */

586 587 588
int line_number_displayed;

/* Maximum buffer size for which to display line numbers.  */
Gerd Moellmann's avatar
Gerd Moellmann committed
589

590
Lisp_Object Vline_number_display_limit;
Karl Heuer's avatar
Karl Heuer committed
591

592
/* Line width to consider when repositioning for line number display.  */
593

594
static EMACS_INT line_number_display_limit_width;
595

Gerd Moellmann's avatar
Gerd Moellmann committed
596 597 598
/* Number of lines to keep in the message log buffer.  t means
   infinite.  nil means don't log at all.  */

Karl Heuer's avatar
Karl Heuer committed
599
Lisp_Object Vmessage_log_max;
600

601 602 603 604
/* The name of the *Messages* buffer, a string.  */

static Lisp_Object Vmessages_buffer_name;

605 606
/* Current, index 0, and last displayed echo area message.  Either
   buffers from echo_buffers, or nil to indicate no message.  */
607 608 609

Lisp_Object echo_area_buffer[2];

610
/* The buffers referenced from echo_area_buffer.  */
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627

static Lisp_Object echo_buffer[2];

/* A vector saved used in with_area_buffer to reduce consing.  */

static Lisp_Object Vwith_echo_area_save_vector;

/* Non-zero means display_echo_area should display the last echo area
   message again.  Set by redisplay_preserve_echo_area.  */

static int display_last_displayed_message_p;

/* Nonzero if echo area is being used by print; zero if being used by
   message.  */

int message_buf_print;

628 629 630 631 632
/* The symbol `inhibit-menubar-update' and its DEFVAR_BOOL variable.  */

Lisp_Object Qinhibit_menubar_update;
int inhibit_menubar_update;

633 634 635 636 637
/* When evaluating expressions from menu bar items (enable conditions,
   for instance), this is the frame they are being processed for.  */

Lisp_Object Vmenu_updating_frame;

638 639 640
/* Maximum height for resizing mini-windows.  Either a float
   specifying a fraction of the available height, or an integer
   specifying a number of lines.  */
641

642 643 644 645 646 647 648
Lisp_Object Vmax_mini_window_height;

/* Non-zero means messages should be displayed with truncated
   lines instead of being continued.  */

int message_truncate_lines;
Lisp_Object Qmessage_truncate_lines;
649

650
/* Set to 1 in clear_message to make redisplay_internal aware
651
   of an emptied echo area.  */
652 653 654

static int message_cleared_p;

655 656 657
/* How to blink the default frame cursor off.  */
Lisp_Object Vblink_cursor_alist;

Gerd Moellmann's avatar
Gerd Moellmann committed
658 659
/* A scratch glyph row with contents used for generating truncation
   glyphs.  Also used in direct_output_for_insert.  */
660

Gerd Moellmann's avatar
Gerd Moellmann committed
661 662 663
#define MAX_SCRATCH_GLYPHS 100
struct glyph_row scratch_glyph_row;
static struct glyph scratch_glyphs[MAX_SCRATCH_GLYPHS];
664

Gerd Moellmann's avatar
Gerd Moellmann committed
665 666 667 668
/* Ascent and height of the last line processed by move_it_to.  */

static int last_max_ascent, last_height;

669 670 671 672
/* Non-zero if there's a help-echo in the echo area.  */

int help_echo_showing_p;

673 674 675 676 677 678
/* If >= 0, computed, exact values of mode-line and header-line height
   to use in the macros CURRENT_MODE_LINE_HEIGHT and
   CURRENT_HEADER_LINE_HEIGHT.  */

int current_mode_line_height, current_header_line_height;

Gerd Moellmann's avatar
Gerd Moellmann committed
679
/* The maximum distance to look ahead for text properties.  Values
680
   that are too small let us call compute_char_face and similar
Gerd Moellmann's avatar
Gerd Moellmann committed
681 682 683 684 685 686
   functions too often which is expensive.  Values that are too large
   let us call compute_char_face and alike too often because we
   might not be interested in text properties that far away.  */

#define TEXT_PROP_DISTANCE_LIMIT 100

687 688
#if GLYPH_DEBUG

689 690 691 692 693
/* Variables to turn off display optimizations from Lisp.  */

int inhibit_try_window_id, inhibit_try_window_reusing;
int inhibit_try_cursor_movement;

Gerd Moellmann's avatar
Gerd Moellmann committed
694 695 696 697
/* Non-zero means print traces of redisplay if compiled with
   GLYPH_DEBUG != 0.  */

int trace_redisplay_p;
698

699
#endif /* GLYPH_DEBUG */
700

701 702
#ifdef DEBUG_TRACE_MOVE
/* Non-zero means trace with TRACE_MOVE to stderr.  */
703 704 705 706
int trace_move;

#define TRACE_MOVE(x)	if (trace_move) fprintf x; else (void) 0
#else
707
#define TRACE_MOVE(x)	(void) 0
Gerd Moellmann's avatar
Gerd Moellmann committed
708
#endif
709

710 711 712 713
/* Non-zero means automatically scroll windows horizontally to make
   point visible.  */

int automatic_hscrolling_p;
714
Lisp_Object Qauto_hscroll_mode;
715

716 717
/* How close to the margin can point get before the window is scrolled
   horizontally.  */
718
EMACS_INT hscroll_margin;
719 720

/* How much to scroll horizontally when point is inside the above margin.  */
721
Lisp_Object Vhscroll_step;
722

723
/* The variable `resize-mini-windows'.  If nil, don't resize
Eli Zaretskii's avatar
Eli Zaretskii committed
724
   mini-windows.  If t, always resize them to fit the text they
725 726 727 728 729
   display.  If `grow-only', let mini-windows grow only until they
   become empty.  */

Lisp_Object Vresize_mini_windows;

730 731 732 733
/* Buffer being redisplayed -- for redisplay_window_error.  */

struct buffer *displayed_buffer;

734 735 736 737
/* Space between overline and text. */

EMACS_INT overline_margin;

738 739 740 741 742 743
/* Require underline to be at least this many screen pixels below baseline
   This to avoid underline "merging" with the base of letters at small
   font sizes, particularly when x_use_underline_position_properties is on. */

EMACS_INT underline_minimum_offset;

Gerd Moellmann's avatar
Gerd Moellmann committed
744 745 746
/* Value returned from text property handlers (see below).  */

enum prop_handled
747
{
Gerd Moellmann's avatar
Gerd Moellmann committed
748 749 750 751 752
  HANDLED_NORMALLY,
  HANDLED_RECOMPUTE_PROPS,
  HANDLED_OVERLAY_STRING_CONSUMED,
  HANDLED_RETURN
};
753

Gerd Moellmann's avatar
Gerd Moellmann committed
754 755
/* A description of text properties that redisplay is interested
   in.  */
756

Gerd Moellmann's avatar
Gerd Moellmann committed
757 758 759 760
struct props
{
  /* The name of the property.  */
  Lisp_Object *name;
761

Gerd Moellmann's avatar
Gerd Moellmann committed
762 763 764 765 766 767 768 769 770 771 772
  /* A unique index for the property.  */
  enum prop_idx idx;

  /* A handler function called to set up iterator IT from the property
     at IT's current position.  Value is used to steer handle_stop.  */
  enum prop_handled (*handler) P_ ((struct it *it));
};

static enum prop_handled handle_face_prop P_ ((struct it *));
static enum prop_handled handle_invisible_prop P_ ((struct it *));
static enum prop_handled handle_display_prop P_ ((struct it *));
773
static enum prop_handled handle_composition_prop P_ ((struct it *));
Gerd Moellmann's avatar
Gerd Moellmann committed
774 775 776 777 778 779
static enum prop_handled handle_overlay_change P_ ((struct it *));
static enum prop_handled handle_fontified_prop P_ ((struct it *));

/* Properties handled by iterators.  */

static struct props it_props[] =
Karl Heuer's avatar
Karl Heuer committed
780
{
Gerd Moellmann's avatar
Gerd Moellmann committed
781 782 783 784 785 786
  {&Qfontified,		FONTIFIED_PROP_IDX,	handle_fontified_prop},
  /* Handle `face' before `display' because some sub-properties of
     `display' need to know the face.  */
  {&Qface,		FACE_PROP_IDX,		handle_face_prop},
  {&Qdisplay,		DISPLAY_PROP_IDX,	handle_display_prop},
  {&Qinvisible,		INVISIBLE_PROP_IDX,	handle_invisible_prop},
787
  {&Qcomposition,	COMPOSITION_PROP_IDX,	handle_composition_prop},
Gerd Moellmann's avatar
Gerd Moellmann committed
788 789
  {NULL,		0,			NULL}
};
Karl Heuer's avatar
Karl Heuer committed
790

Gerd Moellmann's avatar
Gerd Moellmann committed
791 792
/* Value is the position described by X.  If X is a marker, value is
   the marker_position of X.  Otherwise, value is X.  */
793

Gerd Moellmann's avatar
Gerd Moellmann committed
794
#define COERCE_MARKER(X) (MARKERP ((X)) ? Fmarker_position (X) : (X))
795

Gerd Moellmann's avatar
Gerd Moellmann committed
796
/* Enumeration returned by some move_it_.* functions internally.  */
797

Gerd Moellmann's avatar
Gerd Moellmann committed
798 799 800 801
enum move_it_result
{
  /* Not used.  Undefined value.  */
  MOVE_UNDEFINED,
802

Gerd Moellmann's avatar
Gerd Moellmann committed
803 804
  /* Move ended at the requested buffer position or ZV.  */
  MOVE_POS_MATCH_OR_ZV,
805

Gerd Moellmann's avatar
Gerd Moellmann committed
806 807
  /* Move ended at the requested X pixel position.  */
  MOVE_X_REACHED,
808

Gerd Moellmann's avatar
Gerd Moellmann committed
809 810 811
  /* Move within a line ended at the end of a line that must be
     continued.  */
  MOVE_LINE_CONTINUED,
812

Gerd Moellmann's avatar
Gerd Moellmann committed
813 814 815
  /* Move within a line ended at the end of a line that would
     be displayed truncated.  */
  MOVE_LINE_TRUNCATED,
816

Gerd Moellmann's avatar
Gerd Moellmann committed
817 818 819
  /* Move within a line ended at a line end.  */
  MOVE_NEWLINE_OR_CR
};
820

821 822 823 824 825 826 827 828
/* This counter is used to clear the face cache every once in a while
   in redisplay_internal.  It is incremented for each redisplay.
   Every CLEAR_FACE_CACHE_COUNT full redisplays, the face cache is
   cleared.  */

#define CLEAR_FACE_CACHE_COUNT	500
static int clear_face_cache_count;

829 830 831 832 833 834 835
/* Similarly for the image cache.  */

#ifdef HAVE_WINDOW_SYSTEM
#define CLEAR_IMAGE_CACHE_COUNT	101
static int clear_image_cache_count;
#endif

836 837 838 839
/* Non-zero while redisplay_internal is in progress.  */

int redisplaying_p;

840 841 842
/* Non-zero means don't free realized faces.  Bound while freeing
   realized faces is dangerous because glyph matrices might still
   reference them.  */
843

844 845
int inhibit_free_realized_faces;
Lisp_Object Qinhibit_free_realized_faces;
846

847 848 849 850 851 852 853 854 855 856 857 858
/* If a string, XTread_socket generates an event to display that string.
   (The display is done in read_char.)  */

Lisp_Object help_echo_string;
Lisp_Object help_echo_window;
Lisp_Object help_echo_object;
int help_echo_pos;

/* Temporary variable for XTread_socket.  */

Lisp_Object previous_help_echo_string;

Kim F. Storm's avatar
Kim F. Storm committed
859 860 861
/* Null glyph slice */

static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
862

863 864 865 866 867 868 869 870 871
/* Platform-independent portion of hourglass implementation. */

/* Non-zero means we're allowed to display a hourglass pointer.  */
int display_hourglass_p;

/* Non-zero means an hourglass cursor is currently shown.  */
int hourglass_shown_p;

/* If non-null, an asynchronous timer that, when it expires, displays
872
   an hourglass cursor on all frames.  */
873 874 875
struct atimer *hourglass_atimer;

/* Number of seconds to wait before displaying an hourglass cursor.  */
876
Lisp_Object Vhourglass_delay;
877 878 879 880 881

/* Default number of seconds to wait before displaying an hourglass
   cursor.  */
#define DEFAULT_HOURGLASS_DELAY 1

Gerd Moellmann's avatar
Gerd Moellmann committed
882 883 884

/* Function prototypes.  */

885
static void setup_for_ellipsis P_ ((struct it *, int));
886
static void mark_window_display_accurate_1 P_ ((struct window *, int));
887
static int single_display_spec_string_p P_ ((Lisp_Object, Lisp_Object));
888
static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
Gerd Moellmann's avatar
Gerd Moellmann committed
889
static int cursor_row_p P_ ((struct window *, struct glyph_row *));
890
static int redisplay_mode_lines P_ ((Lisp_Object, int));
891
static char *decode_mode_spec_coding P_ ((Lisp_Object, char *, int));
892

893 894 895 896
static Lisp_Object get_it_property P_ ((struct it *it, Lisp_Object prop));

static void handle_line_prefix P_ ((struct it *));

897
static void pint2str P_ ((char *, int, int));
Kenichi Handa's avatar
Kenichi Handa committed
898
static void pint2hrstr P_ ((char *, int, int));
899 900 901 902
static struct text_pos run_window_scroll_functions P_ ((Lisp_Object,
							struct text_pos));
static void reconsider_clip_changes P_ ((struct window *, struct buffer *));
static int text_outside_line_unchanged_p P_ ((struct window *, int, int));
903 904
static void store_mode_line_noprop_char P_ ((char));
static int store_mode_line_noprop P_ ((const unsigned char *, int, int));
905 906
static void x_consider_frame_title P_ ((Lisp_Object));
static void handle_stop P_ ((struct it *));
907
static int tool_bar_lines_needed P_ ((struct frame *, int *));
908
static int single_display_spec_intangible_p P_ ((Lisp_Object));
909
static void ensure_echo_area_buffers P_ ((void));
910 911
static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *));
912
static int with_echo_area_buffer P_ ((struct window *, int,
913 914
				      int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT),
				      EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
915
static void clear_garbaged_frames P_ ((void));
916 917 918
static int current_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static int truncate_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static int set_message_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
919
static int display_echo_area P_ ((struct window *));
920 921
static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
922
static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
923
static int string_char_and_length P_ ((const unsigned char *, int *));
Gerd Moellmann's avatar
Gerd Moellmann committed
924 925 926
static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
					     struct text_pos));
static int compute_window_start_on_continuation_line P_ ((struct window *));
927
static Lisp_Object safe_eval_handler P_ ((Lisp_Object));
Gerd Moellmann's avatar
Gerd Moellmann committed
928
static void insert_left_trunc_glyphs P_ ((struct it *));
Kenichi Handa's avatar
Kenichi Handa committed
929 930
static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *,
							  Lisp_Object));
Gerd Moellmann's avatar
Gerd Moellmann committed
931
static void extend_face_to_end_of_line P_ ((struct it *));
Kim F. Storm's avatar
Kim F. Storm committed
932
static int append_space_for_newline P_ ((struct it *, int));
933
static int cursor_row_fully_visible_p P_ ((struct window *, int, int));
934
static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int));
935
static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
Gerd Moellmann's avatar
Gerd Moellmann committed
936 937 938 939 940
static int trailing_whitespace_p P_ ((int));
static int message_log_check_duplicate P_ ((int, int, int, int));
static void push_it P_ ((struct it *));
static void pop_it P_ ((struct it *));
static void sync_frame_with_window_matrix_rows P_ ((struct window *));
Kenichi Handa's avatar
Kenichi Handa committed
941
static void select_frame_for_redisplay P_ ((Lisp_Object));
Gerd Moellmann's avatar
Gerd Moellmann committed
942
static void redisplay_internal P_ ((int));
943
static int echo_area_display P_ ((int));
Gerd Moellmann's avatar
Gerd Moellmann committed
944 945
static void redisplay_windows P_ ((Lisp_Object));
static void redisplay_window P_ ((Lisp_Object, int));
946 947 948
static Lisp_Object redisplay_window_error ();
static Lisp_Object redisplay_window_0 P_ ((Lisp_Object));
static Lisp_Object redisplay_window_1 P_ ((Lisp_Object));
949
static int update_menu_bar P_ ((struct frame *, int, int));
Gerd Moellmann's avatar
Gerd Moellmann committed
950 951 952
static int try_window_reusing_current_matrix P_ ((struct window *));
static int try_window_id P_ ((struct window *));
static int display_line P_ ((struct it *));
953
static int display_mode_lines P_ ((struct window *));
954
static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object));
955
static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object, Lisp_Object, int));
956
static int store_mode_line_string P_ ((char *, Lisp_Object, int, int, int, Lisp_Object));
957
static char *decode_mode_spec P_ ((struct window *, int, int, int, int *));
Gerd Moellmann's avatar
Gerd Moellmann committed
958 959 960
static void display_menu_bar P_ ((struct window *));
static int display_count_lines P_ ((int, int, int, int, int *));
static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object,
961
			       EMACS_INT, EMACS_INT, struct it *, int, int, int, int));
Gerd Moellmann's avatar
Gerd Moellmann committed
962 963
static void compute_line_metrics P_ ((struct it *));
static void run_redisplay_end_trigger_hook P_ ((struct it *));
964
static int get_overlay_strings P_ ((struct it *, int));
965
static int get_overlay_strings_1 P_ ((struct it *, int, int));
Gerd Moellmann's avatar
Gerd Moellmann committed
966
static void next_overlay_string P_ ((struct it *));
967 968
static void reseat P_ ((struct it *, struct text_pos, int));
static void reseat_1 P_ ((struct it *, struct text_pos, int));
Gerd Moellmann's avatar
Gerd Moellmann committed
969
static void back_to_previous_visible_line_start P_ ((struct it *));
970
void reseat_at_previous_visible_line_start P_ ((struct it *));
971
static void reseat_at_next_visible_line_start P_ ((struct it *, int));
972
static int next_element_from_ellipsis P_ ((struct it *));
Gerd Moellmann's avatar
Gerd Moellmann committed
973 974 975 976
static int next_element_from_display_vector P_ ((struct it *));
static int next_element_from_string P_ ((struct it *));
static int next_element_from_c_string P_ ((struct it *));
static int next_element_from_buffer P_ ((struct it *));
977
static int next_element_from_composition P_ ((struct it *));
Gerd Moellmann's avatar
Gerd Moellmann committed
978 979
static int next_element_from_image P_ ((struct it *));
static int next_element_from_stretch P_ ((struct it *));
980
static void load_overlay_strings P_ ((struct it *, int));
981 982
static int init_from_display_pos P_ ((struct it *, struct window *,
<