aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 695d71c6c94..88f96c41a15 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3641,6 +3641,33 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
3641 return val; 3641 return val;
3642} 3642}
3643 3643
3644/* Return a newly allocated marker which points into BUF
3645 at character position CHARPOS and byte position BYTEPOS. */
3646
3647Lisp_Object
3648build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos)
3649{
3650 Lisp_Object obj;
3651 struct Lisp_Marker *m;
3652
3653 /* No dead buffers here. */
3654 eassert (!NILP (BVAR (buf, name)));
3655
3656 /* Every character is at least one byte. */
3657 eassert (charpos <= bytepos);
3658
3659 obj = allocate_misc ();
3660 XMISCTYPE (obj) = Lisp_Misc_Marker;
3661 m = XMARKER (obj);
3662 m->buffer = buf;
3663 m->charpos = charpos;
3664 m->bytepos = bytepos;
3665 m->insertion_type = 0;
3666 m->next = BUF_MARKERS (buf);
3667 BUF_MARKERS (buf) = m;
3668 return obj;
3669}
3670
3644/* Put MARKER back on the free list after using it temporarily. */ 3671/* Put MARKER back on the free list after using it temporarily. */
3645 3672
3646void 3673void