/* Header file for the buffer manipulation primitives.
-Copyright (C) 1985-1986, 1993-1995, 1997-2012
- Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993-1995, 1997-2013 Free Software Foundation,
+Inc.
This file is part of GNU Emacs.
/* FIXME: should we move this into ->text->auto_save_modiff? */
#define BUF_AUTOSAVE_MODIFF(buf) ((buf)->auto_save_modified)
+/* Compaction count. */
+#define BUF_COMPACT(buf) ((buf)->text->compact)
+
/* Marker chain of buffer. */
#define BUF_MARKERS(buf) ((buf)->text->markers)
#define BUF_BYTES_MAX \
(ptrdiff_t) min (MOST_POSITIVE_FIXNUM - 1, min (SIZE_MAX, PTRDIFF_MAX))
+/* Maximum gap size after compact_buffer, in bytes. Also
+ used in make_gap_larger to get some extra reserved space. */
+
+#define GAP_BYTES_DFL 2000
+
+/* Minimum gap size after compact_buffer, in bytes. Also
+ used in make_gap_smaller to avoid too small gap size. */
+
+#define GAP_BYTES_MIN 20
+
/* Return the address of byte position N in current buffer. */
#define BYTE_POS_ADDR(n) \
In an ordinary buffer, it is 0. */
struct buffer *base_buffer;
- /* In an indirect buffer, this is -1. In an ordinary buffer,
+ /* In an indirect buffer, this is -1. In an ordinary buffer,
it's the number of indirect buffers that share our text;
zero means that we're the only owner of this text. */
int indirections;
+ /* Number of windows showing this buffer. Always -1 for
+ an indirect buffer since it counts as its base buffer. */
+ int window_count;
+
/* A non-zero value in slot IDX means that per-buffer variable
with index IDX has a local value in this buffer. The index IDX
for a buffer-local variable is stored in that variable's slot
#define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name)))
+/* Convenient check whether buffer B is hidden (i.e. its name
+ starts with a space). Caller must ensure that B is live. */
+
+#define BUFFER_HIDDEN_P(b) (SREF (BVAR (b, name), 0) == ' ')
+
/* Verify indirection counters. */
#define BUFFER_CHECK_INDIRECTION(b) \
+ pos + BUF_BEG_ADDR (buf) - BEG_BYTE);
return STRING_CHAR (p);
}
-\f
+
+/* Return number of windows showing B. */
+
+BUFFER_INLINE int
+buffer_window_count (struct buffer *b)
+{
+ if (b->base_buffer)
+ b = b->base_buffer;
+ eassert (b->window_count >= 0);
+ return b->window_count;
+}
+
/* Overlays */
/* Return the marker that stands for where OV starts in the buffer. */