diff options
| author | Dmitry Antipov | 2012-12-10 21:34:47 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-12-10 21:34:47 +0400 |
| commit | 98a07056558be8c13945a3a99b4801996af685a4 (patch) | |
| tree | 657c931f7e1cb73ef5158beda8a429013e3a23cf /src/buffer.h | |
| parent | 2b8c906403908a5037b52bfecb72b65d0ce0cd1e (diff) | |
| download | emacs-98a07056558be8c13945a3a99b4801996af685a4.tar.gz emacs-98a07056558be8c13945a3a99b4801996af685a4.zip | |
Per-buffer window counters.
* buffer.h (struct buffer): New member window_count.
(buffer_window_count): New function.
* buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
Initialize window_count.
(Fkill_buffer): Verify window_count for the buffer being killed.
(modify_overlay): Do not force redisplay if buffer is not shown
in any window.
(init_buffer_once): Initialize window_count for buffer_defaults
and buffer_local_symbols.
* window.h (buffer_shared): Remove declaration.
(wset_buffer): Convert from inline ...
* window.c (wset_buffer): ... to an ordinary function.
(adjust_window_count): New function.
(make_parent_window): Use it.
* xdisp.c (buffer_shared): Remove.
(redisplay_internal, redisplay_window): Adjust users.
(buffer_shared_and_changed): Use per-buffer window counter.
Diffstat (limited to 'src/buffer.h')
| -rw-r--r-- | src/buffer.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/buffer.h b/src/buffer.h index 1129840bd47..d838d3767ef 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -770,11 +770,15 @@ struct buffer | |||
| 770 | In an ordinary buffer, it is 0. */ | 770 | In an ordinary buffer, it is 0. */ |
| 771 | struct buffer *base_buffer; | 771 | struct buffer *base_buffer; |
| 772 | 772 | ||
| 773 | /* In an indirect buffer, this is -1. In an ordinary buffer, | 773 | /* In an indirect buffer, this is -1. In an ordinary buffer, |
| 774 | it's the number of indirect buffers that share our text; | 774 | it's the number of indirect buffers that share our text; |
| 775 | zero means that we're the only owner of this text. */ | 775 | zero means that we're the only owner of this text. */ |
| 776 | int indirections; | 776 | int indirections; |
| 777 | 777 | ||
| 778 | /* Number of windows showing this buffer. Always -1 for | ||
| 779 | an indirect buffer since it counts as its base buffer. */ | ||
| 780 | int window_count; | ||
| 781 | |||
| 778 | /* A non-zero value in slot IDX means that per-buffer variable | 782 | /* A non-zero value in slot IDX means that per-buffer variable |
| 779 | with index IDX has a local value in this buffer. The index IDX | 783 | with index IDX has a local value in this buffer. The index IDX |
| 780 | for a buffer-local variable is stored in that variable's slot | 784 | for a buffer-local variable is stored in that variable's slot |
| @@ -1173,7 +1177,18 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) | |||
| 1173 | + pos + BUF_BEG_ADDR (buf) - BEG_BYTE); | 1177 | + pos + BUF_BEG_ADDR (buf) - BEG_BYTE); |
| 1174 | return STRING_CHAR (p); | 1178 | return STRING_CHAR (p); |
| 1175 | } | 1179 | } |
| 1176 | 1180 | ||
| 1181 | /* Return number of windows showing B. */ | ||
| 1182 | |||
| 1183 | BUFFER_INLINE int | ||
| 1184 | buffer_window_count (struct buffer *b) | ||
| 1185 | { | ||
| 1186 | if (b->base_buffer) | ||
| 1187 | b = b->base_buffer; | ||
| 1188 | eassert (b->window_count >= 0); | ||
| 1189 | return b->window_count; | ||
| 1190 | } | ||
| 1191 | |||
| 1177 | /* Overlays */ | 1192 | /* Overlays */ |
| 1178 | 1193 | ||
| 1179 | /* Return the marker that stands for where OV starts in the buffer. */ | 1194 | /* Return the marker that stands for where OV starts in the buffer. */ |