X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/3c4ca7155293ffc2d04708007131bcbc882d8913..d5e5e7b41166815a843148f2081d19bc14b628b2:/src/buffer.h?ds=sidebyside diff --git a/src/buffer.h b/src/buffer.h index fbbbf1b843..a8769fd339 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -193,6 +193,9 @@ INLINE_HEADER_BEGIN /* 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) @@ -770,11 +773,15 @@ struct buffer 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 @@ -982,6 +989,11 @@ bset_width_table (struct buffer *b, Lisp_Object val) #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) \ @@ -1168,7 +1180,18 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) + pos + BUF_BEG_ADDR (buf) - BEG_BYTE); return STRING_CHAR (p); } - + +/* 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. */