Mercurial > emacs
changeset 9657:0fc126c193e7
(Finsert_buffer_substring): Use insert_from_buffer instead of insert.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sat, 22 Oct 1994 04:46:14 +0000 |
parents | e6cb99e4370c |
children | 4e0d87055e0c |
files | src/editfns.c |
diffstat | 1 files changed, 5 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/editfns.c Sat Oct 22 04:45:57 1994 +0000 +++ b/src/editfns.c Sat Oct 22 04:46:14 1994 +0000 @@ -38,6 +38,8 @@ #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) +extern void insert_from_buffer (); + /* Some static data, and a function to initialize it for each run */ Lisp_Object Vsystem_name; @@ -1055,7 +1057,7 @@ (buf, b, e) Lisp_Object buf, b, e; { - register int beg, end, temp, len, opoint, start; + register int beg, end, temp; register struct buffer *bp; Lisp_Object buffer; @@ -1082,36 +1084,10 @@ if (beg > end) temp = beg, beg = end, end = temp; - /* Move the gap or create enough gap in the current buffer. */ - - if (point != GPT) - move_gap (point); - if (GAP_SIZE < end - beg) - make_gap (end - beg - GAP_SIZE); - - len = end - beg; - start = beg; - opoint = point; - - if (!(BUF_BEGV (bp) <= beg - && beg <= end - && end <= BUF_ZV (bp))) + if (!(BUF_BEGV (bp) <= beg && end <= BUF_ZV (bp))) args_out_of_range (b, e); - /* Now the actual insertion will not do any gap motion, - so it matters not if BUF is the current buffer. */ - if (beg < BUF_GPT (bp)) - { - insert (BUF_CHAR_ADDRESS (bp, beg), min (end, BUF_GPT (bp)) - beg); - beg = min (end, BUF_GPT (bp)); - } - if (beg < end) - insert (BUF_CHAR_ADDRESS (bp, beg), end - beg); - - /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ - graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len), - opoint, len, current_buffer, 0); - + insert_from_buffer (bp, beg, end - beg, 0); return Qnil; }