aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 1b54160d525..654c0da2713 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -38,6 +38,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
38#define min(a, b) ((a) < (b) ? (a) : (b)) 38#define min(a, b) ((a) < (b) ? (a) : (b))
39#define max(a, b) ((a) > (b) ? (a) : (b)) 39#define max(a, b) ((a) > (b) ? (a) : (b))
40 40
41extern void insert_from_buffer ();
42
41/* Some static data, and a function to initialize it for each run */ 43/* Some static data, and a function to initialize it for each run */
42 44
43Lisp_Object Vsystem_name; 45Lisp_Object Vsystem_name;
@@ -1055,7 +1057,7 @@ They default to the beginning and the end of BUFFER.")
1055 (buf, b, e) 1057 (buf, b, e)
1056 Lisp_Object buf, b, e; 1058 Lisp_Object buf, b, e;
1057{ 1059{
1058 register int beg, end, temp, len, opoint, start; 1060 register int beg, end, temp;
1059 register struct buffer *bp; 1061 register struct buffer *bp;
1060 Lisp_Object buffer; 1062 Lisp_Object buffer;
1061 1063
@@ -1082,36 +1084,10 @@ They default to the beginning and the end of BUFFER.")
1082 if (beg > end) 1084 if (beg > end)
1083 temp = beg, beg = end, end = temp; 1085 temp = beg, beg = end, end = temp;
1084 1086
1085 /* Move the gap or create enough gap in the current buffer. */ 1087 if (!(BUF_BEGV (bp) <= beg && end <= BUF_ZV (bp)))
1086
1087 if (point != GPT)
1088 move_gap (point);
1089 if (GAP_SIZE < end - beg)
1090 make_gap (end - beg - GAP_SIZE);
1091
1092 len = end - beg;
1093 start = beg;
1094 opoint = point;
1095
1096 if (!(BUF_BEGV (bp) <= beg
1097 && beg <= end
1098 && end <= BUF_ZV (bp)))
1099 args_out_of_range (b, e); 1088 args_out_of_range (b, e);
1100 1089
1101 /* Now the actual insertion will not do any gap motion, 1090 insert_from_buffer (bp, beg, end - beg, 0);
1102 so it matters not if BUF is the current buffer. */
1103 if (beg < BUF_GPT (bp))
1104 {
1105 insert (BUF_CHAR_ADDRESS (bp, beg), min (end, BUF_GPT (bp)) - beg);
1106 beg = min (end, BUF_GPT (bp));
1107 }
1108 if (beg < end)
1109 insert (BUF_CHAR_ADDRESS (bp, beg), end - beg);
1110
1111 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
1112 graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len),
1113 opoint, len, current_buffer, 0);
1114
1115 return Qnil; 1091 return Qnil;
1116} 1092}
1117 1093