aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1999-08-05 19:38:34 +0000
committerRichard M. Stallman1999-08-05 19:38:34 +0000
commit2594e0fdb5d92efc775ee9ecc14fc8a0201855c7 (patch)
tree011291d6e488a07e5e6d3639fba4cb81a535626e /src
parent1b53d4e043fcdd994e57e670a8ab9527bdb85565 (diff)
downloademacs-2594e0fdb5d92efc775ee9ecc14fc8a0201855c7.tar.gz
emacs-2594e0fdb5d92efc775ee9ecc14fc8a0201855c7.zip
(switch_to_buffer_1): New subroutine, taken out from Fswitch_to_buffer.
(no_switch_buffer): New function. (Fswitch_to_buffer): Call them. Don't get confused by "same-window" buffers in a dedicated frame.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c58
1 files changed, 41 insertions, 17 deletions
diff --git a/src/buffer.c b/src/buffer.c
index d6989697a7d..5bd83ceb53f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1320,26 +1320,30 @@ the current buffer's major mode.")
1320 return unbind_to (count, Qnil); 1320 return unbind_to (count, Qnil);
1321} 1321}
1322 1322
1323DEFUN ("switch-to-buffer", Fswitch_to_buffer, Sswitch_to_buffer, 1, 2, "BSwitch to buffer: ", 1323/* If switching buffers in WINDOW would be an error, return
1324 "Select buffer BUFFER in the current window.\n\ 1324 a C string saying what the error would be. */
1325BUFFER may be a buffer or a buffer name.\n\ 1325
1326Optional second arg NORECORD non-nil means\n\ 1326char *
1327do not put this buffer at the front of the list of recently selected ones.\n\ 1327no_switch_window (window)
1328\n\ 1328 Lisp_Object window;
1329WARNING: This is NOT the way to work on another buffer temporarily\n\
1330within a Lisp program! Use `set-buffer' instead. That avoids messing with\n\
1331the window-buffer correspondences.")
1332 (buffer, norecord)
1333 Lisp_Object buffer, norecord;
1334{ 1329{
1335 register Lisp_Object buf;
1336 Lisp_Object tem; 1330 Lisp_Object tem;
1337 1331 if (EQ (minibuf_window, window))
1338 if (EQ (minibuf_window, selected_window)) 1332 return "Cannot switch buffers in minibuffer window";
1339 error ("Cannot switch buffers in minibuffer window"); 1333 tem = Fwindow_dedicated_p (window);
1340 tem = Fwindow_dedicated_p (selected_window);
1341 if (!NILP (tem)) 1334 if (!NILP (tem))
1342 error ("Cannot switch buffers in a dedicated window"); 1335 return "Cannot switch buffers in a dedicated window";
1336 return NULL;
1337}
1338
1339/* Switch to buffer BUFFER in the selected window.
1340 If NORECORD is non-nil, don't call record_buffer. */
1341
1342Lisp_Object
1343switch_to_buffer_1 (buffer, norecord)
1344 Lisp_Object buffer, norecord;
1345{
1346 register Lisp_Object buf;
1343 1347
1344 if (NILP (buffer)) 1348 if (NILP (buffer))
1345 buf = Fother_buffer (Fcurrent_buffer (), Qnil, Qnil); 1349 buf = Fother_buffer (Fcurrent_buffer (), Qnil, Qnil);
@@ -1364,6 +1368,26 @@ the window-buffer correspondences.")
1364 return buf; 1368 return buf;
1365} 1369}
1366 1370
1371DEFUN ("switch-to-buffer", Fswitch_to_buffer, Sswitch_to_buffer, 1, 2, "BSwitch to buffer: ",
1372 "Select buffer BUFFER in the current window.\n\
1373BUFFER may be a buffer or a buffer name.\n\
1374Optional second arg NORECORD non-nil means\n\
1375do not put this buffer at the front of the list of recently selected ones.\n\
1376\n\
1377WARNING: This is NOT the way to work on another buffer temporarily\n\
1378within a Lisp program! Use `set-buffer' instead. That avoids messing with\n\
1379the window-buffer correspondences.")
1380 (buffer, norecord)
1381 Lisp_Object buffer, norecord;
1382{
1383 char *err;
1384
1385 err = no_switch_window (selected_window);
1386 if (err) error (err);
1387
1388 return switch_to_buffer_1 (buffer, norecord);
1389}
1390
1367DEFUN ("pop-to-buffer", Fpop_to_buffer, Spop_to_buffer, 1, 3, 0, 1391DEFUN ("pop-to-buffer", Fpop_to_buffer, Spop_to_buffer, 1, 3, 0,
1368 "Select buffer BUFFER in some window, preferably a different one.\n\ 1392 "Select buffer BUFFER in some window, preferably a different one.\n\
1369If BUFFER is nil, then some other buffer is chosen.\n\ 1393If BUFFER is nil, then some other buffer is chosen.\n\