X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/41d25268172048b91c4af05bc80b392838ef6036..7f59302aef3e384cfca55b03490a1542060e821c:/src/xdisp.c diff --git a/src/xdisp.c b/src/xdisp.c index 151d998011..d22c9a53bc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7,7 +7,7 @@ This file is part of GNU Emacs. GNU Emacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) +the Free Software Foundation; either version 3, or (at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, @@ -6269,7 +6269,7 @@ next_element_from_buffer (it) it->c = *p, it->len = 1; /* Record what we have and where it came from. */ - it->what = IT_CHARACTER;; + it->what = IT_CHARACTER; it->object = it->w->buffer; it->position = it->current.pos; @@ -7087,18 +7087,22 @@ move_it_by_lines (it, dvpos, need_y_p) { struct position pos; - if (!FRAME_WINDOW_P (it->f)) + /* The commented-out optimization uses vmotion on terminals. This + gives bad results, because elements like it->what, on which + callers such as pos_visible_p rely, aren't updated. */ + /* if (!FRAME_WINDOW_P (it->f)) { struct text_pos textpos; - /* We can use vmotion on frames without proportional fonts. */ pos = *vmotion (IT_CHARPOS (*it), dvpos, it->w); SET_TEXT_POS (textpos, pos.bufpos, pos.bytepos); reseat (it, textpos, 1); it->vpos += pos.vpos; it->current_y += pos.vpos; } - else if (dvpos == 0) + else */ + + if (dvpos == 0) { /* DVPOS == 0 means move to the start of the screen line. */ move_it_vertically_backward (it, 0); @@ -9365,7 +9369,7 @@ update_tool_bar (f, save_match_data) struct frame *f; int save_match_data; { -#ifdef USE_GTK +#if defined (USE_GTK) || USE_MAC_TOOLBAR int do_update = FRAME_EXTERNAL_TOOL_BAR (f); #else int do_update = WINDOWP (f->tool_bar_window) @@ -9831,7 +9835,7 @@ redisplay_tool_bar (f) struct it it; struct glyph_row *row; -#ifdef USE_GTK +#if defined (USE_GTK) || USE_MAC_TOOLBAR if (FRAME_EXTERNAL_TOOL_BAR (f)) update_frame_tool_bar (f); return 0; @@ -10836,7 +10840,7 @@ redisplay_internal (preserve_echo_area) int must_finish = 0; struct text_pos tlbufpos, tlendpos; int number_of_visible_frames; - int count; + int count, count1; struct frame *sf; int polling_stopped_here = 0; @@ -10974,6 +10978,10 @@ redisplay_internal (preserve_echo_area) update_mode_lines++; } + /* Avoid invocation of point motion hooks by `current_column' below. */ + count1 = SPECPDL_INDEX (); + specbind (Qinhibit_point_motion_hooks, Qt); + /* If %c is in the mode line, update it if needed. */ if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case @@ -10985,6 +10993,8 @@ redisplay_internal (preserve_echo_area) != (int) current_column ())) /* iftc */ w->update_mode_line = Qt; + unbind_to (count1, Qnil); + FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1; /* The variable buffer_shared is set in redisplay_window and @@ -13461,7 +13471,7 @@ redisplay_window (window, just_this_one_p) display_menu_bar (w); #ifdef HAVE_WINDOW_SYSTEM -#ifdef USE_GTK +#if defined (USE_GTK) || USE_MAC_TOOLBAR redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f); #else redisplay_tool_bar_p = WINDOWP (f->tool_bar_window) @@ -13514,7 +13524,10 @@ redisplay_window (window, just_this_one_p) /* Restore current_buffer and value of point in it. */ TEMP_SET_PT_BOTH (CHARPOS (opoint), BYTEPOS (opoint)); set_buffer_internal_1 (old); - TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); + /* Avoid an abort in TEMP_SET_PT_BOTH if the buffer has become + shorter. This can be caused by log truncation in *Messages*. */ + if (CHARPOS (lpoint) <= ZV) + TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); unbind_to (count, Qnil); } @@ -17336,7 +17349,7 @@ are the selected window and the window's buffer). */) CHECK_BUFFER (buffer); if (NILP (format)) - return build_string (""); + return empty_unibyte_string; if (no_props) face = Qnil; @@ -17394,7 +17407,7 @@ are the selected window and the window's buffer). */) { mode_line_string_list = Fnreverse (mode_line_string_list); str = Fmapconcat (intern ("identity"), mode_line_string_list, - make_string ("", 0)); + empty_unibyte_string); } unbind_to (count, Qnil); @@ -17988,6 +18001,16 @@ decode_mode_spec (w, c, field_width, precision, multibyte) #endif break; + case '@': + { + Lisp_Object val; + val = call1 (intern ("file-remote-p"), current_buffer->directory); + if (NILP (val)) + return "-"; + else + return "@"; + } + case 't': /* indicate TEXT or BINARY */ #ifdef MODE_LINE_BINARY_TEXT return MODE_LINE_BINARY_TEXT (b); @@ -18412,6 +18435,27 @@ invisible_p (propval, list) return 0; } +DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0, + doc: /* Non-nil if the property makes the text invisible. +POS-OR-PROP can be a marker or number, in which case it is taken to be +a position in the current buffer and the value of the `invisible' property +is checked; or it can be some other value, which is then presumed to be the +value of the `invisible' property of the text of interest. +The non-nil value returned can be t for truly invisible text or something +else if the text is replaced by an ellipsis. */) + (pos_or_prop) + Lisp_Object pos_or_prop; +{ + Lisp_Object prop + = (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop) + ? Fget_char_property (pos_or_prop, Qinvisible, Qnil) + : pos_or_prop); + int invis = TEXT_PROP_MEANS_INVISIBLE (prop); + return (invis == 0 ? Qnil + : invis == 1 ? Qt + : make_number (invis)); +} + /* Calculate a width or height in pixels from a specification using the following elements: @@ -23783,6 +23827,7 @@ syms_of_xdisp () defsubr (&Slookup_image_map); #endif defsubr (&Sformat_mode_line); + defsubr (&Sinvisible_p); staticpro (&Qmenu_bar_update_hook); Qmenu_bar_update_hook = intern ("menu-bar-update-hook"); @@ -24075,7 +24120,7 @@ and is used only on frames for which no explicit name has been set = Vframe_title_format = Fcons (intern ("multiple-frames"), Fcons (build_string ("%b"), - Fcons (Fcons (empty_string, + Fcons (Fcons (empty_unibyte_string, Fcons (intern ("invocation-name"), Fcons (build_string ("@"), Fcons (intern ("system-name"), @@ -24131,7 +24176,7 @@ unselects the minibuffer if it is active. */); This dynamically changes the tool-bar's height to the minimum height that is needed to make all tool-bar items visible. If value is `grow-only', the tool-bar's height is only increased -automatically; to decreace the tool-bar height, use \\[recenter]. */); +automatically; to decrease the tool-bar height, use \\[recenter]. */); Vauto_resize_tool_bars = Qt; DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p,