comparison src/buffer.c @ 109179:8cfee7d2955f

Convert DEFUNs to standard C. * src/alloc.c: Convert DEFUNs to standard C. * src/buffer.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/dosfns.c: * src/editfns.c: * src/emacs.c: * src/eval.c: * src/fileio.c: * src/filelock.c: * src/floatfns.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/image.c: * src/indent.c: * src/insdel.c: * src/keyboard.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/menu.c: * src/minibuf.c: * src/msdos.c: * src/nsfns.m: * src/nsmenu.m: * src/nsselect.m: * src/print.c: * src/process.c: * src/search.c: * src/sound.c: * src/syntax.c: * src/term.c: * src/terminal.c: * src/textprop.c: * src/undo.c: * src/w16select.c: * src/w32console.c: * src/w32fns.c: * src/w32font.c: * src/w32menu.c: * src/w32proc.c: * src/w32select.c: * src/window.c: * src/xdisp.c: * src/xfaces.c: * src/xfns.c: * src/xmenu.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: Likewise.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 08 Jul 2010 14:25:08 -0700
parents 750db9f3e6d8
children 5b332381f0a9
comparison
equal deleted inserted replaced
109178:53f8ebcd9a97 109179:8cfee7d2955f
188 } 188 }
189 189
190 DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, 190 DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
191 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.
192 Value is nil if OBJECT is not a buffer or if it has been killed. */) 192 Value is nil if OBJECT is not a buffer or if it has been killed. */)
193 (object) 193 (Lisp_Object object)
194 Lisp_Object object;
195 { 194 {
196 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) 195 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name))
197 ? Qt : Qnil); 196 ? Qt : Qnil);
198 } 197 }
199 198
200 DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, 199 DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0,
201 doc: /* Return a list of all existing live buffers. 200 doc: /* Return a list of all existing live buffers.
202 If the optional arg FRAME is a frame, we return the buffer list 201 If the optional arg FRAME is a frame, we return the buffer list
203 in the proper order for that frame: the buffers in FRAME's `buffer-list' 202 in the proper order for that frame: the buffers in FRAME's `buffer-list'
204 frame parameter come first, followed by the rest of the buffers. */) 203 frame parameter come first, followed by the rest of the buffers. */)
205 (frame) 204 (Lisp_Object frame)
206 Lisp_Object frame;
207 { 205 {
208 Lisp_Object general; 206 Lisp_Object general;
209 general = Fmapcar (Qcdr, Vbuffer_alist); 207 general = Fmapcar (Qcdr, Vbuffer_alist);
210 208
211 if (FRAMEP (frame)) 209 if (FRAMEP (frame))
264 DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, 262 DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0,
265 doc: /* Return the buffer named BUFFER-OR-NAME. 263 doc: /* Return the buffer named BUFFER-OR-NAME.
266 BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME 264 BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME
267 is a string and there is no buffer with that name, return nil. If 265 is a string and there is no buffer with that name, return nil. If
268 BUFFER-OR-NAME is a buffer, return it as given. */) 266 BUFFER-OR-NAME is a buffer, return it as given. */)
269 (buffer_or_name) 267 (register Lisp_Object buffer_or_name)
270 register Lisp_Object buffer_or_name;
271 { 268 {
272 if (BUFFERP (buffer_or_name)) 269 if (BUFFERP (buffer_or_name))
273 return buffer_or_name; 270 return buffer_or_name;
274 CHECK_STRING (buffer_or_name); 271 CHECK_STRING (buffer_or_name);
275 272
279 DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0, 276 DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0,
280 doc: /* Return the buffer visiting file FILENAME (a string). 277 doc: /* Return the buffer visiting file FILENAME (a string).
281 The buffer's `buffer-file-name' must match exactly the expansion of FILENAME. 278 The buffer's `buffer-file-name' must match exactly the expansion of FILENAME.
282 If there is no such live buffer, return nil. 279 If there is no such live buffer, return nil.
283 See also `find-buffer-visiting'. */) 280 See also `find-buffer-visiting'. */)
284 (filename) 281 (register Lisp_Object filename)
285 register Lisp_Object filename;
286 { 282 {
287 register Lisp_Object tail, buf, tem; 283 register Lisp_Object tail, buf, tem;
288 Lisp_Object handler; 284 Lisp_Object handler;
289 285
290 CHECK_STRING (filename); 286 CHECK_STRING (filename);
335 that name and return it. If BUFFER-OR-NAME starts with a space, the new 331 that name and return it. If BUFFER-OR-NAME starts with a space, the new
336 buffer does not keep undo information. 332 buffer does not keep undo information.
337 333
338 If BUFFER-OR-NAME is a buffer instead of a string, return it as given, 334 If BUFFER-OR-NAME is a buffer instead of a string, return it as given,
339 even if it is dead. The return value is never nil. */) 335 even if it is dead. The return value is never nil. */)
340 (buffer_or_name) 336 (register Lisp_Object buffer_or_name)
341 register Lisp_Object buffer_or_name;
342 { 337 {
343 register Lisp_Object buffer, name; 338 register Lisp_Object buffer, name;
344 register struct buffer *b; 339 register struct buffer *b;
345 340
346 buffer = Fget_buffer (buffer_or_name); 341 buffer = Fget_buffer (buffer_or_name);
531 BASE-BUFFER should be a live buffer, or the name of an existing buffer. 526 BASE-BUFFER should be a live buffer, or the name of an existing buffer.
532 NAME should be a string which is not the name of an existing buffer. 527 NAME should be a string which is not the name of an existing buffer.
533 Optional argument CLONE non-nil means preserve BASE-BUFFER's state, 528 Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
534 such as major and minor modes, in the indirect buffer. 529 such as major and minor modes, in the indirect buffer.
535 CLONE nil means the indirect buffer's state is reset to default values. */) 530 CLONE nil means the indirect buffer's state is reset to default values. */)
536 (base_buffer, name, clone) 531 (Lisp_Object base_buffer, Lisp_Object name, Lisp_Object clone)
537 Lisp_Object base_buffer, name, clone;
538 { 532 {
539 Lisp_Object buf, tem; 533 Lisp_Object buf, tem;
540 struct buffer *b; 534 struct buffer *b;
541 535
542 CHECK_STRING (name); 536 CHECK_STRING (name);
827 If there is no live buffer named NAME, then return NAME. 821 If there is no live buffer named NAME, then return NAME.
828 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER 822 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
829 \(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.
830 Optional second argument IGNORE specifies a name that is okay to use (if 824 Optional second argument IGNORE specifies a name that is okay to use (if
831 it is in the sequence to be tried) even if a buffer with that name exists. */) 825 it is in the sequence to be tried) even if a buffer with that name exists. */)
832 (name, ignore) 826 (register Lisp_Object name, Lisp_Object ignore)
833 register Lisp_Object name, ignore;
834 { 827 {
835 register Lisp_Object gentemp, tem; 828 register Lisp_Object gentemp, tem;
836 int count; 829 int count;
837 char number[10]; 830 char number[10];
838 831
862 855
863 DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, 856 DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0,
864 doc: /* Return the name of BUFFER, as a string. 857 doc: /* Return the name of BUFFER, as a string.
865 BUFFER defaults to the current buffer. 858 BUFFER defaults to the current buffer.
866 Return nil if BUFFER has been killed. */) 859 Return nil if BUFFER has been killed. */)
867 (buffer) 860 (register Lisp_Object buffer)
868 register Lisp_Object buffer;
869 { 861 {
870 if (NILP (buffer)) 862 if (NILP (buffer))
871 return current_buffer->name; 863 return current_buffer->name;
872 CHECK_BUFFER (buffer); 864 CHECK_BUFFER (buffer);
873 return XBUFFER (buffer)->name; 865 return XBUFFER (buffer)->name;
874 } 866 }
875 867
876 DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, 868 DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
877 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.
878 No argument or nil as argument means use the current buffer. */) 870 No argument or nil as argument means use the current buffer. */)
879 (buffer) 871 (register Lisp_Object buffer)
880 register Lisp_Object buffer;
881 { 872 {
882 if (NILP (buffer)) 873 if (NILP (buffer))
883 return current_buffer->filename; 874 return current_buffer->filename;
884 CHECK_BUFFER (buffer); 875 CHECK_BUFFER (buffer);
885 return XBUFFER (buffer)->filename; 876 return XBUFFER (buffer)->filename;
888 DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer, 879 DEFUN ("buffer-base-buffer", Fbuffer_base_buffer, Sbuffer_base_buffer,
889 0, 1, 0, 880 0, 1, 0,
890 doc: /* Return the base buffer of indirect buffer BUFFER. 881 doc: /* Return the base buffer of indirect buffer BUFFER.
891 If BUFFER is not indirect, return nil. 882 If BUFFER is not indirect, return nil.
892 BUFFER defaults to the current buffer. */) 883 BUFFER defaults to the current buffer. */)
893 (buffer) 884 (register Lisp_Object buffer)
894 register Lisp_Object buffer;
895 { 885 {
896 struct buffer *base; 886 struct buffer *base;
897 Lisp_Object base_buffer; 887 Lisp_Object base_buffer;
898 888
899 if (NILP (buffer)) 889 if (NILP (buffer))
913 DEFUN ("buffer-local-value", Fbuffer_local_value, 903 DEFUN ("buffer-local-value", Fbuffer_local_value,
914 Sbuffer_local_value, 2, 2, 0, 904 Sbuffer_local_value, 2, 2, 0,
915 doc: /* Return the value of VARIABLE in BUFFER. 905 doc: /* Return the value of VARIABLE in BUFFER.
916 If VARIABLE does not have a buffer-local binding in BUFFER, the value 906 If VARIABLE does not have a buffer-local binding in BUFFER, the value
917 is the default binding of the variable. */) 907 is the default binding of the variable. */)
918 (variable, buffer) 908 (register Lisp_Object variable, register Lisp_Object buffer)
919 register Lisp_Object variable;
920 register Lisp_Object buffer;
921 { 909 {
922 register struct buffer *buf; 910 register struct buffer *buf;
923 register Lisp_Object result; 911 register Lisp_Object result;
924 struct Lisp_Symbol *sym; 912 struct Lisp_Symbol *sym;
925 913
1013 doc: /* Return an alist of variables that are buffer-local in BUFFER. 1001 doc: /* Return an alist of variables that are buffer-local in BUFFER.
1014 Most elements look like (SYMBOL . VALUE), describing one variable. 1002 Most elements look like (SYMBOL . VALUE), describing one variable.
1015 For a symbol that is locally unbound, just the symbol appears in the value. 1003 For a symbol that is locally unbound, just the symbol appears in the value.
1016 Note that storing new VALUEs in these elements doesn't change the variables. 1004 Note that storing new VALUEs in these elements doesn't change the variables.
1017 No argument or nil as argument means use current buffer as BUFFER. */) 1005 No argument or nil as argument means use current buffer as BUFFER. */)
1018 (buffer) 1006 (register Lisp_Object buffer)
1019 register Lisp_Object buffer;
1020 { 1007 {
1021 register struct buffer *buf; 1008 register struct buffer *buf;
1022 register Lisp_Object result; 1009 register Lisp_Object result;
1023 1010
1024 if (NILP (buffer)) 1011 if (NILP (buffer))
1056 1043
1057 DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, 1044 DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p,
1058 0, 1, 0, 1045 0, 1, 0,
1059 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.
1060 No argument or nil as argument means use current buffer as BUFFER. */) 1047 No argument or nil as argument means use current buffer as BUFFER. */)
1061 (buffer) 1048 (register Lisp_Object buffer)
1062 register Lisp_Object buffer;
1063 { 1049 {
1064 register struct buffer *buf; 1050 register struct buffer *buf;
1065 if (NILP (buffer)) 1051 if (NILP (buffer))
1066 buf = current_buffer; 1052 buf = current_buffer;
1067 else 1053 else
1075 1061
1076 DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1062 DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1077 1, 1, 0, 1063 1, 1, 0,
1078 doc: /* Mark current buffer as modified or unmodified according to FLAG. 1064 doc: /* Mark current buffer as modified or unmodified according to FLAG.
1079 A non-nil FLAG means mark the buffer modified. */) 1065 A non-nil FLAG means mark the buffer modified. */)
1080 (flag) 1066 (register Lisp_Object flag)
1081 register Lisp_Object flag;
1082 { 1067 {
1083 register int already; 1068 register int already;
1084 register Lisp_Object fn; 1069 register Lisp_Object fn;
1085 Lisp_Object buffer, window; 1070 Lisp_Object buffer, window;
1086 1071
1145 DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, 1130 DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p,
1146 Srestore_buffer_modified_p, 1, 1, 0, 1131 Srestore_buffer_modified_p, 1, 1, 0,
1147 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. 1132 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay.
1148 It is not ensured that mode lines will be updated to show the modified 1133 It is not ensured that mode lines will be updated to show the modified
1149 state of the current buffer. Use with care. */) 1134 state of the current buffer. Use with care. */)
1150 (flag) 1135 (Lisp_Object flag)
1151 Lisp_Object flag;
1152 { 1136 {
1153 #ifdef CLASH_DETECTION 1137 #ifdef CLASH_DETECTION
1154 Lisp_Object fn; 1138 Lisp_Object fn;
1155 1139
1156 /* If buffer becoming modified, lock the file. 1140 /* If buffer becoming modified, lock the file.
1176 0, 1, 0, 1160 0, 1, 0,
1177 doc: /* Return BUFFER's tick counter, incremented for each change in text. 1161 doc: /* Return BUFFER's tick counter, incremented for each change in text.
1178 Each buffer has a tick counter which is incremented each time the 1162 Each buffer has a tick counter which is incremented each time the
1179 text in that buffer is changed. It wraps around occasionally. 1163 text in that buffer is changed. It wraps around occasionally.
1180 No argument or nil as argument means use current buffer as BUFFER. */) 1164 No argument or nil as argument means use current buffer as BUFFER. */)
1181 (buffer) 1165 (register Lisp_Object buffer)
1182 register Lisp_Object buffer;
1183 { 1166 {
1184 register struct buffer *buf; 1167 register struct buffer *buf;
1185 if (NILP (buffer)) 1168 if (NILP (buffer))
1186 buf = current_buffer; 1169 buf = current_buffer;
1187 else 1170 else
1201 time text in that buffer is inserted or deleted. By comparing the 1184 time text in that buffer is inserted or deleted. By comparing the
1202 values returned by two individual calls of `buffer-chars-modified-tick', 1185 values returned by two individual calls of `buffer-chars-modified-tick',
1203 you can tell whether a character change occurred in that buffer in 1186 you can tell whether a character change occurred in that buffer in
1204 between these calls. No argument or nil as argument means use current 1187 between these calls. No argument or nil as argument means use current
1205 buffer as BUFFER. */) 1188 buffer as BUFFER. */)
1206 (buffer) 1189 (register Lisp_Object buffer)
1207 register Lisp_Object buffer;
1208 { 1190 {
1209 register struct buffer *buf; 1191 register struct buffer *buf;
1210 if (NILP (buffer)) 1192 if (NILP (buffer))
1211 buf = current_buffer; 1193 buf = current_buffer;
1212 else 1194 else
1228 If UNIQUE is non-nil, come up with a new name using 1210 If UNIQUE is non-nil, come up with a new name using
1229 `generate-new-buffer-name'. 1211 `generate-new-buffer-name'.
1230 Interactively, you can set UNIQUE with a prefix argument. 1212 Interactively, you can set UNIQUE with a prefix argument.
1231 We return the name we actually gave the buffer. 1213 We return the name we actually gave the buffer.
1232 This does not change the name of the visited file (if any). */) 1214 This does not change the name of the visited file (if any). */)
1233 (newname, unique) 1215 (register Lisp_Object newname, Lisp_Object unique)
1234 register Lisp_Object newname, unique;
1235 { 1216 {
1236 register Lisp_Object tem, buf; 1217 register Lisp_Object tem, buf;
1237 1218
1238 CHECK_STRING (newname); 1219 CHECK_STRING (newname);
1239 1220
1276 unless optional second argument VISIBLE-OK is non-nil. 1257 unless optional second argument VISIBLE-OK is non-nil.
1277 If the optional third argument FRAME is non-nil, use that frame's 1258 If the optional third argument FRAME is non-nil, use that frame's
1278 buffer list instead of the selected frame's buffer list. 1259 buffer list instead of the selected frame's buffer list.
1279 If no other buffer exists, the buffer `*scratch*' is returned. 1260 If no other buffer exists, the buffer `*scratch*' is returned.
1280 If BUFFER is omitted or nil, some interesting buffer is returned. */) 1261 If BUFFER is omitted or nil, some interesting buffer is returned. */)
1281 (buffer, visible_ok, frame) 1262 (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
1282 register Lisp_Object buffer, visible_ok, frame;
1283 { 1263 {
1284 Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer); 1264 Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
1285 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; 1265 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons;
1286 notsogood = Qnil; 1266 notsogood = Qnil;
1287 1267
1348 1328
1349 DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, 1329 DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo,
1350 0, 1, "", 1330 0, 1, "",
1351 doc: /* Start keeping undo information for buffer BUFFER. 1331 doc: /* Start keeping undo information for buffer BUFFER.
1352 No argument or nil as argument means do this for the current buffer. */) 1332 No argument or nil as argument means do this for the current buffer. */)
1353 (buffer) 1333 (register Lisp_Object buffer)
1354 register Lisp_Object buffer;
1355 { 1334 {
1356 Lisp_Object real_buffer; 1335 Lisp_Object real_buffer;
1357 1336
1358 if (NILP (buffer)) 1337 if (NILP (buffer))
1359 XSETBUFFER (real_buffer, current_buffer); 1338 XSETBUFFER (real_buffer, current_buffer);
1390 actually killed. The buffer being killed will be current while the hook 1369 actually killed. The buffer being killed will be current while the hook
1391 is running. 1370 is running.
1392 1371
1393 Any processes that have this buffer as the `process-buffer' are killed 1372 Any processes that have this buffer as the `process-buffer' are killed
1394 with SIGHUP. */) 1373 with SIGHUP. */)
1395 (buffer_or_name) 1374 (Lisp_Object buffer_or_name)
1396 Lisp_Object buffer_or_name;
1397 { 1375 {
1398 Lisp_Object buffer; 1376 Lisp_Object buffer;
1399 register struct buffer *b; 1377 register struct buffer *b;
1400 register Lisp_Object tem; 1378 register Lisp_Object tem;
1401 register struct Lisp_Marker *m; 1379 register struct Lisp_Marker *m;
1680 doc: /* Set an appropriate major mode for BUFFER. 1658 doc: /* Set an appropriate major mode for BUFFER.
1681 For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode 1659 For the *scratch* buffer, use `initial-major-mode', otherwise choose a mode
1682 according to `default-major-mode'. 1660 according to `default-major-mode'.
1683 Use this function before selecting the buffer, since it may need to inspect 1661 Use this function before selecting the buffer, since it may need to inspect
1684 the current buffer's major mode. */) 1662 the current buffer's major mode. */)
1685 (buffer) 1663 (Lisp_Object buffer)
1686 Lisp_Object buffer;
1687 { 1664 {
1688 int count; 1665 int count;
1689 Lisp_Object function; 1666 Lisp_Object function;
1690 1667
1691 CHECK_BUFFER (buffer); 1668 CHECK_BUFFER (buffer);
1768 its buffer, use `pop-to-buffer' for displaying the buffer. 1745 its buffer, use `pop-to-buffer' for displaying the buffer.
1769 1746
1770 WARNING: This is NOT the way to work on another buffer temporarily 1747 WARNING: This is NOT the way to work on another buffer temporarily
1771 within a Lisp program! Use `set-buffer' instead. That avoids 1748 within a Lisp program! Use `set-buffer' instead. That avoids
1772 messing with the window-buffer correspondences. */) 1749 messing with the window-buffer correspondences. */)
1773 (buffer_or_name, norecord) 1750 (Lisp_Object buffer_or_name, Lisp_Object norecord)
1774 Lisp_Object buffer_or_name, norecord;
1775 { 1751 {
1776 if (EQ (buffer_or_name, Fwindow_buffer (selected_window))) 1752 if (EQ (buffer_or_name, Fwindow_buffer (selected_window)))
1777 { 1753 {
1778 /* Basically a NOP. Avoid signalling an error in the case where 1754 /* Basically a NOP. Avoid signalling an error in the case where
1779 the selected window is dedicated, or a minibuffer. */ 1755 the selected window is dedicated, or a minibuffer. */
1798 return switch_to_buffer_1 (buffer_or_name, norecord); 1774 return switch_to_buffer_1 (buffer_or_name, norecord);
1799 } 1775 }
1800 1776
1801 DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, 1777 DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
1802 doc: /* Return the current buffer as a Lisp object. */) 1778 doc: /* Return the current buffer as a Lisp object. */)
1803 () 1779 (void)
1804 { 1780 {
1805 register Lisp_Object buf; 1781 register Lisp_Object buf;
1806 XSETBUFFER (buf, current_buffer); 1782 XSETBUFFER (buf, current_buffer);
1807 return buf; 1783 return buf;
1808 } 1784 }
1984 BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See 1960 BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See
1985 also `save-excursion' when you want to make a buffer current 1961 also `save-excursion' when you want to make a buffer current
1986 temporarily. This function does not display the buffer, so its effect 1962 temporarily. This function does not display the buffer, so its effect
1987 ends when the current command terminates. Use `switch-to-buffer' or 1963 ends when the current command terminates. Use `switch-to-buffer' or
1988 `pop-to-buffer' to switch buffers permanently. */) 1964 `pop-to-buffer' to switch buffers permanently. */)
1989 (buffer_or_name) 1965 (register Lisp_Object buffer_or_name)
1990 register Lisp_Object buffer_or_name;
1991 { 1966 {
1992 register Lisp_Object buffer; 1967 register Lisp_Object buffer;
1993 buffer = Fget_buffer (buffer_or_name); 1968 buffer = Fget_buffer (buffer_or_name);
1994 if (NILP (buffer)) 1969 if (NILP (buffer))
1995 nsberror (buffer_or_name); 1970 nsberror (buffer_or_name);
2010 } 1985 }
2011 1986
2012 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 1987 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
2013 Sbarf_if_buffer_read_only, 0, 0, 0, 1988 Sbarf_if_buffer_read_only, 0, 0, 0,
2014 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. */)
2015 () 1990 (void)
2016 { 1991 {
2017 if (!NILP (current_buffer->read_only) 1992 if (!NILP (current_buffer->read_only)
2018 && NILP (Vinhibit_read_only)) 1993 && NILP (Vinhibit_read_only))
2019 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ()); 1994 xsignal1 (Qbuffer_read_only, Fcurrent_buffer ());
2020 return Qnil; 1995 return Qnil;
2030 BUFFER-OR-NAME is nil or omitted, bury the current buffer and remove it 2005 BUFFER-OR-NAME is nil or omitted, bury the current buffer and remove it
2031 from the selected window if it is displayed there. If the selected 2006 from the selected window if it is displayed there. If the selected
2032 window is dedicated to its buffer, delete that window if there are other 2007 window is dedicated to its buffer, delete that window if there are other
2033 windows on the same frame. If the selected window is the only window on 2008 windows on the same frame. If the selected window is the only window on
2034 its frame, iconify that frame. */) 2009 its frame, iconify that frame. */)
2035 (buffer_or_name) 2010 (register Lisp_Object buffer_or_name)
2036 register Lisp_Object buffer_or_name;
2037 { 2011 {
2038 Lisp_Object buffer; 2012 Lisp_Object buffer;
2039 2013
2040 /* Figure out what buffer we're going to bury. */ 2014 /* Figure out what buffer we're going to bury. */
2041 if (NILP (buffer_or_name)) 2015 if (NILP (buffer_or_name))
2085 2059
2086 DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", 2060 DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*",
2087 doc: /* Delete the entire contents of the current buffer. 2061 doc: /* Delete the entire contents of the current buffer.
2088 Any narrowing restriction in effect (see `narrow-to-region') is removed, 2062 Any narrowing restriction in effect (see `narrow-to-region') is removed,
2089 so the buffer is truly empty after this. */) 2063 so the buffer is truly empty after this. */)
2090 () 2064 (void)
2091 { 2065 {
2092 Fwiden (); 2066 Fwiden ();
2093 2067
2094 del_range (BEG, Z); 2068 del_range (BEG, Z);
2095 2069
2159 #endif /* REL_ALLOC */ 2133 #endif /* REL_ALLOC */
2160 2134
2161 DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, 2135 DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2162 1, 1, 0, 2136 1, 1, 0,
2163 doc: /* Swap the text between current buffer and BUFFER. */) 2137 doc: /* Swap the text between current buffer and BUFFER. */)
2164 (buffer) 2138 (Lisp_Object buffer)
2165 Lisp_Object buffer;
2166 { 2139 {
2167 struct buffer *other_buffer; 2140 struct buffer *other_buffer;
2168 CHECK_BUFFER (buffer); 2141 CHECK_BUFFER (buffer);
2169 other_buffer = XBUFFER (buffer); 2142 other_buffer = XBUFFER (buffer);
2170 2143
2298 bytes but the contents viewed as characters do change. 2271 bytes but the contents viewed as characters do change.
2299 If FLAG is `to', this makes the buffer a multibyte buffer by changing 2272 If FLAG is `to', this makes the buffer a multibyte buffer by changing
2300 all eight-bit bytes to eight-bit characters. 2273 all eight-bit bytes to eight-bit characters.
2301 If the multibyte flag was really changed, undo information of the 2274 If the multibyte flag was really changed, undo information of the
2302 current buffer is cleared. */) 2275 current buffer is cleared. */)
2303 (flag) 2276 (Lisp_Object flag)
2304 Lisp_Object flag;
2305 { 2277 {
2306 struct Lisp_Marker *tail, *markers; 2278 struct Lisp_Marker *tail, *markers;
2307 struct buffer *other; 2279 struct buffer *other;
2308 int begv, zv; 2280 int begv, zv;
2309 int narrowed = (BEG != BEGV || Z != ZV); 2281 int narrowed = (BEG != BEGV || Z != ZV);
2597 As a special exception, local variables whose names have 2569 As a special exception, local variables whose names have
2598 a non-nil `permanent-local' property are not eliminated by this function. 2570 a non-nil `permanent-local' property are not eliminated by this function.
2599 2571
2600 The first thing this function does is run 2572 The first thing this function does is run
2601 the normal hook `change-major-mode-hook'. */) 2573 the normal hook `change-major-mode-hook'. */)
2602 () 2574 (void)
2603 { 2575 {
2604 if (!NILP (Vrun_hooks)) 2576 if (!NILP (Vrun_hooks))
2605 call1 (Vrun_hooks, Qchange_major_mode_hook); 2577 call1 (Vrun_hooks, Qchange_major_mode_hook);
2606 2578
2607 /* Make sure none of the bindings in local_var_alist 2579 /* Make sure none of the bindings in local_var_alist
3698 } 3670 }
3699 } 3671 }
3700 3672
3701 DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0, 3673 DEFUN ("overlayp", Foverlayp, Soverlayp, 1, 1, 0,
3702 doc: /* Return t if OBJECT is an overlay. */) 3674 doc: /* Return t if OBJECT is an overlay. */)
3703 (object) 3675 (Lisp_Object object)
3704 Lisp_Object object;
3705 { 3676 {
3706 return (OVERLAYP (object) ? Qt : Qnil); 3677 return (OVERLAYP (object) ? Qt : Qnil);
3707 } 3678 }
3708 3679
3709 DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0, 3680 DEFUN ("make-overlay", Fmake_overlay, Smake_overlay, 2, 5, 0,
3714 for the front of the overlay advance when text is inserted there 3685 for the front of the overlay advance when text is inserted there
3715 \(which means the text *is not* included in the overlay). 3686 \(which means the text *is not* included in the overlay).
3716 The fifth arg REAR-ADVANCE, if non-nil, makes the marker 3687 The fifth arg REAR-ADVANCE, if non-nil, makes the marker
3717 for the rear of the overlay advance when text is inserted there 3688 for the rear of the overlay advance when text is inserted there
3718 \(which means the text *is* included in the overlay). */) 3689 \(which means the text *is* included in the overlay). */)
3719 (beg, end, buffer, front_advance, rear_advance) 3690 (Lisp_Object beg, Lisp_Object end, Lisp_Object buffer, Lisp_Object front_advance, Lisp_Object rear_advance)
3720 Lisp_Object beg, end, buffer;
3721 Lisp_Object front_advance, rear_advance;
3722 { 3691 {
3723 Lisp_Object overlay; 3692 Lisp_Object overlay;
3724 struct buffer *b; 3693 struct buffer *b;
3725 3694
3726 if (NILP (buffer)) 3695 if (NILP (buffer))
3836 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, 3805 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
3837 doc: /* Set the endpoints of OVERLAY to BEG and END in BUFFER. 3806 doc: /* Set the endpoints of OVERLAY to BEG and END in BUFFER.
3838 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now. 3807 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.
3839 If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current 3808 If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current
3840 buffer. */) 3809 buffer. */)
3841 (overlay, beg, end, buffer) 3810 (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer)
3842 Lisp_Object overlay, beg, end, buffer;
3843 { 3811 {
3844 struct buffer *b, *ob; 3812 struct buffer *b, *ob;
3845 Lisp_Object obuffer; 3813 Lisp_Object obuffer;
3846 int count = SPECPDL_INDEX (); 3814 int count = SPECPDL_INDEX ();
3847 3815
3946 return unbind_to (count, overlay); 3914 return unbind_to (count, overlay);
3947 } 3915 }
3948 3916
3949 DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, 3917 DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
3950 doc: /* Delete the overlay OVERLAY from its buffer. */) 3918 doc: /* Delete the overlay OVERLAY from its buffer. */)
3951 (overlay) 3919 (Lisp_Object overlay)
3952 Lisp_Object overlay;
3953 { 3920 {
3954 Lisp_Object buffer; 3921 Lisp_Object buffer;
3955 struct buffer *b; 3922 struct buffer *b;
3956 int count = SPECPDL_INDEX (); 3923 int count = SPECPDL_INDEX ();
3957 3924
3987 3954
3988 /* Overlay dissection functions. */ 3955 /* Overlay dissection functions. */
3989 3956
3990 DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, 3957 DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
3991 doc: /* Return the position at which OVERLAY starts. */) 3958 doc: /* Return the position at which OVERLAY starts. */)
3992 (overlay) 3959 (Lisp_Object overlay)
3993 Lisp_Object overlay;
3994 { 3960 {
3995 CHECK_OVERLAY (overlay); 3961 CHECK_OVERLAY (overlay);
3996 3962
3997 return (Fmarker_position (OVERLAY_START (overlay))); 3963 return (Fmarker_position (OVERLAY_START (overlay)));
3998 } 3964 }
3999 3965
4000 DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, 3966 DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0,
4001 doc: /* Return the position at which OVERLAY ends. */) 3967 doc: /* Return the position at which OVERLAY ends. */)
4002 (overlay) 3968 (Lisp_Object overlay)
4003 Lisp_Object overlay;
4004 { 3969 {
4005 CHECK_OVERLAY (overlay); 3970 CHECK_OVERLAY (overlay);
4006 3971
4007 return (Fmarker_position (OVERLAY_END (overlay))); 3972 return (Fmarker_position (OVERLAY_END (overlay)));
4008 } 3973 }
4009 3974
4010 DEFUN ("overlay-buffer", Foverlay_buffer, Soverlay_buffer, 1, 1, 0, 3975 DEFUN ("overlay-buffer", Foverlay_buffer, Soverlay_buffer, 1, 1, 0,
4011 doc: /* Return the buffer OVERLAY belongs to. 3976 doc: /* Return the buffer OVERLAY belongs to.
4012 Return nil if OVERLAY has been deleted. */) 3977 Return nil if OVERLAY has been deleted. */)
4013 (overlay) 3978 (Lisp_Object overlay)
4014 Lisp_Object overlay;
4015 { 3979 {
4016 CHECK_OVERLAY (overlay); 3980 CHECK_OVERLAY (overlay);
4017 3981
4018 return Fmarker_buffer (OVERLAY_START (overlay)); 3982 return Fmarker_buffer (OVERLAY_START (overlay));
4019 } 3983 }
4020 3984
4021 DEFUN ("overlay-properties", Foverlay_properties, Soverlay_properties, 1, 1, 0, 3985 DEFUN ("overlay-properties", Foverlay_properties, Soverlay_properties, 1, 1, 0,
4022 doc: /* Return a list of the properties on OVERLAY. 3986 doc: /* Return a list of the properties on OVERLAY.
4023 This is a copy of OVERLAY's plist; modifying its conses has no effect on 3987 This is a copy of OVERLAY's plist; modifying its conses has no effect on
4024 OVERLAY. */) 3988 OVERLAY. */)
4025 (overlay) 3989 (Lisp_Object overlay)
4026 Lisp_Object overlay;
4027 { 3990 {
4028 CHECK_OVERLAY (overlay); 3991 CHECK_OVERLAY (overlay);
4029 3992
4030 return Fcopy_sequence (XOVERLAY (overlay)->plist); 3993 return Fcopy_sequence (XOVERLAY (overlay)->plist);
4031 } 3994 }
4032 3995
4033 3996
4034 DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, 3997 DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
4035 doc: /* Return a list of the overlays that contain the character at POS. */) 3998 doc: /* Return a list of the overlays that contain the character at POS. */)
4036 (pos) 3999 (Lisp_Object pos)
4037 Lisp_Object pos;
4038 { 4000 {
4039 int noverlays; 4001 int noverlays;
4040 Lisp_Object *overlay_vec; 4002 Lisp_Object *overlay_vec;
4041 int len; 4003 int len;
4042 Lisp_Object result; 4004 Lisp_Object result;
4064 Overlap means that at least one character is contained within the overlay 4026 Overlap means that at least one character is contained within the overlay
4065 and also contained within the specified region. 4027 and also contained within the specified region.
4066 Empty overlays are included in the result if they are located at BEG, 4028 Empty overlays are included in the result if they are located at BEG,
4067 between BEG and END, or at END provided END denotes the position at the 4029 between BEG and END, or at END provided END denotes the position at the
4068 end of the buffer. */) 4030 end of the buffer. */)
4069 (beg, end) 4031 (Lisp_Object beg, Lisp_Object end)
4070 Lisp_Object beg, end;
4071 { 4032 {
4072 int noverlays; 4033 int noverlays;
4073 Lisp_Object *overlay_vec; 4034 Lisp_Object *overlay_vec;
4074 int len; 4035 int len;
4075 Lisp_Object result; 4036 Lisp_Object result;
4095 DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, 4056 DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change,
4096 1, 1, 0, 4057 1, 1, 0,
4097 doc: /* Return the next position after POS where an overlay starts or ends. 4058 doc: /* Return the next position after POS where an overlay starts or ends.
4098 If there are no overlay boundaries from POS to (point-max), 4059 If there are no overlay boundaries from POS to (point-max),
4099 the value is (point-max). */) 4060 the value is (point-max). */)
4100 (pos) 4061 (Lisp_Object pos)
4101 Lisp_Object pos;
4102 { 4062 {
4103 int noverlays; 4063 int noverlays;
4104 EMACS_INT endpos; 4064 EMACS_INT endpos;
4105 Lisp_Object *overlay_vec; 4065 Lisp_Object *overlay_vec;
4106 int len; 4066 int len;
4137 DEFUN ("previous-overlay-change", Fprevious_overlay_change, 4097 DEFUN ("previous-overlay-change", Fprevious_overlay_change,
4138 Sprevious_overlay_change, 1, 1, 0, 4098 Sprevious_overlay_change, 1, 1, 0,
4139 doc: /* Return the previous position before POS where an overlay starts or ends. 4099 doc: /* Return the previous position before POS where an overlay starts or ends.
4140 If there are no overlay boundaries from (point-min) to POS, 4100 If there are no overlay boundaries from (point-min) to POS,
4141 the value is (point-min). */) 4101 the value is (point-min). */)
4142 (pos) 4102 (Lisp_Object pos)
4143 Lisp_Object pos;
4144 { 4103 {
4145 int noverlays; 4104 int noverlays;
4146 EMACS_INT prevpos; 4105 EMACS_INT prevpos;
4147 Lisp_Object *overlay_vec; 4106 Lisp_Object *overlay_vec;
4148 int len; 4107 int len;
4174 The car has all the overlays before the overlay center; 4133 The car has all the overlays before the overlay center;
4175 the cdr has all the overlays after the overlay center. 4134 the cdr has all the overlays after the overlay center.
4176 Recentering overlays moves overlays between these lists. 4135 Recentering overlays moves overlays between these lists.
4177 The lists you get are copies, so that changing them has no effect. 4136 The lists you get are copies, so that changing them has no effect.
4178 However, the overlays you get are the real objects that the buffer uses. */) 4137 However, the overlays you get are the real objects that the buffer uses. */)
4179 () 4138 (void)
4180 { 4139 {
4181 struct Lisp_Overlay *ol; 4140 struct Lisp_Overlay *ol;
4182 Lisp_Object before = Qnil, after = Qnil, tmp; 4141 Lisp_Object before = Qnil, after = Qnil, tmp;
4183 for (ol = current_buffer->overlays_before; ol; ol = ol->next) 4142 for (ol = current_buffer->overlays_before; ol; ol = ol->next)
4184 { 4143 {
4195 4154
4196 DEFUN ("overlay-recenter", Foverlay_recenter, Soverlay_recenter, 1, 1, 0, 4155 DEFUN ("overlay-recenter", Foverlay_recenter, Soverlay_recenter, 1, 1, 0,
4197 doc: /* Recenter the overlays of the current buffer around position POS. 4156 doc: /* Recenter the overlays of the current buffer around position POS.
4198 That makes overlay lookup faster for positions near POS (but perhaps slower 4157 That makes overlay lookup faster for positions near POS (but perhaps slower
4199 for positions far away from POS). */) 4158 for positions far away from POS). */)
4200 (pos) 4159 (Lisp_Object pos)
4201 Lisp_Object pos;
4202 { 4160 {
4203 CHECK_NUMBER_COERCE_MARKER (pos); 4161 CHECK_NUMBER_COERCE_MARKER (pos);
4204 4162
4205 recenter_overlay_lists (current_buffer, XINT (pos)); 4163 recenter_overlay_lists (current_buffer, XINT (pos));
4206 return Qnil; 4164 return Qnil;
4207 } 4165 }
4208 4166
4209 DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, 4167 DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
4210 doc: /* Get the property of overlay OVERLAY with property name PROP. */) 4168 doc: /* Get the property of overlay OVERLAY with property name PROP. */)
4211 (overlay, prop) 4169 (Lisp_Object overlay, Lisp_Object prop)
4212 Lisp_Object overlay, prop;
4213 { 4170 {
4214 CHECK_OVERLAY (overlay); 4171 CHECK_OVERLAY (overlay);
4215 return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0); 4172 return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0);
4216 } 4173 }
4217 4174
4218 DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, 4175 DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
4219 doc: /* Set one property of overlay OVERLAY: give property PROP value VALUE. */) 4176 doc: /* Set one property of overlay OVERLAY: give property PROP value VALUE. */)
4220 (overlay, prop, value) 4177 (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value)
4221 Lisp_Object overlay, prop, value;
4222 { 4178 {
4223 Lisp_Object tail, buffer; 4179 Lisp_Object tail, buffer;
4224 int changed; 4180 int changed;
4225 4181
4226 CHECK_OVERLAY (overlay); 4182 CHECK_OVERLAY (overlay);