aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/buffer.c b/src/buffer.c
index a0054e32d0a..a88afbb36e6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -100,6 +100,8 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
100 100
101int last_per_buffer_idx; 101int last_per_buffer_idx;
102 102
103INFUN (Fset_buffer_major_mode, 1);
104INFUN (Fdelete_overlay, 1);
103static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, 105static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
104 int after, Lisp_Object arg1, 106 int after, Lisp_Object arg1,
105 Lisp_Object arg2, Lisp_Object arg3); 107 Lisp_Object arg2, Lisp_Object arg3);
@@ -157,7 +159,7 @@ nsberror (Lisp_Object spec)
157 error ("Invalid buffer argument"); 159 error ("Invalid buffer argument");
158} 160}
159 161
160DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, 162DEFUE ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0,
161 doc: /* Return non-nil if OBJECT is a buffer which has not been killed. 163 doc: /* Return non-nil if OBJECT is a buffer which has not been killed.
162Value is nil if OBJECT is not a buffer or if it has been killed. */) 164Value is nil if OBJECT is not a buffer or if it has been killed. */)
163 (Lisp_Object object) 165 (Lisp_Object object)
@@ -229,7 +231,7 @@ assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list)
229 return Qnil; 231 return Qnil;
230} 232}
231 233
232DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, 234DEFUE ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0,
233 doc: /* Return the buffer named BUFFER-OR-NAME. 235 doc: /* Return the buffer named BUFFER-OR-NAME.
234BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME 236BUFFER-OR-NAME must be either a string or a buffer. If BUFFER-OR-NAME
235is a string and there is no buffer with that name, return nil. If 237is a string and there is no buffer with that name, return nil. If
@@ -294,7 +296,7 @@ get_truename_buffer (register Lisp_Object filename)
294/* Incremented for each buffer created, to assign the buffer number. */ 296/* Incremented for each buffer created, to assign the buffer number. */
295int buffer_count; 297int buffer_count;
296 298
297DEFUN ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0, 299DEFUE ("get-buffer-create", Fget_buffer_create, Sget_buffer_create, 1, 1, 0,
298 doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed. 300 doc: /* Return the buffer specified by BUFFER-OR-NAME, creating a new one if needed.
299If BUFFER-OR-NAME is a string and a live buffer with that name exists, 301If BUFFER-OR-NAME is a string and a live buffer with that name exists,
300return that buffer. If no such buffer exists, create a new buffer with 302return that buffer. If no such buffer exists, create a new buffer with
@@ -830,8 +832,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
830 and set-visited-file-name ought to be able to use this to really 832 and set-visited-file-name ought to be able to use this to really
831 rename the buffer properly. */ 833 rename the buffer properly. */
832 834
833DEFUN ("generate-new-buffer-name", Fgenerate_new_buffer_name, Sgenerate_new_buffer_name, 835DEFUE ("generate-new-buffer-name", Fgenerate_new_buffer_name,
834 1, 2, 0, 836 Sgenerate_new_buffer_name, 1, 2, 0,
835 doc: /* Return a string that is the name of no existing buffer based on NAME. 837 doc: /* Return a string that is the name of no existing buffer based on NAME.
836If there is no live buffer named NAME, then return NAME. 838If there is no live buffer named NAME, then return NAME.
837Otherwise modify name by appending `<NUMBER>', incrementing NUMBER 839Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
@@ -868,7 +870,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */)
868} 870}
869 871
870 872
871DEFUN ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0, 873DEFUE ("buffer-name", Fbuffer_name, Sbuffer_name, 0, 1, 0,
872 doc: /* Return the name of BUFFER, as a string. 874 doc: /* Return the name of BUFFER, as a string.
873BUFFER defaults to the current buffer. 875BUFFER defaults to the current buffer.
874Return nil if BUFFER has been killed. */) 876Return nil if BUFFER has been killed. */)
@@ -880,7 +882,7 @@ Return nil if BUFFER has been killed. */)
880 return BVAR (XBUFFER (buffer), name); 882 return BVAR (XBUFFER (buffer), name);
881} 883}
882 884
883DEFUN ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0, 885DEFUE ("buffer-file-name", Fbuffer_file_name, Sbuffer_file_name, 0, 1, 0,
884 doc: /* Return name of file BUFFER is visiting, or nil if none. 886 doc: /* Return name of file BUFFER is visiting, or nil if none.
885No argument or nil as argument means use the current buffer. */) 887No argument or nil as argument means use the current buffer. */)
886 (register Lisp_Object buffer) 888 (register Lisp_Object buffer)
@@ -915,7 +917,7 @@ BUFFER defaults to the current buffer. */)
915 return base_buffer; 917 return base_buffer;
916} 918}
917 919
918DEFUN ("buffer-local-value", Fbuffer_local_value, 920DEFUE ("buffer-local-value", Fbuffer_local_value,
919 Sbuffer_local_value, 2, 2, 0, 921 Sbuffer_local_value, 2, 2, 0,
920 doc: /* Return the value of VARIABLE in BUFFER. 922 doc: /* Return the value of VARIABLE in BUFFER.
921If VARIABLE does not have a buffer-local binding in BUFFER, the value 923If VARIABLE does not have a buffer-local binding in BUFFER, the value
@@ -1056,7 +1058,7 @@ No argument or nil as argument means use current buffer as BUFFER. */)
1056 return result; 1058 return result;
1057} 1059}
1058 1060
1059DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, 1061DEFUE ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p,
1060 0, 1, 0, 1062 0, 1, 0,
1061 doc: /* Return t if BUFFER was modified since its file was last read or saved. 1063 doc: /* Return t if BUFFER was modified since its file was last read or saved.
1062No argument or nil as argument means use current buffer as BUFFER. */) 1064No argument or nil as argument means use current buffer as BUFFER. */)
@@ -1074,7 +1076,7 @@ No argument or nil as argument means use current buffer as BUFFER. */)
1074 return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil; 1076 return BUF_SAVE_MODIFF (buf) < BUF_MODIFF (buf) ? Qt : Qnil;
1075} 1077}
1076 1078
1077DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p, 1079DEFUE ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1078 1, 1, 0, 1080 1, 1, 0,
1079 doc: /* Mark current buffer as modified or unmodified according to FLAG. 1081 doc: /* Mark current buffer as modified or unmodified according to FLAG.
1080A non-nil FLAG means mark the buffer modified. */) 1082A non-nil FLAG means mark the buffer modified. */)
@@ -1266,7 +1268,7 @@ This does not change the name of the visited file (if any). */)
1266 return BVAR (current_buffer, name); 1268 return BVAR (current_buffer, name);
1267} 1269}
1268 1270
1269DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, 1271DEFUE ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
1270 doc: /* Return most recently selected buffer other than BUFFER. 1272 doc: /* Return most recently selected buffer other than BUFFER.
1271Buffers not visible in windows are preferred to visible buffers, 1273Buffers not visible in windows are preferred to visible buffers,
1272unless optional second argument VISIBLE-OK is non-nil. 1274unless optional second argument VISIBLE-OK is non-nil.
@@ -1276,7 +1278,6 @@ If no other buffer exists, the buffer `*scratch*' is returned.
1276If BUFFER is omitted or nil, some interesting buffer is returned. */) 1278If BUFFER is omitted or nil, some interesting buffer is returned. */)
1277 (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame) 1279 (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
1278{ 1280{
1279 Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
1280 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons; 1281 register Lisp_Object tail, buf, notsogood, tem, pred, add_ons;
1281 notsogood = Qnil; 1282 notsogood = Qnil;
1282 1283
@@ -1341,7 +1342,7 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */)
1341 return buf; 1342 return buf;
1342} 1343}
1343 1344
1344DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, 1345DEFUE ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo,
1345 0, 1, "", 1346 0, 1, "",
1346 doc: /* Start keeping undo information for buffer BUFFER. 1347 doc: /* Start keeping undo information for buffer BUFFER.
1347No argument or nil as argument means do this for the current buffer. */) 1348No argument or nil as argument means do this for the current buffer. */)
@@ -1370,7 +1371,7 @@ Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\
1370The buffer being killed will be current while the hook is running.\n\ 1371The buffer being killed will be current while the hook is running.\n\
1371See `kill-buffer'." 1372See `kill-buffer'."
1372 */ 1373 */
1373DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ", 1374DEFUE ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
1374 doc: /* Kill buffer BUFFER-OR-NAME. 1375 doc: /* Kill buffer BUFFER-OR-NAME.
1375The argument may be a buffer or the name of an existing buffer. 1376The argument may be a buffer or the name of an existing buffer.
1376Argument nil or omitted means kill the current buffer. Return t if the 1377Argument nil or omitted means kill the current buffer. Return t if the
@@ -1789,7 +1790,7 @@ messing with the window-buffer correspondences. */)
1789 return switch_to_buffer_1 (buffer_or_name, norecord); 1790 return switch_to_buffer_1 (buffer_or_name, norecord);
1790} 1791}
1791 1792
1792DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, 1793DEFUE ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
1793 doc: /* Return the current buffer as a Lisp object. */) 1794 doc: /* Return the current buffer as a Lisp object. */)
1794 (void) 1795 (void)
1795{ 1796{
@@ -1899,7 +1900,7 @@ set_buffer_temp (struct buffer *b)
1899 fetch_buffer_markers (b); 1900 fetch_buffer_markers (b);
1900} 1901}
1901 1902
1902DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, 1903DEFUE ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0,
1903 doc: /* Make buffer BUFFER-OR-NAME current for editing operations. 1904 doc: /* Make buffer BUFFER-OR-NAME current for editing operations.
1904BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See 1905BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See
1905also `save-excursion' when you want to make a buffer current 1906also `save-excursion' when you want to make a buffer current
@@ -1928,7 +1929,7 @@ set_buffer_if_live (Lisp_Object buffer)
1928 return Qnil; 1929 return Qnil;
1929} 1930}
1930 1931
1931DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 1932DEFUE ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1932 Sbarf_if_buffer_read_only, 0, 0, 0, 1933 Sbarf_if_buffer_read_only, 0, 0, 0,
1933 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */) 1934 doc: /* Signal a `buffer-read-only' error if the current buffer is read-only. */)
1934 (void) 1935 (void)
@@ -2001,7 +2002,7 @@ its frame, iconify that frame. */)
2001 return Qnil; 2002 return Qnil;
2002} 2003}
2003 2004
2004DEFUN ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*", 2005DEFUE ("erase-buffer", Ferase_buffer, Serase_buffer, 0, 0, "*",
2005 doc: /* Delete the entire contents of the current buffer. 2006 doc: /* Delete the entire contents of the current buffer.
2006Any narrowing restriction in effect (see `narrow-to-region') is removed, 2007Any narrowing restriction in effect (see `narrow-to-region') is removed,
2007so the buffer is truly empty after this. */) 2008so the buffer is truly empty after this. */)
@@ -2212,7 +2213,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2212 return Qnil; 2213 return Qnil;
2213} 2214}
2214 2215
2215DEFUN ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte, 2216DEFUE ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte,
2216 1, 1, 0, 2217 1, 1, 0,
2217 doc: /* Set the multibyte flag of the current buffer to FLAG. 2218 doc: /* Set the multibyte flag of the current buffer to FLAG.
2218If FLAG is t, this makes the buffer a multibyte buffer. 2219If FLAG is t, this makes the buffer a multibyte buffer.
@@ -2501,8 +2502,8 @@ current buffer is cleared. */)
2501 return flag; 2502 return flag;
2502} 2503}
2503 2504
2504DEFUN ("kill-all-local-variables", Fkill_all_local_variables, Skill_all_local_variables, 2505DEFUE ("kill-all-local-variables", Fkill_all_local_variables,
2505 0, 0, 0, 2506 Skill_all_local_variables, 0, 0, 0,
2506 doc: /* Switch to Fundamental mode by killing current buffer's local variables. 2507 doc: /* Switch to Fundamental mode by killing current buffer's local variables.
2507Most local variable bindings are eliminated so that the default values 2508Most local variable bindings are eliminated so that the default values
2508become effective once more. Also, the syntax table is set from 2509become effective once more. Also, the syntax table is set from
@@ -3900,7 +3901,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
3900 3901
3901/* Overlay dissection functions. */ 3902/* Overlay dissection functions. */
3902 3903
3903DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0, 3904DEFUE ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
3904 doc: /* Return the position at which OVERLAY starts. */) 3905 doc: /* Return the position at which OVERLAY starts. */)
3905 (Lisp_Object overlay) 3906 (Lisp_Object overlay)
3906{ 3907{
@@ -3909,7 +3910,7 @@ DEFUN ("overlay-start", Foverlay_start, Soverlay_start, 1, 1, 0,
3909 return (Fmarker_position (OVERLAY_START (overlay))); 3910 return (Fmarker_position (OVERLAY_START (overlay)));
3910} 3911}
3911 3912
3912DEFUN ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0, 3913DEFUE ("overlay-end", Foverlay_end, Soverlay_end, 1, 1, 0,
3913 doc: /* Return the position at which OVERLAY ends. */) 3914 doc: /* Return the position at which OVERLAY ends. */)
3914 (Lisp_Object overlay) 3915 (Lisp_Object overlay)
3915{ 3916{
@@ -3999,7 +4000,7 @@ end of the buffer. */)
3999 return result; 4000 return result;
4000} 4001}
4001 4002
4002DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, 4003DEFUE ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change,
4003 1, 1, 0, 4004 1, 1, 0,
4004 doc: /* Return the next position after POS where an overlay starts or ends. 4005 doc: /* Return the next position after POS where an overlay starts or ends.
4005If there are no overlay boundaries from POS to (point-max), 4006If there are no overlay boundaries from POS to (point-max),
@@ -4040,7 +4041,7 @@ the value is (point-max). */)
4040 return make_number (endpos); 4041 return make_number (endpos);
4041} 4042}
4042 4043
4043DEFUN ("previous-overlay-change", Fprevious_overlay_change, 4044DEFUE ("previous-overlay-change", Fprevious_overlay_change,
4044 Sprevious_overlay_change, 1, 1, 0, 4045 Sprevious_overlay_change, 1, 1, 0,
4045 doc: /* Return the previous position before POS where an overlay starts or ends. 4046 doc: /* Return the previous position before POS where an overlay starts or ends.
4046If there are no overlay boundaries from (point-min) to POS, 4047If there are no overlay boundaries from (point-min) to POS,
@@ -4109,7 +4110,7 @@ for positions far away from POS). */)
4109 return Qnil; 4110 return Qnil;
4110} 4111}
4111 4112
4112DEFUN ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0, 4113DEFUE ("overlay-get", Foverlay_get, Soverlay_get, 2, 2, 0,
4113 doc: /* Get the property of overlay OVERLAY with property name PROP. */) 4114 doc: /* Get the property of overlay OVERLAY with property name PROP. */)
4114 (Lisp_Object overlay, Lisp_Object prop) 4115 (Lisp_Object overlay, Lisp_Object prop)
4115{ 4116{