diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2012-08-08 18:47:11 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2012-08-08 18:47:11 +0400 |
commit | 4cb3e6b38ac6c50279474db0e87a52253af52f59 (patch) | |
tree | 3a4af4b3aa9291bea206fd76f729a2bda4c93c58 /src/buffer.h | |
parent | d9f9b465414c4c345574d9f179808380751c070e (diff) | |
download | emacs-4cb3e6b38ac6c50279474db0e87a52253af52f59.tar.gz |
Inline functions to examine and change buffer overlays.
* buffer.c (unchain_both): New function.
* buffer.h (buffer_get_overlays, buffer_set_overlays):
(buffer_has_overlays): New function.
(enum overlay_type): New enum.
* alloc.c, buffer.c, editfns.c, fileio.c, indent.c:
* insdel.c, intervals.c, print.c, xdisp.c: Adjust users.
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h index 986df8e6d32..a52ca7193e4 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -945,6 +945,52 @@ extern void mmap_set_vars (int); } \ } while (0) +enum overlay_type +{ + OV_BEFORE, + OV_AFTER +}; + +/* Get overlay list of type T and belonging to B. */ + +BUFFER_INLINE struct Lisp_Overlay * +buffer_get_overlays (struct buffer *b, enum overlay_type t) +{ + if (!b) + b = current_buffer; + if (t == OV_BEFORE) + return b->overlays_before; + else if (t == OV_AFTER) + return b->overlays_after; + else + abort (); +} + +/* Set overlay list of type T as belonging to B. */ + +BUFFER_INLINE void +buffer_set_overlays (struct buffer *b, struct Lisp_Overlay *o, + enum overlay_type t) +{ + if (!b) + b = current_buffer; + if (t == OV_BEFORE) + b->overlays_before = o; + else if (t == OV_AFTER) + b->overlays_after = o; + else + abort (); +} + +/* Non-zero if current buffer has overlays. */ + +BUFFER_INLINE int +buffer_has_overlays (void) +{ + return buffer_get_overlays (current_buffer, OV_BEFORE) + || buffer_get_overlays (current_buffer, OV_AFTER); +} + extern Lisp_Object Qbefore_change_functions; extern Lisp_Object Qafter_change_functions; extern Lisp_Object Qfirst_change_hook; |