/* If cursor motion alone moves point off frame,
Try scrolling this many lines up or down if that will bring it back. */
-int scroll_step;
+static int scroll_step;
/* Nonzero if try_window_id has made blank lines at window bottom
since the last redisplay that paused */
static int cursor_vpos;
static int cursor_hpos;
-int debug_end_pos;
+static int debug_end_pos;
/* Nonzero means display mode line highlighted */
int mode_line_inverse_video;
int line_number_displayed;
/* Maximum buffer size for which to display line numbers. */
-int line_number_display_limit;
+static int line_number_display_limit;
/* Number of lines to keep in the message log buffer.
t means infinite. nil means don't log at all. */
oldbuf = current_buffer;
Fset_buffer (Fget_buffer_create (build_string ("*Messages*")));
+ current_buffer->undo_list = Qt;
oldpoint = PT;
oldbegv = BEGV;
oldzv = ZV;
Check to see if the most recent message looks a lot like the previous one.
Return 0 if different, 1 if the new one should just replace it, or a
value N > 1 if we should also append " [N times]". */
+
static int
message_log_check_duplicate (prev_bol, this_bol)
int prev_bol, this_bol;
int i;
int len = Z - 1 - this_bol;
int seen_dots = 0;
- char *p1 = BUF_CHAR_ADDRESS (current_buffer, prev_bol);
- char *p2 = BUF_CHAR_ADDRESS (current_buffer, this_bol);
+ unsigned char *p1 = BUF_CHAR_ADDRESS (current_buffer, prev_bol);
+ unsigned char *p2 = BUF_CHAR_ADDRESS (current_buffer, this_bol);
for (i = 0; i < len; i++)
{
}
}
+/* The non-logging version of that function. */
+void
+message_nolog (m, a1, a2, a3)
+ char *m;
+ EMACS_INT a1, a2, a3;
+{
+ Lisp_Object old_log_max;
+ old_log_max = Vmessage_log_max;
+ Vmessage_log_max = Qnil;
+ message (m, a1, a2, a3);
+ Vmessage_log_max = old_log_max;
+}
+
void
update_echo_area ()
{
0, 0, 0, 0, FRAME_WIDTH (f));
/* If desired cursor location is on this line, put it at end of text */
+ if (cursor_in_echo_area)
+ FRAME_CURSOR_Y (f) = vpos;
if (FRAME_CURSOR_Y (f) == vpos)
FRAME_CURSOR_X (f) = FRAME_DESIRED_GLYPHS (f)->used[vpos];
#endif
\f
/* Prepare for redisplay by updating menu-bar item lists when appropriate.
- This can't be done in `redisplay' itself because it can call eval. */
+ This can call eval. */
void
prepare_menu_bars ()
int all_windows;
struct gcpro gcpro1, gcpro2;
- if (noninteractive)
- return;
-
- /* Set the visible flags for all frames.
- Do this before checking for resized or garbaged frames; they want
- to know if their frames are visible.
- See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */
- {
- Lisp_Object tail, frame;
-
- FOR_EACH_FRAME (tail, frame)
- FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
- }
-
- /* Notice any pending interrupt request to change frame size. */
- do_pending_window_change ();
-
- if (frame_garbaged)
- {
- redraw_garbaged_frames ();
- frame_garbaged = 0;
- }
-
all_windows = (update_mode_lines || buffer_shared > 1
|| clip_changed || windows_or_buffers_changed);
-#ifdef HAVE_X_WINDOWS
- if (windows_or_buffers_changed)
- {
- Lisp_Object tail, frame;
-
- FOR_EACH_FRAME (tail, frame)
- if (FRAME_VISIBLE_P (XFRAME (frame))
- || FRAME_ICONIFIED_P (XFRAME (frame)))
- x_consider_frame_title (frame);
- }
-#endif
-
/* Update the menu bar item lists, if appropriate.
This has to be done before any actual redisplay
or generation of display lines. */
if (FRAME_WINDOW_SIZES_CHANGED (XFRAME (frame)))
{
Lisp_Object functions;
+ /* Clear flag first in case we get error below. */
+ FRAME_WINDOW_SIZES_CHANGED (XFRAME (frame)) = 0;
functions = Vwindow_size_change_functions;
GCPRO2 (tail, functions);
while (CONSP (functions))
functions = XCONS (functions)->cdr;
}
UNGCPRO;
- FRAME_WINDOW_SIZES_CHANGED (XFRAME (frame)) = 0;
}
GCPRO1 (tail);
update_menu_bar (XFRAME (frame));
}
else
update_menu_bar (selected_frame);
+
+ /* Update all frame titles based on their buffer names, etc.
+ We do this after the menu bars so that the frame will first
+ create its menu bar using the name `emacs' if no other name
+ has yet been specified. */
+#ifdef HAVE_X_WINDOWS
+ if (windows_or_buffers_changed)
+ {
+ Lisp_Object tail, frame;
+
+ FOR_EACH_FRAME (tail, frame)
+ if (FRAME_VISIBLE_P (XFRAME (frame))
+ || FRAME_ICONIFIED_P (XFRAME (frame)))
+ x_consider_frame_title (frame);
+ }
+#endif
}
\f
/* Do a frame update, taking possible shortcuts into account.
int all_windows;
register int tlbufpos, tlendpos;
struct position pos;
- extern int input_pending;
if (noninteractive)
return;
Lisp_Object tail, frame;
FOR_EACH_FRAME (tail, frame)
- FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
+ {
+ FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
+
+ /* Clear out all the display lines in which we will generate the
+ glyphs to display. */
+ init_desired_glyphs (XFRAME (frame));
+ }
}
/* Notice any pending interrupt request to change frame size. */
frame_garbaged = 0;
}
+ prepare_menu_bars ();
+
if (clip_changed || windows_or_buffers_changed
|| (!NILP (w->column_number_displayed)
&& XFASTINT (w->column_number_displayed) != current_column ()))
int left = XFASTINT (w->left);
int *charstart_next_line
= FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[this_line_vpos + 1];
- int i;
int adjust;
if (Z - tlendpos == ZV)
}
goto update;
}
- /* If highlighting the region, we can't just move the cursor. */
+ /* If highlighting the region, or if the cursor is in the echo area,
+ then we can't just move the cursor. */
else if (! (!NILP (Vtransient_mark_mode)
&& !NILP (current_buffer->mark_active))
- && NILP (w->region_showing))
+ && NILP (w->region_showing)
+ && !cursor_in_echo_area)
{
pos = *compute_motion (tlbufpos, 0,
XINT (w->hscroll) ? 1 - XINT (w->hscroll) : 0,
continue;
f = XFRAME (XCONS (tail)->car);
- if (FRAME_VISIBLE_P (f))
+
+ if ((! FRAME_TERMCAP_P (f) || f == selected_frame)
+ && FRAME_VISIBLE_P (f))
{
pause |= update_frame (f, 0, 0);
if (!pause)
{
if (FRAME_VISIBLE_P (selected_frame))
pause = update_frame (selected_frame, 0, 0);
+ else
+ pause = 0;
/* We may have called echo_area_display at the top of this
function. If the echo area is on another frame, that may
abort ();
height = window_internal_height (w);
+ update_mode_line = (!NILP (w->update_mode_line) || update_mode_lines);
if (MINI_WINDOW_P (w))
{
}
}
- update_mode_line = (!NILP (w->update_mode_line) || update_mode_lines);
-
/* Otherwise set up data on this window; select its buffer and point value */
if (update_mode_line)
if (XFASTINT (w->last_modified) >= MODIFF
&& PT >= startp && !clip_changed
&& (just_this_one || XFASTINT (w->width) == FRAME_WIDTH (f))
+ /* If force-mode-line-update was called, really redisplay;
+ that's how redisplay is forced after e.g. changing
+ buffer-invisibility-spec. */
+ && NILP (w->update_mode_line)
/* Can't use this case if highlighting a region. */
&& !(!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active))
&& NILP (w->region_showing)
&& !EQ (window, minibuf_window))
{
pos = *compute_motion (startp, 0, (hscroll ? 1 - hscroll : 0),
- PT, height + 1, 10000, width, hscroll,
+ PT, height, 0, width, hscroll,
pos_tab_offset (w, startp), w);
if (pos.vpos < height)
goto scroll_fail;
}
- pos = *vmotion (startp, PT < startp ? - scroll_step : scroll_step,
+ pos = *vmotion (startp,
+ (PT < startp ? - scroll_step : scroll_step),
width, hscroll, window);
if (PT >= pos.bufpos)
|| (w == XWINDOW (minibuf_window) && ! echo_area_glyphs))
{
whole = ZV - BEGV;
- start = startp - BEGV;
+ start = marker_position (w->start) - BEGV;
/* I don't think this is guaranteed to be right. For the
moment, we'll pretend it is. */
end = (Z - XINT (w->window_end_pos)) - BEGV;
/* Find position before which nothing is changed. */
bp = *compute_motion (start, 0, lmargin,
- min (ZV, beg_unchanged + BEG), height + 1, 0,
+ min (ZV, beg_unchanged + BEG), height, 0,
width, hscroll, pos_tab_offset (w, start), w);
if (bp.vpos >= height)
{
- if (PT < bp.bufpos && !bp.contin)
+ if (PT < bp.bufpos)
{
/* All changes are below the frame, and point is on the frame.
We don't need to change the frame at all.
width, hscroll, pos_tab_offset (w, start), w);
XSETFASTINT (w->window_end_vpos, height);
XSETFASTINT (w->window_end_pos, Z - bp.bufpos);
- return 1;
+ goto findpoint;
}
return 0;
}
/* If point was not in a line that was displayed, find it */
if (cursor_vpos < 0)
{
+ findpoint:
val = *compute_motion (start, 0, lmargin, PT, 10000, 10000,
width, hscroll, pos_tab_offset (w, start), w);
/* Admit failure if point is off frame now */
cursor_hpos += XFASTINT (w->left);
if (w == XWINDOW (FRAME_SELECTED_WINDOW (f)))
{
- FRAME_CURSOR_Y (f) = cursor_vpos;
- FRAME_CURSOR_X (f) = cursor_hpos;
+ if (!(cursor_in_echo_area && FRAME_HAS_MINIBUF_P (f)
+ && EQ (FRAME_MINIBUF_WINDOW (f), minibuf_window)))
+ {
+ FRAME_CURSOR_Y (f) = cursor_vpos;
+ FRAME_CURSOR_X (f) = cursor_hpos;
+ }
if (w == XWINDOW (selected_window))
{
w->column_number_displayed = Qnil;
get_display_line (f, vpos, left);
-#ifdef MULTI_KBOARD
- {
- /* Sigh, mode-line-format can reference kboard-local variables like
- defining-kbd-macro. Use the one associated with the frame we're
- updating. */
- KBOARD *orig_kboard = current_kboard;
- current_kboard = FRAME_KBOARD (f);
-#endif
- display_mode_element (w, vpos, left, 0, right, right,
- current_buffer->mode_line_format);
-#ifdef MULTI_KBOARD
- current_kboard = orig_kboard;
- }
-#endif
+
+ /* Temporarily make frame F's kboard the current kboard
+ so that kboard-local variables in the mode_line_format
+ will get the right values. */
+ push_frame_kboard (f);
+
+ display_mode_element (w, vpos, left, 0, right, right,
+ current_buffer->mode_line_format);
+
+ pop_frame_kboard ();
+
FRAME_DESIRED_GLYPHS (f)->bufp[vpos] = 0;
/* Make the mode line inverse video if the entire line
|| XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f))
FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
#ifdef HAVE_FACES
- else if (! FRAME_TERMCAP_P (f))
+ else if (! FRAME_TERMCAP_P (f) && mode_line_inverse_video)
{
/* For a partial width window, explicitly set face of each glyph. */
int i;
switch (c)
{
+ case '*':
+ if (!NILP (b->read_only))
+ return "%";
+ if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
+ return "*";
+ return "-";
+
+ case '+':
+ /* This differs from %* only for a modified read-only buffer. */
+ if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
+ return "*";
+ if (!NILP (b->read_only))
+ return "%";
+ return "-";
+
+ case '&':
+ /* This differs from %* in ignoring read-only-ness. */
+ if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
+ return "*";
+ return "-";
+
+ case '%':
+ return "%";
+
+ case '[':
+ {
+ int i;
+ char *p;
+
+ if (command_loop_level > 5)
+ return "[[[... ";
+ p = decode_mode_spec_buf;
+ for (i = 0; i < command_loop_level; i++)
+ *p++ = '[';
+ *p = 0;
+ return decode_mode_spec_buf;
+ }
+
+ case ']':
+ {
+ int i;
+ char *p;
+
+ if (command_loop_level > 5)
+ return " ...]]]";
+ p = decode_mode_spec_buf;
+ for (i = 0; i < command_loop_level; i++)
+ *p++ = ']';
+ *p = 0;
+ return decode_mode_spec_buf;
+ }
+
+ case '-':
+ {
+ register char *p;
+ register int i;
+
+ if (maxwidth < sizeof (lots_of_dashes))
+ return lots_of_dashes;
+ else
+ {
+ for (p = decode_mode_spec_buf, i = maxwidth; i > 0; i--)
+ *p++ = '-';
+ *p = '\0';
+ }
+ return decode_mode_spec_buf;
+ }
+
case 'b':
obj = b->name;
#if 0
#endif
break;
+ case 'c':
+ {
+ int col = current_column ();
+ XSETFASTINT (w->column_number_displayed, col);
+ sprintf (decode_mode_spec_buf, "%d", col);
+ return decode_mode_spec_buf;
+ }
+
+ case 'F':
+ /* %F displays the frame name. */
+ return (char *) XSTRING (selected_frame->name)->data;
+
case 'f':
obj = b->filename;
#if 0
#endif
break;
- case 'c':
- {
- int col = current_column ();
- XSETFASTINT (w->column_number_displayed, col);
- sprintf (decode_mode_spec_buf, "%d", col);
- return decode_mode_spec_buf;
- }
-
case 'l':
{
int startpos = marker_position (w->start);
return " Narrow";
break;
- case '*':
- if (!NILP (b->read_only))
- return "%";
- if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
- return "*";
- return "-";
-
- case '+':
- /* This differs from %* only for a modified read-only buffer. */
- if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
- return "*";
- if (!NILP (b->read_only))
- return "%";
- return "-";
-
- case '&':
- /* This differs from %* in ignoring read-only-ness. */
- if (BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
- return "*";
- return "-";
-
- case 's':
- /* status of process */
- obj = Fget_buffer_process (w->buffer);
- if (NILP (obj))
- return "no process";
-#ifdef subprocesses
- obj = Fsymbol_name (Fprocess_status (obj));
-#endif
- break;
-
- case 't': /* indicate TEXT or BINARY */
-#ifdef MODE_LINE_BINARY_TEXT
- return MODE_LINE_BINARY_TEXT (b);
-#else
- return "T";
-#endif
-
case 'p':
{
int pos = marker_position (w->start);
}
}
- case '%':
- return "%";
-
- case '[':
- {
- int i;
- char *p;
-
- if (command_loop_level > 5)
- return "[[[... ";
- p = decode_mode_spec_buf;
- for (i = 0; i < command_loop_level; i++)
- *p++ = '[';
- *p = 0;
- return decode_mode_spec_buf;
- }
-
- case ']':
- {
- int i;
- char *p;
-
- if (command_loop_level > 5)
- return " ...]]]";
- p = decode_mode_spec_buf;
- for (i = 0; i < command_loop_level; i++)
- *p++ = ']';
- *p = 0;
- return decode_mode_spec_buf;
- }
+ case 's':
+ /* status of process */
+ obj = Fget_buffer_process (w->buffer);
+ if (NILP (obj))
+ return "no process";
+#ifdef subprocesses
+ obj = Fsymbol_name (Fprocess_status (obj));
+#endif
+ break;
- case '-':
- {
- register char *p;
- register int i;
-
- if (maxwidth < sizeof (lots_of_dashes))
- return lots_of_dashes;
- else
- {
- for (p = decode_mode_spec_buf, i = maxwidth; i > 0; i--)
- *p++ = '-';
- *p = '\0';
- }
- return decode_mode_spec_buf;
- }
+ case 't': /* indicate TEXT or BINARY */
+#ifdef MODE_LINE_BINARY_TEXT
+ return MODE_LINE_BINARY_TEXT (b);
+#else
+ return "T";
+#endif
}
if (STRINGP (obj))