aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorStefan Monnier2010-07-23 17:23:09 +0200
committerStefan Monnier2010-07-23 17:23:09 +0200
commit0ee81a0ce066375eac701c06cdfbdebefe594fdc (patch)
treef0dccd24163316cfe688f927681a3032a9b1fe2f /src/buffer.c
parent894e369ddf48e191638b8e66ce732f24ff9abe2a (diff)
parent94da839793affa2a270bc26cee9c4d95d4dc4708 (diff)
downloademacs-0ee81a0ce066375eac701c06cdfbdebefe594fdc.tar.gz
emacs-0ee81a0ce066375eac701c06cdfbdebefe594fdc.zip
Merge from trunk
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c378
1 files changed, 130 insertions, 248 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e907c295e8d..bfef1c369ef 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -106,13 +106,13 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
106int last_per_buffer_idx; 106int last_per_buffer_idx;
107 107
108EXFUN (Fset_buffer, 1); 108EXFUN (Fset_buffer, 1);
109void set_buffer_internal P_ ((struct buffer *b)); 109void set_buffer_internal (struct buffer *b);
110void set_buffer_internal_1 P_ ((struct buffer *b)); 110void set_buffer_internal_1 (struct buffer *b);
111static void call_overlay_mod_hooks P_ ((Lisp_Object list, Lisp_Object overlay, 111static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
112 int after, Lisp_Object arg1, 112 int after, Lisp_Object arg1,
113 Lisp_Object arg2, Lisp_Object arg3)); 113 Lisp_Object arg2, Lisp_Object arg3);
114static void swap_out_buffer_local_variables P_ ((struct buffer *b)); 114static void swap_out_buffer_local_variables (struct buffer *b);
115static void reset_buffer_local_variables P_ ((struct buffer *b, int permanent_too)); 115static void reset_buffer_local_variables (struct buffer *b, int permanent_too);
116 116
117/* Alist of all buffer names vs the buffers. */ 117/* Alist of all buffer names vs the buffers. */
118/* This used to be a variable, but is no longer, 118/* This used to be a variable, but is no longer,
@@ -168,20 +168,19 @@ Lisp_Object Qmodification_hooks;
168Lisp_Object Qinsert_in_front_hooks; 168Lisp_Object Qinsert_in_front_hooks;
169Lisp_Object Qinsert_behind_hooks; 169Lisp_Object Qinsert_behind_hooks;
170 170
171static void alloc_buffer_text P_ ((struct buffer *, size_t)); 171static void alloc_buffer_text (struct buffer *, size_t);
172static void free_buffer_text P_ ((struct buffer *b)); 172static void free_buffer_text (struct buffer *b);
173static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *)); 173static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
174static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT)); 174static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT);
175static Lisp_Object buffer_lisp_local_variables P_ ((struct buffer *)); 175static Lisp_Object buffer_lisp_local_variables (struct buffer *);
176 176
177extern char * emacs_strerror P_ ((int)); 177extern char * emacs_strerror (int);
178 178
179/* For debugging; temporary. See set_buffer_internal. */ 179/* For debugging; temporary. See set_buffer_internal. */
180/* Lisp_Object Qlisp_mode, Vcheck_symbol; */ 180/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
181 181
182void 182void
183nsberror (spec) 183nsberror (Lisp_Object spec)
184 Lisp_Object spec;
185{ 184{
186 if (STRINGP (spec)) 185 if (STRINGP (spec))
187 error ("No buffer named %s", SDATA (spec)); 186 error ("No buffer named %s", SDATA (spec));
@@ -191,8 +190,7 @@ nsberror (spec)
191DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, 190DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
192 doc: /* Return non-nil if OBJECT is a buffer which has not been killed. 191 doc: /* Return non-nil if OBJECT is a buffer which has not been killed.
193Value is nil if OBJECT is not a buffer or if it has been killed. */) 192Value is nil if OBJECT is not a buffer or if it has been killed. */)
194 (object) 193 (Lisp_Object object)
195 Lisp_Object object;
196{ 194{
197 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) 195 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name))
198 ? Qt : Qnil); 196 ? Qt : Qnil);
@@ -203,8 +201,7 @@ DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0,
203If the optional arg FRAME is a frame, we return the buffer list 201If the optional arg FRAME is a frame, we return the buffer list
204in the proper order for that frame: the buffers in FRAME's `buffer-list' 202in the proper order for that frame: the buffers in FRAME's `buffer-list'
205frame parameter come first, followed by the rest of the buffers. */) 203frame parameter come first, followed by the rest of the buffers. */)
206 (frame) 204 (Lisp_Object frame)
207 Lisp_Object frame;
208{ 205{
209 Lisp_Object general; 206 Lisp_Object general;
210 general = Fmapcar (Qcdr, Vbuffer_alist); 207 general = Fmapcar (Qcdr, Vbuffer_alist);
@@ -248,9 +245,7 @@ frame parameter come first, followed by the rest of the buffers. */)
248 and don't ever QUIT. */ 245 and don't ever QUIT. */
249 246
250static Lisp_Object 247static Lisp_Object
251assoc_ignore_text_properties (key, list) 248assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list)
252 register Lisp_Object key;
253 Lisp_Object list;
254{ 249{
255 register Lisp_Object tail; 250 register Lisp_Object tail;
256 for (tail = list; CONSP (tail); tail = XCDR (tail)) 251 for (tail = list; CONSP (tail); tail = XCDR (tail))
@@ -269,8 +264,7 @@ DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0,
269BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME 264BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME
270is a string and there is no buffer with that name, return nil. If 265is a string and there is no buffer with that name, return nil. If
271BUFFER-OR-NAME is a buffer, return it as given. */) 266BUFFER-OR-NAME is a buffer, return it as given. */)
272 (buffer_or_name) 267 (register Lisp_Object buffer_or_name)
273 register Lisp_Object buffer_or_name;
274{ 268{
275 if (BUFFERP (buffer_or_name)) 269 if (BUFFERP (buffer_or_name))
276 return buffer_or_name; 270 return buffer_or_name;
@@ -284,8 +278,7 @@ DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0,
284The buffer's `buffer-file-name' must match exactly the expansion of FILENAME. 278The buffer's `buffer-file-name' must match exactly the expansion of FILENAME.
285If there is no such live buffer, return nil. 279If there is no such live buffer, return nil.
286See also `find-buffer-visiting'. */) 280See also `find-buffer-visiting'. */)
287 (filename) 281 (register Lisp_Object filename)
288 register Lisp_Object filename;
289{ 282{
290 register Lisp_Object tail, buf, tem; 283 register Lisp_Object tail, buf, tem;
291 Lisp_Object handler; 284 Lisp_Object handler;
@@ -312,8 +305,7 @@ See also `find-buffer-visiting'. */)
312} 305}
313 306
314Lisp_Object 307Lisp_Object
315get_truename_buffer (filename) 308get_truename_buffer (register Lisp_Object filename)
316 register Lisp_Object filename;
317{ 309{
318 register Lisp_Object tail, buf, tem; 310 register Lisp_Object tail, buf, tem;
319 311
@@ -341,8 +333,7 @@ buffer does not keep undo information.
341 333
342If BUFFER-OR-NAME is a buffer instead of a string, return it as given, 334If BUFFER-OR-NAME is a buffer instead of a string, return it as given,
343even if it is dead. The return value is never nil. */) 335even if it is dead. The return value is never nil. */)
344 (buffer_or_name) 336 (register Lisp_Object buffer_or_name)
345 register Lisp_Object buffer_or_name;
346{ 337{
347 register Lisp_Object buffer, name; 338 register Lisp_Object buffer, name;
348 register struct buffer *b; 339 register struct buffer *b;
@@ -437,9 +428,7 @@ even if it is dead. The return value is never nil. */)
437 LIST, but for buffer B. */ 428 LIST, but for buffer B. */
438 429
439static struct Lisp_Overlay * 430static struct Lisp_Overlay *
440copy_overlays (b, list) 431copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
441 struct buffer *b;
442 struct Lisp_Overlay *list;
443{ 432{
444 Lisp_Object buffer; 433 Lisp_Object buffer;
445 struct Lisp_Overlay *result = NULL, *tail = NULL; 434 struct Lisp_Overlay *result = NULL, *tail = NULL;
@@ -489,8 +478,7 @@ copy_overlays (b, list)
489 copied. */ 478 copied. */
490 479
491static void 480static void
492clone_per_buffer_values (from, to) 481clone_per_buffer_values (struct buffer *from, struct buffer *to)
493 struct buffer *from, *to;
494{ 482{
495 Lisp_Object to_buffer; 483 Lisp_Object to_buffer;
496 int offset; 484 int offset;
@@ -521,7 +509,7 @@ clone_per_buffer_values (from, to)
521 PER_BUFFER_VALUE (to, offset) = obj; 509 PER_BUFFER_VALUE (to, offset) = obj;
522 } 510 }
523 511
524 bcopy (from->local_flags, to->local_flags, sizeof to->local_flags); 512 memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
525 513
526 to->overlays_before = copy_overlays (to, from->overlays_before); 514 to->overlays_before = copy_overlays (to, from->overlays_before);
527 to->overlays_after = copy_overlays (to, from->overlays_after); 515 to->overlays_after = copy_overlays (to, from->overlays_after);
@@ -540,8 +528,7 @@ NAME should be a string which is not the name of an existing buffer.
540Optional argument CLONE non-nil means preserve BASE-BUFFER's state, 528Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
541such as major and minor modes, in the indirect buffer. 529such as major and minor modes, in the indirect buffer.
542CLONE nil means the indirect buffer's state is reset to default values. */) 530CLONE nil means the indirect buffer's state is reset to default values. */)
543 (base_buffer, name, clone) 531 (Lisp_Object base_buffer, Lisp_Object name, Lisp_Object clone)
544 Lisp_Object base_buffer, name, clone;
545{ 532{
546 Lisp_Object buf, tem; 533 Lisp_Object buf, tem;
547 struct buffer *b; 534 struct buffer *b;
@@ -658,8 +645,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
658} 645}
659 646
660void 647void
661delete_all_overlays (b) 648delete_all_overlays (struct buffer *b)
662 struct buffer *b;
663{ 649{
664 Lisp_Object overlay; 650 Lisp_Object overlay;
665 651
@@ -689,8 +675,7 @@ delete_all_overlays (b)
689 claims it doesn't belong to it. */ 675 claims it doesn't belong to it. */
690 676
691void 677void
692reset_buffer (b) 678reset_buffer (register struct buffer *b)
693 register struct buffer *b;
694{ 679{
695 b->filename = Qnil; 680 b->filename = Qnil;
696 b->file_truename = Qnil; 681 b->file_truename = Qnil;
@@ -734,9 +719,7 @@ reset_buffer (b)
734 we preserve those. */ 719 we preserve those. */
735 720
736static void 721static void
737reset_buffer_local_variables (b, permanent_too) 722reset_buffer_local_variables (register struct buffer *b, int permanent_too)
738 register struct buffer *b;
739 int permanent_too;
740{ 723{
741 register int offset; 724 register int offset;
742 int i; 725 int i;
@@ -840,8 +823,7 @@ Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
840\(starting at 2) until an unused name is found, and then return that name. 823\(starting at 2) until an unused name is found, and then return that name.
841Optional second argument IGNORE specifies a name that is okay to use (if 824Optional second argument IGNORE specifies a name that is okay to use (if
842it is in the sequence to be tried) even if a buffer with that name exists. */) 825it is in the sequence to be tried) even if a buffer with that name exists. */)
843 (name, ignore) 826 (register Lisp_Object name, Lisp_Object ignore)
844 register Lisp_Object name, ignore;
845{ 827{
846 register Lisp_Object gentemp, tem; 828 register Lisp_Object gentemp, tem;
847 int count; 829 int count;
@@ -875,8 +857,7 @@ DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0,
875 doc: /* Return the name of BUFFER, as a string. 857 doc: /* Return the name of BUFFER, as a string.
876BUFFER defaults to the current buffer. 858BUFFER defaults to the current buffer.
877Return nil if BUFFER has been killed. */) 859Return nil if BUFFER has been killed. */)
878 (buffer) 860 (register Lisp_Object buffer)
879 register Lisp_Object buffer;
880{ 861{
881 if (NILP (buffer)) 862 if (NILP (buffer))
882 return current_buffer->name; 863 return current_buffer->name;
@@ -887,8 +868,7 @@ Return nil if BUFFER has been killed. */)
887DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, 868DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
888 doc: /* Return name of file BUFFER is visiting, or nil if none. 869 doc: /* Return name of file BUFFER is visiting, or nil if none.
889No argument or nil as argument means use the current buffer. */) 870No argument or nil as argument means use the current buffer. */)
890 (buffer) 871 (register Lisp_Object buffer)
891 register Lisp_Object buffer;
892{ 872{
893 if (NILP (buffer)) 873 if (NILP (buffer))
894 return current_buffer->filename; 874 return current_buffer->filename;
@@ -901,8 +881,7 @@ DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
901 doc: /* Return the base buffer of indirect buffer BUFFER. 881 doc: /* Return the base buffer of indirect buffer BUFFER.
902If BUFFER is not indirect, return nil. 882If BUFFER is not indirect, return nil.
903BUFFER defaults to the current buffer. */) 883BUFFER defaults to the current buffer. */)
904 (buffer) 884 (register Lisp_Object buffer)
905 register Lisp_Object buffer;
906{ 885{
907 struct buffer *base; 886 struct buffer *base;
908 Lisp_Object base_buffer; 887 Lisp_Object base_buffer;
@@ -926,9 +905,7 @@ DEFUN ("buffer-local-value", Fbuffer_local_value,
926 doc: /* Return the value of VARIABLE in BUFFER. 905 doc: /* Return the value of VARIABLE in BUFFER.
927If VARIABLE does not have a buffer-local binding in BUFFER, the value 906If VARIABLE does not have a buffer-local binding in BUFFER, the value
928is the default binding of the variable. */) 907is the default binding of the variable. */)
929 (variable, buffer) 908 (register Lisp_Object variable, register Lisp_Object buffer)
930 register Lisp_Object variable;
931 register Lisp_Object buffer;
932{ 909{
933 register struct buffer *buf; 910 register struct buffer *buf;
934 register Lisp_Object result; 911 register Lisp_Object result;
@@ -993,8 +970,7 @@ is the default binding of the variable. */)
993 in special slots in the buffer object. */ 970 in special slots in the buffer object. */
994 971
995static Lisp_Object 972static Lisp_Object
996buffer_lisp_local_variables (buf) 973buffer_lisp_local_variables (struct buffer *buf)
997 struct buffer *buf;
998{ 974{
999 Lisp_Object result = Qnil; 975 Lisp_Object result = Qnil;
1000 register Lisp_Object tail; 976 register Lisp_Object tail;
@@ -1027,8 +1003,7 @@ Most elements look like (SYMBOL . VALUE), describing one variable.
1027For a symbol that is locally unbound, just the symbol appears in the value. 1003For a symbol that is locally unbound, just the symbol appears in the value.
1028Note that storing new VALUEs in these elements doesn't change the variables. 1004Note that storing new VALUEs in these elements doesn't change the variables.
1029No argument or nil as argument means use current buffer as BUFFER. */) 1005No argument or nil as argument means use current buffer as BUFFER. */)
1030 (buffer) 1006 (register Lisp_Object buffer)
1031 register Lisp_Object buffer;
1032{ 1007{
1033 register struct buffer *buf; 1008 register struct buffer *buf;
1034 register Lisp_Object result; 1009 register Lisp_Object result;
@@ -1070,8 +1045,7 @@ DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p,
1070 0, 1, 0, 1045 0, 1, 0,
1071 doc: /* Return t if BUFFER was modified since its file was last read or saved. 1046 doc: /* Return t if BUFFER was modified since its file was last read or saved.
1072No argument or nil as argument means use current buffer as BUFFER. */) 1047No argument or nil as argument means use current buffer as BUFFER. */)
1073 (buffer) 1048 (register Lisp_Object buffer)
1074 register Lisp_Object buffer;
1075{ 1049{
1076 register struct buffer *buf; 1050 register struct buffer *buf;
1077 if (NILP (buffer)) 1051 if (NILP (buffer))
@@ -1089,8 +1063,7 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1089 1, 1, 0, 1063 1, 1, 0,
1090 doc: /* Mark current buffer as modified or unmodified according to FLAG. 1064 doc: /* Mark current buffer as modified or unmodified according to FLAG.
1091A non-nil FLAG means mark the buffer modified. */) 1065A non-nil FLAG means mark the buffer modified. */)
1092 (flag) 1066 (register Lisp_Object flag)
1093 register Lisp_Object flag;
1094{ 1067{
1095 register int already; 1068 register int already;
1096 register Lisp_Object fn; 1069 register Lisp_Object fn;
@@ -1159,8 +1132,7 @@ DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
1159 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. 1132 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay.
1160It is not ensured that mode lines will be updated to show the modified 1133It is not ensured that mode lines will be updated to show the modified
1161state of the current buffer. Use with care. */) 1134state of the current buffer. Use with care. */)
1162 (flag) 1135 (Lisp_Object flag)
1163 Lisp_Object flag;
1164{ 1136{
1165#ifdef CLASH_DETECTION 1137#ifdef CLASH_DETECTION
1166 Lisp_Object fn; 1138 Lisp_Object fn;
@@ -1190,8 +1162,7 @@ DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, Sbuffer_modified_tick,
1190Each buffer has a tick counter which is incremented each time the 1162Each buffer has a tick counter which is incremented each time the
1191text in that buffer is changed. It wraps around occasionally. 1163text in that buffer is changed. It wraps around occasionally.
1192No argument or nil as argument means use current buffer as BUFFER. */) 1164No argument or nil as argument means use current buffer as BUFFER. */)
1193 (buffer) 1165 (register Lisp_Object buffer)
1194 register Lisp_Object buffer;
1195{ 1166{
1196 register struct buffer *buf; 1167 register struct buffer *buf;
1197 if (NILP (buffer)) 1168 if (NILP (buffer))
@@ -1215,8 +1186,7 @@ values returned by two individual calls of `buffer-chars-modified-tick',
1215you can tell whether a character change occurred in that buffer in 1186you can tell whether a character change occurred in that buffer in
1216between these calls. No argument or nil as argument means use current 1187between these calls. No argument or nil as argument means use current
1217buffer as BUFFER. */) 1188buffer as BUFFER. */)
1218 (buffer) 1189 (register Lisp_Object buffer)
1219 register Lisp_Object buffer;
1220{ 1190{
1221 register struct buffer *buf; 1191 register struct buffer *buf;
1222 if (NILP (buffer)) 1192 if (NILP (buffer))
@@ -1242,8 +1212,7 @@ If UNIQUE is non-nil, come up with a new name using
1242Interactively, you can set UNIQUE with a prefix argument. 1212Interactively, you can set UNIQUE with a prefix argument.
1243We return the name we actually gave the buffer. 1213We return the name we actually gave the buffer.
1244This does not change the name of the visited file (if any). */) 1214This does not change the name of the visited file (if any). */)
1245 (newname, unique) 1215 (register Lisp_Object newname, Lisp_Object unique)
1246 register Lisp_Object newname, unique;
1247{ 1216{
1248 register Lisp_Object tem, buf; 1217 register Lisp_Object tem, buf;
1249 1218
@@ -1290,10 +1259,9 @@ If the optional third argument FRAME is non-nil, use that frame's
1290buffer list instead of the selected frame's buffer list. 1259buffer list instead of the selected frame's buffer list.
1291If no other buffer exists, the buffer `*scratch*' is returned. 1260If no other buffer exists, the buffer `*scratch*' is returned.
1292If BUFFER is omitted or nil, some interesting buffer is returned. */) 1261If BUFFER is omitted or nil, some interesting buffer is returned. */)
1293 (buffer, visible_ok, frame) 1262 (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
1294 register Lisp_Object buffer, visible_ok, frame;
1295{ 1263{
1296 Lisp_Object Fset_buffer_major_mode (); 1264 Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
1297 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; 1265 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons;
1298 notsogood = Qnil; 1266 notsogood = Qnil;
1299 1267
@@ -1362,8 +1330,7 @@ DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo,
1362 0, 1, "", 1330 0, 1, "",
1363 doc: /* Start keeping undo information for buffer BUFFER. 1331 doc: /* Start keeping undo information for buffer BUFFER.
1364No argument or nil as argument means do this for the current buffer. */) 1332No argument or nil as argument means do this for the current buffer. */)
1365 (buffer) 1333 (register Lisp_Object buffer)
1366 register Lisp_Object buffer;
1367{ 1334{
1368 Lisp_Object real_buffer; 1335 Lisp_Object real_buffer;
1369 1336
@@ -1404,8 +1371,7 @@ is running.
1404 1371
1405Any processes that have this buffer as the `process-buffer' are killed 1372Any processes that have this buffer as the `process-buffer' are killed
1406with SIGHUP. */) 1373with SIGHUP. */)
1407 (buffer_or_name) 1374 (Lisp_Object buffer_or_name)
1408 Lisp_Object buffer_or_name;
1409{ 1375{
1410 Lisp_Object buffer; 1376 Lisp_Object buffer;
1411 register struct buffer *b; 1377 register struct buffer *b;
@@ -1618,8 +1584,7 @@ with SIGHUP. */)
1618 means that other_buffer is more likely to choose a relevant buffer. */ 1584 means that other_buffer is more likely to choose a relevant buffer. */
1619 1585
1620void 1586void
1621record_buffer (buf) 1587record_buffer (Lisp_Object buf)
1622 Lisp_Object buf;
1623{ 1588{
1624 register Lisp_Object link, prev; 1589 register Lisp_Object link, prev;
1625 Lisp_Object frame; 1590 Lisp_Object frame;
@@ -1695,8 +1660,7 @@ For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode
1695according to `default-major-mode'. 1660according to `default-major-mode'.
1696Use this function before selecting the buffer, since it may need to inspect 1661Use this function before selecting the buffer, since it may need to inspect
1697the current buffer's major mode. */) 1662the current buffer's major mode. */)
1698 (buffer) 1663 (Lisp_Object buffer)
1699 Lisp_Object buffer;
1700{ 1664{
1701 int count; 1665 int count;
1702 Lisp_Object function; 1666 Lisp_Object function;
@@ -1734,8 +1698,7 @@ the current buffer's major mode. */)
1734 If NORECORD is non-nil, don't call record_buffer. */ 1698 If NORECORD is non-nil, don't call record_buffer. */
1735 1699
1736Lisp_Object 1700Lisp_Object
1737switch_to_buffer_1 (buffer_or_name, norecord) 1701switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord)
1738 Lisp_Object buffer_or_name, norecord;
1739{ 1702{
1740 register Lisp_Object buffer; 1703 register Lisp_Object buffer;
1741 1704
@@ -1784,8 +1747,7 @@ its buffer, use `pop-to-buffer' for displaying the buffer.
1784WARNING: This is NOT the way to work on another buffer temporarily 1747WARNING: This is NOT the way to work on another buffer temporarily
1785within a Lisp program! Use `set-buffer' instead. That avoids 1748within a Lisp program! Use `set-buffer' instead. That avoids
1786messing with the window-buffer correspondences. */) 1749messing with the window-buffer correspondences. */)
1787 (buffer_or_name, norecord) 1750 (Lisp_Object buffer_or_name, Lisp_Object norecord)
1788 Lisp_Object buffer_or_name, norecord;
1789{ 1751{
1790 if (EQ (buffer_or_name, Fwindow_buffer (selected_window))) 1752 if (EQ (buffer_or_name, Fwindow_buffer (selected_window)))
1791 { 1753 {
@@ -1814,7 +1776,7 @@ messing with the window-buffer correspondences. */)
1814 1776
1815DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, 1777DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
1816 doc: /* Return the current buffer as a Lisp object. */) 1778 doc: /* Return the current buffer as a Lisp object. */)
1817 () 1779 (void)
1818{ 1780{
1819 register Lisp_Object buf; 1781 register Lisp_Object buf;
1820 XSETBUFFER (buf, current_buffer); 1782 XSETBUFFER (buf, current_buffer);
@@ -1831,8 +1793,7 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
1831 time, and that increments windows_or_buffers_changed. */ 1793 time, and that increments windows_or_buffers_changed. */
1832 1794
1833void 1795void
1834set_buffer_internal (b) 1796set_buffer_internal (register struct buffer *b)
1835 register struct buffer *b;
1836{ 1797{
1837 if (current_buffer != b) 1798 if (current_buffer != b)
1838 set_buffer_internal_1 (b); 1799 set_buffer_internal_1 (b);
@@ -1842,8 +1803,7 @@ set_buffer_internal (b)
1842 This is used by redisplay. */ 1803 This is used by redisplay. */
1843 1804
1844void 1805void
1845set_buffer_internal_1 (b) 1806set_buffer_internal_1 (register struct buffer *b)
1846 register struct buffer *b;
1847{ 1807{
1848 register struct buffer *old_buf; 1808 register struct buffer *old_buf;
1849 register Lisp_Object tail; 1809 register Lisp_Object tail;
@@ -1939,8 +1899,7 @@ set_buffer_internal_1 (b)
1939 This avoids certain things that don't need to be done within redisplay. */ 1899 This avoids certain things that don't need to be done within redisplay. */
1940 1900
1941void 1901void
1942set_buffer_temp (b) 1902set_buffer_temp (struct buffer *b)
1943 struct buffer *b;
1944{ 1903{
1945 register struct buffer *old_buf; 1904 register struct buffer *old_buf;
1946 1905
@@ -2003,8 +1962,7 @@ also `save-excursion' when you want to make a buffer current
2003temporarily. This function does not display the buffer, so its effect 1962temporarily. This function does not display the buffer, so its effect
2004ends when the current command terminates. Use `switch-to-buffer' or 1963ends when the current command terminates. Use `switch-to-buffer' or
2005`pop-to-buffer' to switch buffers permanently. */) 1964`pop-to-buffer' to switch buffers permanently. */)
2006 (buffer_or_name) 1965 (register Lisp_Object buffer_or_name)
2007 register Lisp_Object buffer_or_name;
2008{ 1966{
2009 register Lisp_Object buffer; 1967 register Lisp_Object buffer;
2010 buffer = Fget_buffer (buffer_or_name); 1968 buffer = Fget_buffer (buffer_or_name);
@@ -2019,8 +1977,7 @@ ends when the current command terminates. Use `switch-to-buffer' or
2019/* Set the current buffer to BUFFER provided it is alive. */ 1977/* Set the current buffer to BUFFER provided it is alive. */
2020 1978
2021Lisp_Object 1979Lisp_Object
2022set_buffer_if_live (buffer) 1980set_buffer_if_live (Lisp_Object buffer)
2023 Lisp_Object buffer;
2024{ 1981{
2025 if (! NILP (XBUFFER (buffer)->name)) 1982 if (! NILP (XBUFFER (buffer)->name))
2026 Fset_buffer (buffer); 1983 Fset_buffer (buffer);
@@ -2030,7 +1987,7 @@ set_buffer_if_live (buffer)
2030DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 1987DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
2031 Sbarf_if_buffer_read_only, 0, 0, 0, 1988 Sbarf_if_buffer_read_only, 0, 0, 0,
2032 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) 1989 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */)
2033 () 1990 (void)
2034{ 1991{
2035 if (!NILP (current_buffer->read_only) 1992 if (!NILP (current_buffer->read_only)
2036 && NILP (Vinhibit_read_only)) 1993 && NILP (Vinhibit_read_only))
@@ -2050,8 +2007,7 @@ from the selected window if it is displayed there. If the selected
2050window is dedicated to its buffer, delete that window if there are other 2007window is dedicated to its buffer, delete that window if there are other
2051windows on the same frame. If the selected window is the only window on 2008windows on the same frame. If the selected window is the only window on
2052its frame, iconify that frame. */) 2009its frame, iconify that frame. */)
2053 (buffer_or_name) 2010 (register Lisp_Object buffer_or_name)
2054 register Lisp_Object buffer_or_name;
2055{ 2011{
2056 Lisp_Object buffer; 2012 Lisp_Object buffer;
2057 2013
@@ -2105,7 +2061,7 @@ DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*",
2105 doc: /* Delete the entire contents of the current buffer. 2061 doc: /* Delete the entire contents of the current buffer.
2106Any narrowing restriction in effect (see `narrow-to-region') is removed, 2062Any narrowing restriction in effect (see `narrow-to-region') is removed,
2107so the buffer is truly empty after this. */) 2063so the buffer is truly empty after this. */)
2108 () 2064 (void)
2109{ 2065{
2110 Fwiden (); 2066 Fwiden ();
2111 2067
@@ -2120,8 +2076,7 @@ so the buffer is truly empty after this. */)
2120} 2076}
2121 2077
2122void 2078void
2123validate_region (b, e) 2079validate_region (register Lisp_Object *b, register Lisp_Object *e)
2124 register Lisp_Object *b, *e;
2125{ 2080{
2126 CHECK_NUMBER_COERCE_MARKER (*b); 2081 CHECK_NUMBER_COERCE_MARKER (*b);
2127 CHECK_NUMBER_COERCE_MARKER (*e); 2082 CHECK_NUMBER_COERCE_MARKER (*e);
@@ -2141,8 +2096,7 @@ validate_region (b, e)
2141 and return the adjusted position. */ 2096 and return the adjusted position. */
2142 2097
2143static int 2098static int
2144advance_to_char_boundary (byte_pos) 2099advance_to_char_boundary (int byte_pos)
2145 int byte_pos;
2146{ 2100{
2147 int c; 2101 int c;
2148 2102
@@ -2175,14 +2129,13 @@ advance_to_char_boundary (byte_pos)
2175} 2129}
2176 2130
2177#ifdef REL_ALLOC 2131#ifdef REL_ALLOC
2178extern void r_alloc_reset_variable P_ ((POINTER_TYPE *, POINTER_TYPE *)); 2132extern void r_alloc_reset_variable (POINTER_TYPE *, POINTER_TYPE *);
2179#endif /* REL_ALLOC */ 2133#endif /* REL_ALLOC */
2180 2134
2181DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, 2135DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2182 1, 1, 0, 2136 1, 1, 0,
2183 doc: /* Swap the text between current buffer and BUFFER. */) 2137 doc: /* Swap the text between current buffer and BUFFER. */)
2184 (buffer) 2138 (Lisp_Object buffer)
2185 Lisp_Object buffer;
2186{ 2139{
2187 struct buffer *other_buffer; 2140 struct buffer *other_buffer;
2188 CHECK_BUFFER (buffer); 2141 CHECK_BUFFER (buffer);
@@ -2320,8 +2273,7 @@ If FLAG is `to', this makes the buffer a multibyte buffer by changing
2320all eight-bit bytes to eight-bit characters. 2273all eight-bit bytes to eight-bit characters.
2321If the multibyte flag was really changed, undo information of the 2274If the multibyte flag was really changed, undo information of the
2322current buffer is cleared. */) 2275current buffer is cleared. */)
2323 (flag) 2276 (Lisp_Object flag)
2324 Lisp_Object flag;
2325{ 2277{
2326 struct Lisp_Marker *tail, *markers; 2278 struct Lisp_Marker *tail, *markers;
2327 struct buffer *other; 2279 struct buffer *other;
@@ -2588,7 +2540,6 @@ current buffer is cleared. */)
2588 if (!modified_p && !NILP (Fbuffer_modified_p (Qnil))) 2540 if (!modified_p && !NILP (Fbuffer_modified_p (Qnil)))
2589 Fset_buffer_modified_p (Qnil); 2541 Fset_buffer_modified_p (Qnil);
2590 2542
2591#ifdef subprocesses
2592 /* Update coding systems of this buffer's process (if any). */ 2543 /* Update coding systems of this buffer's process (if any). */
2593 { 2544 {
2594 Lisp_Object process; 2545 Lisp_Object process;
@@ -2597,7 +2548,6 @@ current buffer is cleared. */)
2597 if (PROCESSP (process)) 2548 if (PROCESSP (process))
2598 setup_process_coding_systems (process); 2549 setup_process_coding_systems (process);
2599 } 2550 }
2600#endif /* subprocesses */
2601 2551
2602 return flag; 2552 return flag;
2603} 2553}
@@ -2619,7 +2569,7 @@ a non-nil `permanent-local' property are not eliminated by this function.
2619 2569
2620The first thing this function does is run 2570The first thing this function does is run
2621the normal hook `change-major-mode-hook'. */) 2571the normal hook `change-major-mode-hook'. */)
2622 () 2572 (void)
2623{ 2573{
2624 if (!NILP (Vrun_hooks)) 2574 if (!NILP (Vrun_hooks))
2625 call1 (Vrun_hooks, Qchange_major_mode_hook); 2575 call1 (Vrun_hooks, Qchange_major_mode_hook);
@@ -2644,8 +2594,7 @@ the normal hook `change-major-mode-hook'. */)
2644 for their current values. */ 2594 for their current values. */
2645 2595
2646static void 2596static void
2647swap_out_buffer_local_variables (b) 2597swap_out_buffer_local_variables (struct buffer *b)
2648 struct buffer *b;
2649{ 2598{
2650 Lisp_Object oalist, alist, buffer; 2599 Lisp_Object oalist, alist, buffer;
2651 2600
@@ -2690,14 +2639,8 @@ swap_out_buffer_local_variables (b)
2690 default (BEGV or ZV). */ 2639 default (BEGV or ZV). */
2691 2640
2692int 2641int
2693overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req) 2642overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, int *len_ptr,
2694 EMACS_INT pos; 2643 EMACS_INT *next_ptr, EMACS_INT *prev_ptr, int change_req)
2695 int extend;
2696 Lisp_Object **vec_ptr;
2697 int *len_ptr;
2698 EMACS_INT *next_ptr;
2699 EMACS_INT *prev_ptr;
2700 int change_req;
2701{ 2644{
2702 Lisp_Object overlay, start, end; 2645 Lisp_Object overlay, start, end;
2703 struct Lisp_Overlay *tail; 2646 struct Lisp_Overlay *tail;
@@ -2835,13 +2778,8 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req)
2835 But we still return the total number of overlays. */ 2778 But we still return the total number of overlays. */
2836 2779
2837static int 2780static int
2838overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) 2781overlays_in (int beg, int end, int extend, Lisp_Object **vec_ptr, int *len_ptr,
2839 int beg, end; 2782 int *next_ptr, int *prev_ptr)
2840 int extend;
2841 Lisp_Object **vec_ptr;
2842 int *len_ptr;
2843 int *next_ptr;
2844 int *prev_ptr;
2845{ 2783{
2846 Lisp_Object overlay, ostart, oend; 2784 Lisp_Object overlay, ostart, oend;
2847 struct Lisp_Overlay *tail; 2785 struct Lisp_Overlay *tail;
@@ -2962,8 +2900,7 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
2962 `mouse-face' property overlapping OVERLAY. */ 2900 `mouse-face' property overlapping OVERLAY. */
2963 2901
2964int 2902int
2965mouse_face_overlay_overlaps (overlay) 2903mouse_face_overlay_overlaps (Lisp_Object overlay)
2966 Lisp_Object overlay;
2967{ 2904{
2968 int start = OVERLAY_POSITION (OVERLAY_START (overlay)); 2905 int start = OVERLAY_POSITION (OVERLAY_START (overlay));
2969 int end = OVERLAY_POSITION (OVERLAY_END (overlay)); 2906 int end = OVERLAY_POSITION (OVERLAY_END (overlay));
@@ -2992,8 +2929,7 @@ mouse_face_overlay_overlaps (overlay)
2992 2929
2993/* Fast function to just test if we're at an overlay boundary. */ 2930/* Fast function to just test if we're at an overlay boundary. */
2994int 2931int
2995overlay_touches_p (pos) 2932overlay_touches_p (int pos)
2996 int pos;
2997{ 2933{
2998 Lisp_Object overlay; 2934 Lisp_Object overlay;
2999 struct Lisp_Overlay *tail; 2935 struct Lisp_Overlay *tail;
@@ -3038,8 +2974,7 @@ struct sortvec
3038}; 2974};
3039 2975
3040static int 2976static int
3041compare_overlays (v1, v2) 2977compare_overlays (const void *v1, const void *v2)
3042 const void *v1, *v2;
3043{ 2978{
3044 const struct sortvec *s1 = (const struct sortvec *) v1; 2979 const struct sortvec *s1 = (const struct sortvec *) v1;
3045 const struct sortvec *s2 = (const struct sortvec *) v2; 2980 const struct sortvec *s2 = (const struct sortvec *) v2;
@@ -3056,10 +2991,7 @@ compare_overlays (v1, v2)
3056 The return value is the new size; this may be smaller than the original 2991 The return value is the new size; this may be smaller than the original
3057 size if some of the overlays were invalid or were window-specific. */ 2992 size if some of the overlays were invalid or were window-specific. */
3058int 2993int
3059sort_overlays (overlay_vec, noverlays, w) 2994sort_overlays (Lisp_Object *overlay_vec, int noverlays, struct window *w)
3060 Lisp_Object *overlay_vec;
3061 int noverlays;
3062 struct window *w;
3063{ 2995{
3064 int i, j; 2996 int i, j;
3065 struct sortvec *sortvec; 2997 struct sortvec *sortvec;
@@ -3139,8 +3071,7 @@ static int overlay_str_len;
3139 3071
3140/* A comparison function suitable for passing to qsort. */ 3072/* A comparison function suitable for passing to qsort. */
3141static int 3073static int
3142cmp_for_strings (as1, as2) 3074cmp_for_strings (const void *as1, const void *as2)
3143 char *as1, *as2;
3144{ 3075{
3145 struct sortstr *s1 = (struct sortstr *)as1; 3076 struct sortstr *s1 = (struct sortstr *)as1;
3146 struct sortstr *s2 = (struct sortstr *)as2; 3077 struct sortstr *s2 = (struct sortstr *)as2;
@@ -3152,10 +3083,7 @@ cmp_for_strings (as1, as2)
3152} 3083}
3153 3084
3154static void 3085static void
3155record_overlay_string (ssl, str, str2, pri, size) 3086record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, Lisp_Object str2, Lisp_Object pri, int size)
3156 struct sortstrlist *ssl;
3157 Lisp_Object str, str2, pri;
3158 int size;
3159{ 3087{
3160 int nbytes; 3088 int nbytes;
3161 3089
@@ -3211,10 +3139,7 @@ record_overlay_string (ssl, str, str2, pri, size)
3211 subsequent calls. */ 3139 subsequent calls. */
3212 3140
3213int 3141int
3214overlay_strings (pos, w, pstr) 3142overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
3215 EMACS_INT pos;
3216 struct window *w;
3217 unsigned char **pstr;
3218{ 3143{
3219 Lisp_Object overlay, window, str; 3144 Lisp_Object overlay, window, str;
3220 struct Lisp_Overlay *ov; 3145 struct Lisp_Overlay *ov;
@@ -3337,9 +3262,7 @@ overlay_strings (pos, w, pstr)
3337/* Shift overlays in BUF's overlay lists, to center the lists at POS. */ 3262/* Shift overlays in BUF's overlay lists, to center the lists at POS. */
3338 3263
3339void 3264void
3340recenter_overlay_lists (buf, pos) 3265recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
3341 struct buffer *buf;
3342 EMACS_INT pos;
3343{ 3266{
3344 Lisp_Object overlay, beg, end; 3267 Lisp_Object overlay, beg, end;
3345 struct Lisp_Overlay *prev, *tail, *next; 3268 struct Lisp_Overlay *prev, *tail, *next;
@@ -3488,9 +3411,7 @@ recenter_overlay_lists (buf, pos)
3488} 3411}
3489 3412
3490void 3413void
3491adjust_overlays_for_insert (pos, length) 3414adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length)
3492 EMACS_INT pos;
3493 EMACS_INT length;
3494{ 3415{
3495 /* After an insertion, the lists are still sorted properly, 3416 /* After an insertion, the lists are still sorted properly,
3496 but we may need to update the value of the overlay center. */ 3417 but we may need to update the value of the overlay center. */
@@ -3499,9 +3420,7 @@ adjust_overlays_for_insert (pos, length)
3499} 3420}
3500 3421
3501void 3422void
3502adjust_overlays_for_delete (pos, length) 3423adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length)
3503 EMACS_INT pos;
3504 EMACS_INT length;
3505{ 3424{
3506 if (current_buffer->overlay_center < pos) 3425 if (current_buffer->overlay_center < pos)
3507 /* The deletion was to our right. No change needed; the before- and 3426 /* The deletion was to our right. No change needed; the before- and
@@ -3526,8 +3445,7 @@ adjust_overlays_for_delete (pos, length)
3526 Such an overlay might even have negative size at this point. 3445 Such an overlay might even have negative size at this point.
3527 If so, we'll make the overlay empty. */ 3446 If so, we'll make the overlay empty. */
3528void 3447void
3529fix_start_end_in_overlays (start, end) 3448fix_start_end_in_overlays (register int start, register int end)
3530 register int start, end;
3531{ 3449{
3532 Lisp_Object overlay; 3450 Lisp_Object overlay;
3533 struct Lisp_Overlay *before_list, *after_list; 3451 struct Lisp_Overlay *before_list, *after_list;
@@ -3673,9 +3591,7 @@ fix_start_end_in_overlays (start, end)
3673 was at PREV, and now is at POS. */ 3591 was at PREV, and now is at POS. */
3674 3592
3675void 3593void
3676fix_overlays_before (bp, prev, pos) 3594fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos)
3677 struct buffer *bp;
3678 EMACS_INT prev, pos;
3679{ 3595{
3680 /* If parent is nil, replace overlays_before; otherwise, parent->next. */ 3596 /* If parent is nil, replace overlays_before; otherwise, parent->next. */
3681 struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; 3597 struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair;
@@ -3754,8 +3670,7 @@ fix_overlays_before (bp, prev, pos)
3754 3670
3755DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0, 3671DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0,
3756 doc: /* Return t if OBJECT is an overlay. */) 3672 doc: /* Return t if OBJECT is an overlay. */)
3757 (object) 3673 (Lisp_Object object)
3758 Lisp_Object object;
3759{ 3674{
3760 return (OVERLAYP (object) ? Qt : Qnil); 3675 return (OVERLAYP (object) ? Qt : Qnil);
3761} 3676}
@@ -3770,9 +3685,7 @@ for the front of the overlay advance when text is inserted there
3770The fifth arg REAR-ADVANCE, if non-nil, makes the marker 3685The fifth arg REAR-ADVANCE, if non-nil, makes the marker
3771for the rear of the overlay advance when text is inserted there 3686for the rear of the overlay advance when text is inserted there
3772\(which means the text *is* included in the overlay). */) 3687\(which means the text *is* included in the overlay). */)
3773 (beg, end, buffer, front_advance, rear_advance) 3688 (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, Lisp_Object front_advance, Lisp_Object rear_advance)
3774 Lisp_Object beg, end, buffer;
3775 Lisp_Object front_advance, rear_advance;
3776{ 3689{
3777 Lisp_Object overlay; 3690 Lisp_Object overlay;
3778 struct buffer *b; 3691 struct buffer *b;
@@ -3841,9 +3754,7 @@ for the rear of the overlay advance when text is inserted there
3841/* Mark a section of BUF as needing redisplay because of overlays changes. */ 3754/* Mark a section of BUF as needing redisplay because of overlays changes. */
3842 3755
3843static void 3756static void
3844modify_overlay (buf, start, end) 3757modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end)
3845 struct buffer *buf;
3846 EMACS_INT start, end;
3847{ 3758{
3848 if (start > end) 3759 if (start > end)
3849 { 3760 {
@@ -3870,11 +3781,10 @@ modify_overlay (buf, start, end)
3870} 3781}
3871 3782
3872 3783
3873Lisp_Object Fdelete_overlay (); 3784Lisp_Object Fdelete_overlay (Lisp_Object overlay);
3874 3785
3875static struct Lisp_Overlay * 3786static struct Lisp_Overlay *
3876unchain_overlay (list, overlay) 3787unchain_overlay (struct Lisp_Overlay *list, struct Lisp_Overlay *overlay)
3877 struct Lisp_Overlay *list, *overlay;
3878{ 3788{
3879 struct Lisp_Overlay *tmp, *prev; 3789 struct Lisp_Overlay *tmp, *prev;
3880 for (tmp = list, prev = NULL; tmp; prev = tmp, tmp = tmp->next) 3790 for (tmp = list, prev = NULL; tmp; prev = tmp, tmp = tmp->next)
@@ -3895,8 +3805,7 @@ DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
3895If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now. 3805If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.
3896If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current 3806If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current
3897buffer. */) 3807buffer. */)
3898 (overlay, beg, end, buffer) 3808 (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer)
3899 Lisp_Object overlay, beg, end, buffer;
3900{ 3809{
3901 struct buffer *b, *ob; 3810 struct buffer *b, *ob;
3902 Lisp_Object obuffer; 3811 Lisp_Object obuffer;
@@ -4005,8 +3914,7 @@ buffer. */)
4005 3914
4006DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, 3915DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
4007 doc: /* Delete the overlay OVERLAY from its buffer. */) 3916 doc: /* Delete the overlay OVERLAY from its buffer. */)
4008 (overlay) 3917 (Lisp_Object overlay)
4009 Lisp_Object overlay;
4010{ 3918{
4011 Lisp_Object buffer; 3919 Lisp_Object buffer;
4012 struct buffer *b; 3920 struct buffer *b;
@@ -4046,8 +3954,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
4046 3954
4047DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, 3955DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
4048 doc: /* Return the position at which OVERLAY starts. */) 3956 doc: /* Return the position at which OVERLAY starts. */)
4049 (overlay) 3957 (Lisp_Object overlay)
4050 Lisp_Object overlay;
4051{ 3958{
4052 CHECK_OVERLAY (overlay); 3959 CHECK_OVERLAY (overlay);
4053 3960
@@ -4056,8 +3963,7 @@ DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
4056 3963
4057DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, 3964DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0,
4058 doc: /* Return the position at which OVERLAY ends. */) 3965 doc: /* Return the position at which OVERLAY ends. */)
4059 (overlay) 3966 (Lisp_Object overlay)
4060 Lisp_Object overlay;
4061{ 3967{
4062 CHECK_OVERLAY (overlay); 3968 CHECK_OVERLAY (overlay);
4063 3969
@@ -4067,8 +3973,7 @@ DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0,
4067DEFUN ("overlay-buffer", Foverlay_buffer, Soverlay_buffer, 1, 1, 0, 3973DEFUN ("overlay-buffer", Foverlay_buffer, Soverlay_buffer, 1, 1, 0,
4068 doc: /* Return the buffer OVERLAY belongs to. 3974 doc: /* Return the buffer OVERLAY belongs to.
4069Return nil if OVERLAY has been deleted. */) 3975Return nil if OVERLAY has been deleted. */)
4070 (overlay) 3976 (Lisp_Object overlay)
4071 Lisp_Object overlay;
4072{ 3977{
4073 CHECK_OVERLAY (overlay); 3978 CHECK_OVERLAY (overlay);
4074 3979
@@ -4079,8 +3984,7 @@ DEFUN ("overlay-properties", Foverlay_properties, Soverlay_properties, 1, 1, 0,
4079 doc: /* Return a list of the properties on OVERLAY. 3984 doc: /* Return a list of the properties on OVERLAY.
4080This is a copy of OVERLAY's plist; modifying its conses has no effect on 3985This is a copy of OVERLAY's plist; modifying its conses has no effect on
4081OVERLAY. */) 3986OVERLAY. */)
4082 (overlay) 3987 (Lisp_Object overlay)
4083 Lisp_Object overlay;
4084{ 3988{
4085 CHECK_OVERLAY (overlay); 3989 CHECK_OVERLAY (overlay);
4086 3990
@@ -4090,8 +3994,7 @@ OVERLAY. */)
4090 3994
4091DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, 3995DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
4092 doc: /* Return a list of the overlays that contain the character at POS. */) 3996 doc: /* Return a list of the overlays that contain the character at POS. */)
4093 (pos) 3997 (Lisp_Object pos)
4094 Lisp_Object pos;
4095{ 3998{
4096 int noverlays; 3999 int noverlays;
4097 Lisp_Object *overlay_vec; 4000 Lisp_Object *overlay_vec;
@@ -4123,8 +4026,7 @@ and also contained within the specified region.
4123Empty overlays are included in the result if they are located at BEG, 4026Empty overlays are included in the result if they are located at BEG,
4124between BEG and END, or at END provided END denotes the position at the 4027between BEG and END, or at END provided END denotes the position at the
4125end of the buffer. */) 4028end of the buffer. */)
4126 (beg, end) 4029 (Lisp_Object beg, Lisp_Object end)
4127 Lisp_Object beg, end;
4128{ 4030{
4129 int noverlays; 4031 int noverlays;
4130 Lisp_Object *overlay_vec; 4032 Lisp_Object *overlay_vec;
@@ -4154,8 +4056,7 @@ DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change,
4154 doc: /* Return the next position after POS where an overlay starts or ends. 4056 doc: /* Return the next position after POS where an overlay starts or ends.
4155If there are no overlay boundaries from POS to (point-max), 4057If there are no overlay boundaries from POS to (point-max),
4156the value is (point-max). */) 4058the value is (point-max). */)
4157 (pos) 4059 (Lisp_Object pos)
4158 Lisp_Object pos;
4159{ 4060{
4160 int noverlays; 4061 int noverlays;
4161 EMACS_INT endpos; 4062 EMACS_INT endpos;
@@ -4196,8 +4097,7 @@ DEFUN ("previous-overlay-change", Fprevious_overlay_change,
4196 doc: /* Return the previous position before POS where an overlay starts or ends. 4097 doc: /* Return the previous position before POS where an overlay starts or ends.
4197If there are no overlay boundaries from (point-min) to POS, 4098If there are no overlay boundaries from (point-min) to POS,
4198the value is (point-min). */) 4099the value is (point-min). */)
4199 (pos) 4100 (Lisp_Object pos)
4200 Lisp_Object pos;
4201{ 4101{
4202 int noverlays; 4102 int noverlays;
4203 EMACS_INT prevpos; 4103 EMACS_INT prevpos;
@@ -4233,7 +4133,7 @@ the cdr has all the overlays after the overlay center.
4233Recentering overlays moves overlays between these lists. 4133Recentering overlays moves overlays between these lists.
4234The lists you get are copies, so that changing them has no effect. 4134The lists you get are copies, so that changing them has no effect.
4235However, the overlays you get are the real objects that the buffer uses. */) 4135However, the overlays you get are the real objects that the buffer uses. */)
4236 () 4136 (void)
4237{ 4137{
4238 struct Lisp_Overlay *ol; 4138 struct Lisp_Overlay *ol;
4239 Lisp_Object before = Qnil, after = Qnil, tmp; 4139 Lisp_Object before = Qnil, after = Qnil, tmp;
@@ -4254,8 +4154,7 @@ DEFUN ("overlay-recenter", Foverlay_recenter, Soverlay_recenter, 1, 1, 0,
4254 doc: /* Recenter the overlays of the current buffer around position POS. 4154 doc: /* Recenter the overlays of the current buffer around position POS.
4255That makes overlay lookup faster for positions near POS (but perhaps slower 4155That makes overlay lookup faster for positions near POS (but perhaps slower
4256for positions far away from POS). */) 4156for positions far away from POS). */)
4257 (pos) 4157 (Lisp_Object pos)
4258 Lisp_Object pos;
4259{ 4158{
4260 CHECK_NUMBER_COERCE_MARKER (pos); 4159 CHECK_NUMBER_COERCE_MARKER (pos);
4261 4160
@@ -4265,8 +4164,7 @@ for positions far away from POS). */)
4265 4164
4266DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, 4165DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
4267 doc: /* Get the property of overlay OVERLAY with property name PROP. */) 4166 doc: /* Get the property of overlay OVERLAY with property name PROP. */)
4268 (overlay, prop) 4167 (Lisp_Object overlay, Lisp_Object prop)
4269 Lisp_Object overlay, prop;
4270{ 4168{
4271 CHECK_OVERLAY (overlay); 4169 CHECK_OVERLAY (overlay);
4272 return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0); 4170 return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0);
@@ -4274,8 +4172,7 @@ DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
4274 4172
4275DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, 4173DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
4276 doc: /* Set one property of overlay OVERLAY: give property PROP value VALUE. */) 4174 doc: /* Set one property of overlay OVERLAY: give property PROP value VALUE. */)
4277 (overlay, prop, value) 4175 (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value)
4278 Lisp_Object overlay, prop, value;
4279{ 4176{
4280 Lisp_Object tail, buffer; 4177 Lisp_Object tail, buffer;
4281 int changed; 4178 int changed;
@@ -4333,8 +4230,7 @@ static int last_overlay_modification_hooks_used;
4333 to the end of last_overlay_modification_hooks. */ 4230 to the end of last_overlay_modification_hooks. */
4334 4231
4335static void 4232static void
4336add_overlay_mod_hooklist (functionlist, overlay) 4233add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
4337 Lisp_Object functionlist, overlay;
4338{ 4234{
4339 int oldsize = XVECTOR (last_overlay_modification_hooks)->size; 4235 int oldsize = XVECTOR (last_overlay_modification_hooks)->size;
4340 4236
@@ -4362,10 +4258,8 @@ add_overlay_mod_hooklist (functionlist, overlay)
4362 and the length of deleted or replaced old text. */ 4258 and the length of deleted or replaced old text. */
4363 4259
4364void 4260void
4365report_overlay_modification (start, end, after, arg1, arg2, arg3) 4261report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
4366 Lisp_Object start, end; 4262 Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
4367 int after;
4368 Lisp_Object arg1, arg2, arg3;
4369{ 4263{
4370 Lisp_Object prop, overlay; 4264 Lisp_Object prop, overlay;
4371 struct Lisp_Overlay *tail; 4265 struct Lisp_Overlay *tail;
@@ -4473,8 +4367,8 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3)
4473 Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); 4367 Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
4474 int i; 4368 int i;
4475 4369
4476 bcopy (XVECTOR (last_overlay_modification_hooks)->contents, 4370 memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
4477 copy, size * sizeof (Lisp_Object)); 4371 size * sizeof (Lisp_Object));
4478 gcpro1.var = copy; 4372 gcpro1.var = copy;
4479 gcpro1.nvars = size; 4373 gcpro1.nvars = size;
4480 4374
@@ -4490,10 +4384,8 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3)
4490} 4384}
4491 4385
4492static void 4386static void
4493call_overlay_mod_hooks (list, overlay, after, arg1, arg2, arg3) 4387call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after,
4494 Lisp_Object list, overlay; 4388 Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
4495 int after;
4496 Lisp_Object arg1, arg2, arg3;
4497{ 4389{
4498 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 4390 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
4499 4391
@@ -4513,8 +4405,7 @@ call_overlay_mod_hooks (list, overlay, after, arg1, arg2, arg3)
4513/* Delete any zero-sized overlays at position POS, if the `evaporate' 4405/* Delete any zero-sized overlays at position POS, if the `evaporate'
4514 property is set. */ 4406 property is set. */
4515void 4407void
4516evaporate_overlays (pos) 4408evaporate_overlays (EMACS_INT pos)
4517 EMACS_INT pos;
4518{ 4409{
4519 Lisp_Object overlay, hit_list; 4410 Lisp_Object overlay, hit_list;
4520 struct Lisp_Overlay *tail; 4411 struct Lisp_Overlay *tail;
@@ -4552,9 +4443,7 @@ evaporate_overlays (pos)
4552 in the slot with offset OFFSET. */ 4443 in the slot with offset OFFSET. */
4553 4444
4554void 4445void
4555buffer_slot_type_mismatch (newval, type) 4446buffer_slot_type_mismatch (Lisp_Object newval, int type)
4556 Lisp_Object newval;
4557 int type;
4558{ 4447{
4559 Lisp_Object predicate; 4448 Lisp_Object predicate;
4560 4449
@@ -4693,13 +4582,13 @@ static int mmap_initialized_p;
4693 4582
4694/* Function prototypes. */ 4583/* Function prototypes. */
4695 4584
4696static int mmap_free_1 P_ ((struct mmap_region *)); 4585static int mmap_free_1 (struct mmap_region *);
4697static int mmap_enlarge P_ ((struct mmap_region *, int)); 4586static int mmap_enlarge (struct mmap_region *, int);
4698static struct mmap_region *mmap_find P_ ((POINTER_TYPE *, POINTER_TYPE *)); 4587static struct mmap_region *mmap_find (POINTER_TYPE *, POINTER_TYPE *);
4699static POINTER_TYPE *mmap_alloc P_ ((POINTER_TYPE **, size_t)); 4588static POINTER_TYPE *mmap_alloc (POINTER_TYPE **, size_t);
4700static POINTER_TYPE *mmap_realloc P_ ((POINTER_TYPE **, size_t)); 4589static POINTER_TYPE *mmap_realloc (POINTER_TYPE **, size_t);
4701static void mmap_free P_ ((POINTER_TYPE **ptr)); 4590static void mmap_free (POINTER_TYPE **ptr);
4702static void mmap_init P_ ((void)); 4591static void mmap_init (void);
4703 4592
4704 4593
4705/* Return a region overlapping address range START...END, or null if 4594/* Return a region overlapping address range START...END, or null if
@@ -4942,7 +4831,7 @@ mmap_realloc (var, nbytes)
4942 } 4831 }
4943 else if (mmap_alloc (var, nbytes)) 4832 else if (mmap_alloc (var, nbytes))
4944 { 4833 {
4945 bcopy (old_ptr, *var, r->nbytes_specified); 4834 memcpy (*var, old_ptr, r->nbytes_specified);
4946 mmap_free_1 (MMAP_REGION (old_ptr)); 4835 mmap_free_1 (MMAP_REGION (old_ptr));
4947 result = *var; 4836 result = *var;
4948 r = MMAP_REGION (result); 4837 r = MMAP_REGION (result);
@@ -5032,18 +4921,16 @@ mmap_init ()
5032 ***********************************************************************/ 4921 ***********************************************************************/
5033 4922
5034#ifdef REL_ALLOC 4923#ifdef REL_ALLOC
5035extern POINTER_TYPE *r_alloc P_ ((POINTER_TYPE **, size_t)); 4924extern POINTER_TYPE *r_alloc (POINTER_TYPE **, size_t);
5036extern POINTER_TYPE *r_re_alloc P_ ((POINTER_TYPE **, size_t)); 4925extern POINTER_TYPE *r_re_alloc (POINTER_TYPE **, size_t);
5037extern void r_alloc_free P_ ((POINTER_TYPE **ptr)); 4926extern void r_alloc_free (POINTER_TYPE **ptr);
5038#endif /* REL_ALLOC */ 4927#endif /* REL_ALLOC */
5039 4928
5040 4929
5041/* Allocate NBYTES bytes for buffer B's text buffer. */ 4930/* Allocate NBYTES bytes for buffer B's text buffer. */
5042 4931
5043static void 4932static void
5044alloc_buffer_text (b, nbytes) 4933alloc_buffer_text (struct buffer *b, size_t nbytes)
5045 struct buffer *b;
5046 size_t nbytes;
5047{ 4934{
5048 POINTER_TYPE *p; 4935 POINTER_TYPE *p;
5049 4936
@@ -5098,8 +4985,7 @@ enlarge_buffer_text (struct buffer *b, EMACS_INT delta)
5098/* Free buffer B's text buffer. */ 4985/* Free buffer B's text buffer. */
5099 4986
5100static void 4987static void
5101free_buffer_text (b) 4988free_buffer_text (struct buffer *b)
5102 struct buffer *b;
5103{ 4989{
5104 BLOCK_INPUT; 4990 BLOCK_INPUT;
5105 4991
@@ -5122,11 +5008,11 @@ free_buffer_text (b)
5122 ***********************************************************************/ 5008 ***********************************************************************/
5123 5009
5124void 5010void
5125init_buffer_once () 5011init_buffer_once (void)
5126{ 5012{
5127 int idx; 5013 int idx;
5128 5014
5129 bzero (buffer_permanent_local_flags, sizeof buffer_permanent_local_flags); 5015 memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
5130 5016
5131 /* Make sure all markable slots in buffer_defaults 5017 /* Make sure all markable slots in buffer_defaults
5132 are initialized reasonably, so mark_buffer won't choke. */ 5018 are initialized reasonably, so mark_buffer won't choke. */
@@ -5214,7 +5100,7 @@ init_buffer_once ()
5214 if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort (); 5100 if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
5215 5101
5216 /* 0 means not a lisp var, -1 means always local, else mask */ 5102 /* 0 means not a lisp var, -1 means always local, else mask */
5217 bzero (&buffer_local_flags, sizeof buffer_local_flags); 5103 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5218 XSETINT (buffer_local_flags.filename, -1); 5104 XSETINT (buffer_local_flags.filename, -1);
5219 XSETINT (buffer_local_flags.directory, -1); 5105 XSETINT (buffer_local_flags.directory, -1);
5220 XSETINT (buffer_local_flags.backed_up, -1); 5106 XSETINT (buffer_local_flags.backed_up, -1);
@@ -5318,7 +5204,7 @@ init_buffer_once ()
5318} 5204}
5319 5205
5320void 5206void
5321init_buffer () 5207init_buffer (void)
5322{ 5208{
5323 char *pwd; 5209 char *pwd;
5324 Lisp_Object temp; 5210 Lisp_Object temp;
@@ -5402,12 +5288,8 @@ init_buffer ()
5402 } while (0) 5288 } while (0)
5403 5289
5404static void 5290static void
5405defvar_per_buffer (bo_fwd, namestring, address, type, doc) 5291defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, char *namestring,
5406 struct Lisp_Buffer_Objfwd *bo_fwd; 5292 Lisp_Object *address, Lisp_Object type, char *doc)
5407 char *namestring;
5408 Lisp_Object *address;
5409 Lisp_Object type;
5410 char *doc;
5411{ 5293{
5412 struct Lisp_Symbol *sym; 5294 struct Lisp_Symbol *sym;
5413 int offset; 5295 int offset;
@@ -5436,7 +5318,7 @@ defvar_per_buffer (bo_fwd, namestring, address, type, doc)
5436 5318
5437/* initialize the buffer routines */ 5319/* initialize the buffer routines */
5438void 5320void
5439syms_of_buffer () 5321syms_of_buffer (void)
5440{ 5322{
5441 staticpro (&last_overlay_modification_hooks); 5323 staticpro (&last_overlay_modification_hooks);
5442 last_overlay_modification_hooks 5324 last_overlay_modification_hooks
@@ -6339,7 +6221,7 @@ The function `kill-all-local-variables' runs this before doing anything else. *
6339} 6221}
6340 6222
6341void 6223void
6342keys_of_buffer () 6224keys_of_buffer (void)
6343{ 6225{
6344 initial_define_key (control_x_map, 'b', "switch-to-buffer"); 6226 initial_define_key (control_x_map, 'b', "switch-to-buffer");
6345 initial_define_key (control_x_map, 'k', "kill-buffer"); 6227 initial_define_key (control_x_map, 'k', "kill-buffer");