/* Buffer manipulation primitives for GNU Emacs.
-Copyright (C) 1985-1989, 1993-1995, 1997-2013 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2014 Free Software Foundation,
Inc.
This file is part of GNU Emacs.
BUF_END_UNCHANGED (b) = 0;
BUF_BEG_UNCHANGED (b) = 0;
*(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */
- b->text->inhibit_shrinking = 0;
+ b->text->inhibit_shrinking = false;
+ b->text->redisplay = false;
b->newline_cache = 0;
b->width_run_cache = 0;
menu bar menus and the frame title. */)
(Lisp_Object all)
{
- if (!NILP (all) || buffer_window_count (current_buffer))
+ if (!NILP (all))
{
update_mode_lines = 10;
- current_buffer->prevent_redisplay_optimizations_p = 1;
+ /* FIXME: This can't be right. */
+ current_buffer->prevent_redisplay_optimizations_p = true;
+ }
+ else if (buffer_window_count (current_buffer))
+ {
+ bset_update_mode_line (current_buffer);
+ current_buffer->prevent_redisplay_optimizations_p = true;
}
return all;
}
if (b->base_buffer)
{
+ INTERVAL i;
/* Unchain all markers that belong to this indirect buffer.
Don't unchain the markers that belong to the base buffer
or its other indirect buffers. */
else
mp = &m->next;
}
+ /* Intervals should be owned by the base buffer (Bug#16502). */
+ i = buffer_intervals (b);
+ if (i)
+ {
+ Lisp_Object owner;
+ XSETBUFFER (owner, b->base_buffer);
+ set_interval_object (i, owner);
+ }
}
else
{
}
if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV))
- args_out_of_range (*b, *e);
+ args_out_of_range_3 (Fcurrent_buffer (), *b, *e);
}
\f
/* Advance BYTE_POS up to a character boundary
if (narrowed)
error ("Changing multibyteness in a narrowed buffer");
+ invalidate_buffer_caches (current_buffer, BEGV, ZV);
+
if (NILP (flag))
{
ptrdiff_t pos, stop;
}
DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0,
- doc: /* Create a new overlay with range BEG to END in BUFFER.
+ doc: /* Create a new overlay with range BEG to END in BUFFER and return it.
If omitted, BUFFER defaults to the current buffer.
BEG and END may be integers or markers.
The fourth arg FRONT-ADVANCE, if non-nil, makes the marker
BUF_COMPUTE_UNCHANGED (buf, start, end);
- /* If BUF is visible, consider updating the display if ... */
- if (buffer_window_count (buf) > 0)
- {
- /* ... it's visible in other window than selected, */
- if (buf != XBUFFER (XWINDOW (selected_window)->contents))
- windows_or_buffers_changed = 11;
- /* ... or if we modify an overlay at the end of the buffer
- and so we cannot be sure that window end is still valid. */
- else if (end >= ZV && start <= ZV)
- windows_or_buffers_changed = 12;
- }
+ bset_redisplay (buf);
++BUF_OVERLAY_MODIFF (buf);
}
DEFVAR_PER_BUFFER ("cache-long-scans", &BVAR (current_buffer, cache_long_scans), Qnil,
doc: /* Non-nil means that Emacs should use caches in attempt to speedup buffer scans.
+There is no reason to set this to nil except for debugging purposes.
+
Normally, the line-motion functions work by scanning the buffer for
newlines. Columnar operations (like `move-to-column' and
`compute-motion') also work by scanning the buffer, summing character
DEFVAR_PER_BUFFER ("buffer-invisibility-spec",
&BVAR (current_buffer, invisibility_spec), Qnil,
doc: /* Invisibility spec of this buffer.
-The default is t, which means that text is invisible
-if it has a non-nil `invisible' property.
-If the value is a list, a text character is invisible if its `invisible'
-property is an element in that list (or is a list with members in common).
-If an element is a cons cell of the form (PROP . ELLIPSIS),
-then characters with property value PROP are invisible,
-and they have an ellipsis as well if ELLIPSIS is non-nil.
-Setting this variable is very fast, much faster than scanning all the
-text in the buffer looking for properties to change. */);
+The default is t, which means that text is invisible if it has a non-nil
+`invisible' property.
+This variable can also be a list. The list can have two kinds of elements:
+`ATOM' and `(ATOM . ELLIPSIS)'. A text character is invisible if its
+`invisible' property is `ATOM', or has an `invisible' property that is a list
+that contains `ATOM'.
+If the `(ATOM . ELLIPSIS)' form is used, and `ELLIPSIS' is non-nil, an
+ellipsis will be displayed after the invisible characters.
+Setting this variable is very fast, much faster than scanning all the text in
+the buffer looking for properties to change. */);
DEFVAR_PER_BUFFER ("buffer-display-count",
&BVAR (current_buffer, display_count), Qintegerp,