diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2012-07-27 06:47:07 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2012-07-27 06:47:07 +0400 |
commit | 6195f3845db9aa785e644f55c86270788b293740 (patch) | |
tree | 7c3d2d715fdf0edb4789e736d42ad3b893c73ef9 /src/marker.c | |
parent | 562157c814037dcba58a20cd6908a95992c22283 (diff) | |
download | emacs-6195f3845db9aa785e644f55c86270788b293740.tar.gz |
Fast save_excursion_save and save_excursion_restore.
* lisp.h (struct Lisp_Excursion): New data type.
(PVEC_EXCURSION): New pseudovector type.
(XEXCURSION, XSETEXCURSION, EXCURSIONP): Convenient macros
to deal with it. Adjust comments.
(init_marker, attach_marker): New prototype.
(unchain_marker): Adjust prototype.
* marker.c (attach_marker): Change to global.
(init_marker): New function.
* alloc.c (Fmake_marker, build_marker): Use it.
(build_marker): More easserts.
(mark_object): Handle struct Lisp_Excursion.
* editfns.c (save_excursion_save, save_excursion_restore):
Reimplement to use struct Lisp_Excursion. Add comments.
Diffstat (limited to 'src/marker.c')
-rw-r--r-- | src/marker.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/marker.c b/src/marker.c index 0a93f4c180f..d63947d8c31 100644 --- a/src/marker.c +++ b/src/marker.c @@ -425,9 +425,28 @@ Returns nil if MARKER points nowhere. */) return Qnil; } +/* Initialize just allocated Lisp_Marker. */ + +void +init_marker (struct Lisp_Marker *m, struct buffer *b, + ptrdiff_t charpos, ptrdiff_t bytepos, int type) +{ + m->buffer = b; + m->charpos = charpos; + m->bytepos = bytepos; + m->insertion_type = type; + if (b) + { + m->next = BUF_MARKERS (b); + BUF_MARKERS (b) = m; + } + else + m->next = NULL; +} + /* Change M so it points to B at CHARPOS and BYTEPOS. */ -static inline void +void attach_marker (struct Lisp_Marker *m, struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) { |