comparison src/buffer.c @ 13762:71c14edf7d6d

(Fkill_buffer): Rename arg bufname to buffer. Don't gcpro it after the last use. (Fswitch_to_buffer, Fpop_to_buffer): Rename arg bufname to buffer. (Fset_buffer): Likewise, and rename local buffer to buf. (reset_buffer, init_buffer_once): Delete code that touches redisplay_end_trigger field in buffer.
author Karl Heuer <kwzh@gnu.org>
date Thu, 21 Dec 1995 16:55:39 +0000
parents 005d7ed9d69b
children c7c63fcb828e
comparison
equal deleted inserted replaced
13761:e4e1091af4d7 13762:71c14edf7d6d
454 b->overlays_after = Qnil; 454 b->overlays_after = Qnil;
455 XSETFASTINT (b->overlay_center, 1); 455 XSETFASTINT (b->overlay_center, 1);
456 b->mark_active = Qnil; 456 b->mark_active = Qnil;
457 b->point_before_scroll = Qnil; 457 b->point_before_scroll = Qnil;
458 b->file_format = Qnil; 458 b->file_format = Qnil;
459 b->redisplay_end_trigger = Qnil;
460 b->extra1 = Qnil; 459 b->extra1 = Qnil;
461 b->extra2 = Qnil; 460 b->extra2 = Qnil;
462 b->extra3 = Qnil; 461 b->extra3 = Qnil;
463 } 462 }
464 463
908 if not void, is a list of functions to be called, with no arguments,\n\ 907 if not void, is a list of functions to be called, with no arguments,\n\
909 before the buffer is actually killed. The buffer to be killed is current\n\ 908 before the buffer is actually killed. The buffer to be killed is current\n\
910 when the hook functions are called.\n\n\ 909 when the hook functions are called.\n\n\
911 Any processes that have this buffer as the `process-buffer' are killed\n\ 910 Any processes that have this buffer as the `process-buffer' are killed\n\
912 with `delete-process'.") 911 with `delete-process'.")
913 (bufname) 912 (buffer)
914 Lisp_Object bufname; 913 Lisp_Object buffer;
915 { 914 {
916 Lisp_Object buf; 915 Lisp_Object buf;
917 register struct buffer *b; 916 register struct buffer *b;
918 register Lisp_Object tem; 917 register Lisp_Object tem;
919 register struct Lisp_Marker *m; 918 register struct Lisp_Marker *m;
920 struct gcpro gcpro1, gcpro2; 919 struct gcpro gcpro1, gcpro2;
921 920
922 if (NILP (bufname)) 921 if (NILP (buffer))
923 buf = Fcurrent_buffer (); 922 buf = Fcurrent_buffer ();
924 else 923 else
925 buf = Fget_buffer (bufname); 924 buf = Fget_buffer (buffer);
926 if (NILP (buf)) 925 if (NILP (buf))
927 nsberror (bufname); 926 nsberror (buffer);
928 927
929 b = XBUFFER (buf); 928 b = XBUFFER (buf);
930 929
931 /* Avoid trouble for buffer already dead. */ 930 /* Avoid trouble for buffer already dead. */
932 if (NILP (b->name)) 931 if (NILP (b->name))
934 933
935 /* Query if the buffer is still modified. */ 934 /* Query if the buffer is still modified. */
936 if (INTERACTIVE && !NILP (b->filename) 935 if (INTERACTIVE && !NILP (b->filename)
937 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 936 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
938 { 937 {
939 GCPRO2 (buf, bufname); 938 GCPRO1 (buf);
940 tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ", 939 tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ",
941 XSTRING (b->name)->data)); 940 XSTRING (b->name)->data));
942 UNGCPRO; 941 UNGCPRO;
943 if (NILP (tem)) 942 if (NILP (tem))
944 return Qnil; 943 return Qnil;
1170 do not put this buffer at the front of the list of recently selected ones.\n\ 1169 do not put this buffer at the front of the list of recently selected ones.\n\
1171 \n\ 1170 \n\
1172 WARNING: This is NOT the way to work on another buffer temporarily\n\ 1171 WARNING: This is NOT the way to work on another buffer temporarily\n\
1173 within a Lisp program! Use `set-buffer' instead. That avoids messing with\n\ 1172 within a Lisp program! Use `set-buffer' instead. That avoids messing with\n\
1174 the window-buffer correspondences.") 1173 the window-buffer correspondences.")
1175 (bufname, norecord) 1174 (buffer, norecord)
1176 Lisp_Object bufname, norecord; 1175 Lisp_Object buffer, norecord;
1177 { 1176 {
1178 register Lisp_Object buf; 1177 register Lisp_Object buf;
1179 Lisp_Object tem; 1178 Lisp_Object tem;
1180 1179
1181 if (EQ (minibuf_window, selected_window)) 1180 if (EQ (minibuf_window, selected_window))
1182 error ("Cannot switch buffers in minibuffer window"); 1181 error ("Cannot switch buffers in minibuffer window");
1183 tem = Fwindow_dedicated_p (selected_window); 1182 tem = Fwindow_dedicated_p (selected_window);
1184 if (!NILP (tem)) 1183 if (!NILP (tem))
1185 error ("Cannot switch buffers in a dedicated window"); 1184 error ("Cannot switch buffers in a dedicated window");
1186 1185
1187 if (NILP (bufname)) 1186 if (NILP (buffer))
1188 buf = Fother_buffer (Fcurrent_buffer (), Qnil); 1187 buf = Fother_buffer (Fcurrent_buffer (), Qnil);
1189 else 1188 else
1190 { 1189 {
1191 buf = Fget_buffer (bufname); 1190 buf = Fget_buffer (buffer);
1192 if (NILP (buf)) 1191 if (NILP (buf))
1193 { 1192 {
1194 buf = Fget_buffer_create (bufname); 1193 buf = Fget_buffer_create (buffer);
1195 Fset_buffer_major_mode (buf); 1194 Fset_buffer_major_mode (buf);
1196 } 1195 }
1197 } 1196 }
1198 Fset_buffer (buf); 1197 Fset_buffer (buf);
1199 if (NILP (norecord)) 1198 if (NILP (norecord))
1211 "Select buffer BUFFER in some window, preferably a different one.\n\ 1210 "Select buffer BUFFER in some window, preferably a different one.\n\
1212 If BUFFER is nil, then some other buffer is chosen.\n\ 1211 If BUFFER is nil, then some other buffer is chosen.\n\
1213 If `pop-up-windows' is non-nil, windows can be split to do this.\n\ 1212 If `pop-up-windows' is non-nil, windows can be split to do this.\n\
1214 If optional second arg OTHER-WINDOW is non-nil, insist on finding another\n\ 1213 If optional second arg OTHER-WINDOW is non-nil, insist on finding another\n\
1215 window even if BUFFER is already visible in the selected window.") 1214 window even if BUFFER is already visible in the selected window.")
1216 (bufname, other) 1215 (buffer, other)
1217 Lisp_Object bufname, other; 1216 Lisp_Object buffer, other;
1218 { 1217 {
1219 register Lisp_Object buf; 1218 register Lisp_Object buf;
1220 if (NILP (bufname)) 1219 if (NILP (buffer))
1221 buf = Fother_buffer (Fcurrent_buffer (), Qnil); 1220 buf = Fother_buffer (Fcurrent_buffer (), Qnil);
1222 else 1221 else
1223 { 1222 {
1224 buf = Fget_buffer (bufname); 1223 buf = Fget_buffer (buffer);
1225 if (NILP (buf)) 1224 if (NILP (buf))
1226 { 1225 {
1227 buf = Fget_buffer_create (bufname); 1226 buf = Fget_buffer_create (buffer);
1228 Fset_buffer_major_mode (buf); 1227 Fset_buffer_major_mode (buf);
1229 } 1228 }
1230 } 1229 }
1231 Fset_buffer (buf); 1230 Fset_buffer (buf);
1232 record_buffer (buf); 1231 record_buffer (buf);
1406 BUFFER may be a buffer or the name of an existing buffer.\n\ 1405 BUFFER may be a buffer or the name of an existing buffer.\n\
1407 See also `save-excursion' when you want to make a buffer current temporarily.\n\ 1406 See also `save-excursion' when you want to make a buffer current temporarily.\n\
1408 This function does not display the buffer, so its effect ends\n\ 1407 This function does not display the buffer, so its effect ends\n\
1409 when the current command terminates.\n\ 1408 when the current command terminates.\n\
1410 Use `switch-to-buffer' or `pop-to-buffer' to switch buffers permanently.") 1409 Use `switch-to-buffer' or `pop-to-buffer' to switch buffers permanently.")
1411 (bufname) 1410 (buffer)
1412 register Lisp_Object bufname; 1411 register Lisp_Object buffer;
1413 { 1412 {
1414 register Lisp_Object buffer; 1413 register Lisp_Object buf;
1415 buffer = Fget_buffer (bufname); 1414 buf = Fget_buffer (buffer);
1416 if (NILP (buffer)) 1415 if (NILP (buf))
1417 nsberror (bufname); 1416 nsberror (buffer);
1418 if (NILP (XBUFFER (buffer)->name)) 1417 if (NILP (XBUFFER (buf)->name))
1419 error ("Selecting deleted buffer"); 1418 error ("Selecting deleted buffer");
1420 set_buffer_internal (XBUFFER (buffer)); 1419 set_buffer_internal (XBUFFER (buf));
1421 return buffer; 1420 return buf;
1422 } 1421 }
1423 1422
1424 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only, 1423 DEFUN ("barf-if-buffer-read-only", Fbarf_if_buffer_read_only,
1425 Sbarf_if_buffer_read_only, 0, 0, 0, 1424 Sbarf_if_buffer_read_only, 0, 0, 0,
1426 "Signal a `buffer-read-only' error if the current buffer is read-only.") 1425 "Signal a `buffer-read-only' error if the current buffer is read-only.")
3373 XSETINT (buffer_local_flags.mark_active, -1); 3372 XSETINT (buffer_local_flags.mark_active, -1);
3374 XSETINT (buffer_local_flags.point_before_scroll, -1); 3373 XSETINT (buffer_local_flags.point_before_scroll, -1);
3375 XSETINT (buffer_local_flags.file_truename, -1); 3374 XSETINT (buffer_local_flags.file_truename, -1);
3376 XSETINT (buffer_local_flags.invisibility_spec, -1); 3375 XSETINT (buffer_local_flags.invisibility_spec, -1);
3377 XSETINT (buffer_local_flags.file_format, -1); 3376 XSETINT (buffer_local_flags.file_format, -1);
3378 XSETINT (buffer_local_flags.redisplay_end_trigger, -1);
3379 3377
3380 XSETFASTINT (buffer_local_flags.mode_line_format, 1); 3378 XSETFASTINT (buffer_local_flags.mode_line_format, 1);
3381 XSETFASTINT (buffer_local_flags.abbrev_mode, 2); 3379 XSETFASTINT (buffer_local_flags.abbrev_mode, 2);
3382 XSETFASTINT (buffer_local_flags.overwrite_mode, 4); 3380 XSETFASTINT (buffer_local_flags.overwrite_mode, 4);
3383 XSETFASTINT (buffer_local_flags.case_fold_search, 8); 3381 XSETFASTINT (buffer_local_flags.case_fold_search, 8);