1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713
|
@c =============================================================
@c = $B85(B $BK](B $BLu(B: $BNkLZ1Y;R!wDEED=NBg3X(B
@c = $B2CI.=$@5(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1998/11/25
@c =============================================================
@c This is part of the Emacs manual.
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Buffers, Windows, Files, Top
@c @chapter Using Multiple Buffers
@chapter $BJ#?t$N%P%C%U%!$N;H$$J}(B
@c @cindex buffers
@c The text you are editing in Emacs resides in an object called a
@c @dfn{buffer}. Each time you visit a file, a buffer is created to hold the
@c file's text. Each time you invoke Dired, a buffer is created to hold the
@c directory listing. If you send a message with @kbd{C-x m}, a buffer named
@c @samp{*mail*} is used to hold the text of the message. When you ask for a
@c command's documentation, that appears in a buffer called @samp{*Help*}.
@cindex $B%P%C%U%!(B
Emacs$BFb$GJT=8$7$F$$$k%F%-%9%H$O(B@dfn{$B%P%C%U%!(B}$B!J(Bbuffer$B!K$H(B
$B8F$P$l$k%*%V%8%'%/%H$NCf$KB8:_$7$^$9!#(B
$B%U%!%$%k$rK,Ld$9$k$?$S$K!"(B
$B%U%!%$%k$N%F%-%9%H$rJ];}$9$k%P%C%U%!$r:n$j$^$9!#(B
dired$B$r5/F0$9$k$?$S$K!"%G%#%l%/%H%j0lMw$rJ];}$9$k%P%C%U%!$r:n$j$^$9!#(B
@kbd{C-x m}$B$G%a%C%;!<%8$rAw?.$9$k$H$-$K$O!"(B
$B%a%C%;!<%8$N%F%-%9%H$rJ];}$9$k$?$a$K%P%C%U%!(B@samp{*mail*}$B$,;H$o$l$^$9!#(B
$B%3%^%s%I$N@bL@J8$r5a$a$k$H!"(B@samp{*Help*}$B$H8F$P$l$k%P%C%U%!$K@bL@J8$,8=$l$^$9!#(B
@c @cindex selected buffer
@c @cindex current buffer
@cindex $BA*Br$5$l$?%P%C%U%!(B
@cindex $B%+%l%s%H%P%C%U%!(B
@c At any time, one and only one buffer is @dfn{selected}. It is also
@c called the @dfn{current buffer}. Often we say that a command operates on
@c ``the buffer'' as if there were only one; but really this means that the
@c command operates on the selected buffer (most commands do).
$B$I$s$J$H$-$G$b!"(B1$B$D$N%P%C%U%!$@$1$,(B@dfn{$BA*Br(B}$B$5$l$F$$$^$9!#(B
$B$3$N%P%C%U%!$r(B@dfn{$B%+%l%s%H%P%C%U%!(B}$B$H$b8F$S$^$9!#(B
$B%P%C%U%!$,(B1$B$D$7$+$J$$$+$N$h$&$K!"(B
$B%3%^%s%I$,!X%P%C%U%!!Y$K:nMQ$9$k$H$$$&$$$$J}$r$h$/$7$^$9!#(B
$B$7$+$7!"<B:]$K$O!"%3%^%s%I$,A*Br$5$l$?%P%C%U%!$K:nMQ$9$k$H$$$&$3$H$G$9(B
$B!JB?$/$N%3%^%s%I$O$=$&$9$k!K!#(B
@c When Emacs has multiple windows, each window has a chosen buffer which
@c is displayed there, but at any time only one of the windows is selected and
@c its chosen buffer is the selected buffer. Each window's mode line displays
@c the name of the buffer that the window is displaying (@pxref{Windows}).
$BJ#?t$N%&%#%s%I%&$,$"$k$H$-!"(B
$B3F%&%#%s%I%&$O$=$3$KI=<($7$F$$$k%P%C%U%!$rA*$s$G$$$^$9$,!"(B
$B$$$D$G$b$=$l$i$N%&%#%s%I%&$N$&$A(B1$B$D$@$1$,A*Br$5$l$F$$$F!"(B
$B$=$N%&%#%s%I%&$KI=<($5$l$F$$$k%P%C%U%!$,A*Br$5$l$F$$$k%P%C%U%!$G$9!#(B
$B3F%&%#%s%I%&$N%b!<%I9T$O!"(B
$B$=$N%&%#%s%I%&$KI=<($7$F$$$k%P%C%U%!$NL>A0$rI=<($7$^$9!J(B@pxref{Windows}$B!K!#(B
@c Each buffer has a name, which can be of any length, and you can select
@c any buffer by giving its name. Most buffers are made by visiting files,
@c and their names are derived from the files' names. But you can also create
@c an empty buffer with any name you want. A newly started Emacs has a buffer
@c named @samp{*scratch*} which can be used for evaluating Lisp expressions in
@c Emacs. The distinction between upper and lower case matters in buffer
@c names.
$B3F%P%C%U%!$K$O$I$s$JD9$5$G$b$h$$L>A0$,$"$j!"(B
$B%P%C%U%!L>$r;XDj$7$F%P%C%U%!$rA*Br$G$-$^$9!#(B
$BB?$/$N%P%C%U%!$O%U%!%$%k$rK,Ld$9$k$3$H$G:n@.$5$l!"(B
$B$=$l$i$NL>A0$O%U%!%$%kL>$+$iF3$-=P$7$^$9!#(B
$B9%$-$JL>A0$G6u$N%P%C%U%!$r:n$k$3$H$b$G$-$^$9!#(B
Emacs$B$r?7$?$K;O$a$k$H!"(BEmacs$BFb$G(BLisp$B<0$NI>2A$K;H$($k(B
@samp{*scratch*}$B$H$$$&L>A0$N%P%C%U%!$,$G$-$^$9!#(B
$B%P%C%U%!L>$G$OBgJ8;z>.J8;z$r6hJL$7$^$9!#(B
@c Each buffer records individually what file it is visiting, whether it is
@c modified, and what major mode and minor modes are in effect in it
@c (@pxref{Major Modes}). Any Emacs variable can be made @dfn{local to} a
@c particular buffer, meaning its value in that buffer can be different from
@c the value in other buffers. @xref{Locals}.
$B3F%P%C%U%!$OFHN)$K!"$I$N%U%!%$%k$rK,Ld$7$F$$$k$+!"(B
$BJQ99$5$l$F$$$k$+!"$I$N%a%8%c!<%b!<%I$H%^%$%J%b!<%I$r;H$C$F$$$k$+(B
$B$r5-O?$7$F$$$^$9!#!J(B@pxref{Major Modes}$B!K!#(B
$B$I$N(BEmacs$BJQ?t$b3F%P%C%U%!$K(B@dfn{$B%m!<%+%k$K(B}$B$9$k$3$H$,$G$-$^$9!#(B
$B$D$^$j!"$"$k%P%C%U%!$G$NJQ?t$NCM$r(B
$BB>$N%P%C%U%!$G$N$=$NJQ?t$NCM$H$O0c$&CM$K$G$-$^$9!#(B
@xref{Locals}$B!#(B
@menu
* Select Buffer:: Creating a new buffer or reselecting an old one.
* List Buffers:: Getting a list of buffers that exist.
* Misc Buffer:: Renaming; changing read-onlyness; copying text.
* Kill Buffer:: Killing buffers you no longer need.
* Several Buffers:: How to go through the list of all buffers
and operate variously on several of them.
* Indirect Buffers:: An indirect buffer shares the text of another buffer.
@end menu
@node Select Buffer
@c @section Creating and Selecting Buffers
@c @cindex change buffers
@c @cindex switch buffers
@section $B%P%C%U%!$N:n@.$HA*Br(B
@cindex $B%P%C%U%!$NJQ99(B
@cindex $B%P%C%U%!$N@Z$jBX$((B
@table @kbd
@item C-x b @var{buffer} @key{RET}
@c Select or create a buffer named @var{buffer} (@code{switch-to-buffer}).
@var{buffer}$B$H$$$&L>A0$N%P%C%U%!$rA*Br$^$?$O:n@.$9$k(B
$B!J(B@code{switch-to-buffer}$B!K!#(B
@item C-x 4 b @var{buffer} @key{RET}
@c Similar, but select @var{buffer} in another window
@c (@code{switch-to-buffer-other-window}).
$BF1MM$@$,!"JL$N%&%#%s%I%&$G(B@var{buffer}$B$rA*Br$9$k(B
$B!J(B@code{switch-to-buffer-other-window}$B!K!#(B
@item C-x 5 b @var{buffer} @key{RET}
@c Similar, but select @var{buffer} in a separate frame
@c (@code{switch-to-buffer-other-frame}).
$BF1MM$@$,!"JL$N%U%l!<%`$G(B@var{buffer}$B%P%C%U%!$rA*Br$9$k(B
$B!J(B@code{switch-to-buffer-other-frame}$B!K!#(B
@end table
@kindex C-x 4 b
@findex switch-to-buffer-other-window
@kindex C-x 5 b
@findex switch-to-buffer-other-frame
@kindex C-x b
@findex switch-to-buffer
@c To select the buffer named @var{bufname}, type @kbd{C-x b @var{bufname}
@c @key{RET}}. This runs the command @code{switch-to-buffer} with argument
@c @var{bufname}. You can use completion on an abbreviation for the buffer
@c name you want (@pxref{Completion}). An empty argument to @kbd{C-x b}
@c specifies the most recently selected buffer that is not displayed in any
@c window.@refill
@var{bufname}$B$H$$$&L>A0$N%P%C%U%!$rA*Br$9$k$K$O!"(B
@kbd{C-x b @var{bufname} @key{RET}}$B$HBG$A$^$9!#(B
$B$3$l$O!"0z?t(B@var{bufname}$B$G%3%^%s%I(B@code{switch-to-buffer}$B$r<B9T$7$^$9!#(B
$B%P%C%U%!L>$NN,>N7A$rJd40$9$k$3$H$,$G$-$^$9!J(B@pxref{Completion}$B!K!#(B
@kbd{C-x b}$B$K6u$N0z?t$r;XDj$9$k$H!"(B
$B$I$N%&%#%s%I%&$K$bI=<($5$l$F$$$J$$:G6aA*Br$7$?%P%C%U%!$r0UL#$7$^$9!#(B
@c Most buffers are created by visiting files, or by Emacs commands that
@c want to display some text, but you can also create a buffer explicitly
@c by typing @kbd{C-x b @var{bufname} @key{RET}}. This makes a new, empty
@c buffer that is not visiting any file, and selects it for editing. Such
@c buffers are used for making notes to yourself. If you try to save one,
@c you are asked for the file name to use. The new buffer's major mode is
@c determined by the value of @code{default-major-mode} (@pxref{Major
@c Modes}).
$B$[$H$s$I$N%P%C%U%!$O!"%U%!%$%k$rK,Ld$9$k$3$H$G:n$i$l$k$+!"(B
$B%F%-%9%H$rI=<($9$k$h$&$J(BEmacs$B%3%^%s%I$K$h$C$F:n$i$l$^$9$,!"(B
@kbd{C-x b @var{bufname} @key{RET}}$B$HBG$C$F!"(B
$BL@<(E*$K%P%C%U%!$r:n$k$3$H$b$G$-$^$9!#(B
$B$3$&$9$k$H!"%U%!%$%k$rK,Ld$7$F$$$J$$?7$7$$6u$N%P%C%U%!$r:n$j!"(B
$BJT=8$G$-$k$h$&$K$=$N%P%C%U%!$rA*Br$7$^$9!#(B
$B$3$N$h$&$J%P%C%U%!$O!"<+J,MQ$N%a%b$r:n$k$N$K;H$$$^$9!#(B
$B$3$l$i$N%P%C%U%!$rJ]B8$7$h$&$H$9$k$H!"(B
$B;HMQ$9$k%U%!%$%kL>$rJ9$+$l$^$9!#(B
$B?7$7$$%P%C%U%!$N%a%8%c!<%b!<%I$O!"(B
@code{default-major-mode}$B$NCM$G7h$^$j$^$9!J(B@pxref{Major Modes}$B!K!#(B
@c Note that @kbd{C-x C-f}, and any other command for visiting a file,
@c can also be used to switch to an existing file-visiting buffer.
@c @xref{Visiting}.
@kbd{C-x C-f}$B$d%U%!%$%k$rK,Ld$9$kB>$N%3%^%s%I$O!"(B
$B%U%!%$%k$rK,Ld$7$F$$$k4{B8$N%P%C%U%!$X$N@Z$jBX$($K$b;H$($k$3$H$K(B
$BCm0U$7$F$/$@$5$$!#(B
@xref{Visiting}$B!#(B
@c Emacs uses buffer names that start with a space for internal purposes.
@c It treats these buffers specially in minor ways---for example, by
@c default they do not record undo information. It is best to avoid using
@c such buffer names yourself.
Emacs$B$O!"FbItL\E*MQ$N%P%C%U%!$K$O!"6uGr$G;O$^$k%P%C%U%!L>$r;H$$$^$9!#(B
Emacs$B$O!"$3$l$i$N%P%C%U%!$r>/!9FCJL$K07$$$^$9!#(B
$B$?$H$($P!"%G%U%)%k%H$G$O!"%"%s%I%%>pJs$r5-O?$7$^$;$s!#(B
$B$3$N$h$&$J%P%C%U%!L>$OHr$1$k$N$,:GNI$G$9!#(B
@node List Buffers
@c @section Listing Existing Buffers
@section $B4{B8%P%C%U%!$N0lMw(B
@table @kbd
@item C-x C-b
@c List the existing buffers (@code{list-buffers}).
$B4{B8%P%C%U%!$r0lMwI=<($9$k!J(B@code{list-buffers}$B!K!#(B
@end table
@c @cindex listing current buffers
@cindex $B%+%l%s%H%P%C%U%!$N0lMw(B
@kindex C-x C-b
@findex list-buffers
@c To display a list of all the buffers that exist, type @kbd{C-x C-b}.
@c Each line in the list shows one buffer's name, major mode and visited
@c file. The buffers are listed in the order that they were current; the
@c buffers that were current most recently come first.
$B4{B8$N$9$Y$F$N%P%C%U%!$r0lMwI=<($9$k$K$O!"(B
@kbd{C-x C-b}$B$HBG$A$^$9!#(B
$B3F9T$O!"%P%C%U%!L>!"%a%8%c!<%b!<%I!"K,Ld$7$F$$$k%U%!%$%k$r<($7$^$9!#(B
$B%P%C%U%!$OA*Br$5$l$?=g$KI=<($5$l$^$9!#(B
$B$b$C$H$b:G6a$KA*Br$5$l$?%P%C%U%!$,;O$a$K$-$^$9!#(B
@c @samp{*} at the beginning of a line indicates the buffer is ``modified.''
@c If several buffers are modified, it may be time to save some with @kbd{C-x s}
@c (@pxref{Saving}). @samp{%} indicates a read-only buffer. @samp{.} marks the
@c selected buffer. Here is an example of a buffer list:@refill
$B9TF,$N(B@samp{*}$B$O!"%P%C%U%!$,!X=$@5$5$l!Y$F$$$k$3$H$r<($7$^$9!#(B
$B$$$/$D$+$N%P%C%U%!$,=$@5$5$l$F$$$k$J$i!"(B
@kbd{C-x s}$B$G$$$/$D$+$N%P%C%U%!$rJ]B8$9$k;~4|$+$b$7$l$^$;$s(B
$B!J(B@pxref{Saving}$B!K!#(B
@samp{%}$B$O!"FI$_=P$7@lMQ%P%C%U%!$r<($7$^$9!#(B
@samp{.}$B$OA*Br$5$l$F$$$k%P%C%U%!$KIU$1$i$l$^$9!#(B
$B$D$.$O!"%P%C%U%!0lMw$NNc$G$9!#(B
@smallexample
MR Buffer Size Mode File
-- ------ ---- ---- ----
.* emacs.tex 383402 Texinfo /u2/emacs/man/emacs.tex
*Help* 1287 Fundamental
files.el 23076 Emacs-Lisp /u2/emacs/lisp/files.el
% RMAIL 64042 RMAIL /u/rms/RMAIL
*% man 747 Dired /u2/emacs/man/
net.emacs 343885 Fundamental /u/rms/net.emacs
fileio.c 27691 C /u2/emacs/src/fileio.c
NEWS 67340 Text /u2/emacs/etc/NEWS
*scratch* 0 Lisp Interaction
@end smallexample
@noindent
@c Note that the buffer @samp{*Help*} was made by a help request; it is not
@c visiting any file. The buffer @code{man} was made by Dired on the
@c directory @file{/u2/emacs/man/}.
$B%P%C%U%!(B@samp{*Help*}$B$O!"%X%k%WMW5a$G:n$i$l$?$b$N$G$9!#(B
$B$3$N%P%C%U%!$O%U%!%$%k$rK,Ld$7$F$$$^$;$s!#(B
$B%P%C%U%!(B@code{man}$B$O!"(B
$B%G%#%l%/%H%j(B@file{/u2/emacs/man/}$B$KBP$7$F(Bdired$B$,:n$C$?$b$N$G$9!#(B
@need 2000
@node Misc Buffer
@c @section Miscellaneous Buffer Operations
@section $B$=$NB>$N%P%C%U%!A`:n(B
@table @kbd
@item C-x C-q
@c Toggle read-only status of buffer (@code{vc-toggle-read-only}).
$B%P%C%U%!$NFI$_=P$7@lMQ>uBV$r@Z$jBX$($k(B
$B!J(B@code{vc-toggle-read-only}$B!K!#(B
@item M-x rename-buffer @key{RET} @var{name} @key{RET}
@c Change the name of the current buffer.
$B%+%l%s%H%P%C%U%!$NL>A0$rJQ99$9$k!#(B
@item M-x rename-uniquely
@c Rename the current buffer by adding @samp{<@var{number}>} to the end.
$BL>A0$N:G8e$K(B@samp{<@var{number}>}$B$rIU2C$7$F(B
$B%+%l%s%H%P%C%U%!L>$rJQ99$9$k!#(B
@item M-x view-buffer @key{RET} @var{buffer} @key{RET}
@c Scroll through buffer @var{buffer}.
$B%P%C%U%!(B@var{buffer}$B$r%9%/%m!<%k$9$k!#(B
@end table
@kindex C-x C-q
@findex vc-toggle-read-only
@vindex buffer-read-only
@c @cindex read-only buffer
@cindex $BFI$_=P$7@lMQ%P%C%U%!(B
@c A buffer can be @dfn{read-only}, which means that commands to change
@c its contents are not allowed. The mode line indicates read-only buffers
@c with @samp{%%} or @samp{%*} near the left margin. Read-only buffers are
@c usually made by subsystems such as Dired and Rmail that have special
@c commands to operate on the text; also by visiting a file whose access
@c control says you cannot write it.
$B%P%C%U%!$O!"(B@dfn{$BFI$_=P$7@lMQ(B}$B$K$b$J$j$^$9!#(B
$B$=$&$9$k$H!"$=$NFbMF$rJQ99$9$k%3%^%s%I$O5v$5$l$^$;$s!#(B
$B%b!<%I9T$G$O!":8C<IU6a$K(B@samp{%%}$B$d(B@samp{%*}$B$rI=<($7$F!"(B
$BFI$_=P$7@lMQ%P%C%U%!$G$"$k$3$H$r<($7$^$9!#(B
$BDL>o!"FI$_=P$7@lMQ%P%C%U%!$O!"%F%-%9%H$rA`:n$9$kFCJL$J%3%^%s%I$r;}$D(B
dired$B$d(Brmail$B$J$I$N%5%V%7%9%F%`$,:n$j$^$9!#(B
$B=q$-9~$_$r6X;_$5$l$?%U%!%$%k$rK,Ld$7$F$b(B
$BFI$_=P$7@lMQ%P%C%U%!$,:n$i$l$^$9!#(B
@c If you wish to make changes in a read-only buffer, use the command
@c @kbd{C-x C-q} (@code{vc-toggle-read-only}). It makes a read-only buffer
@c writable, and makes a writable buffer read-only. In most cases, this
@c works by setting the variable @code{buffer-read-only}, which has a local
@c value in each buffer and makes the buffer read-only if its value is
@c non-@code{nil}. If the file is maintained with version control,
@c @kbd{C-x C-q} works through the version control system to change the
@c read-only status of the file as well as the buffer. @xref{Version
@c Control}.
$BFI$_=P$7@lMQ%P%C%U%!$GJQ99$7$?$$$H$-$K$O!"(B
$B%3%^%s%I(B@kbd{C-x C-q}$B$r;H$$$^$9!J(B@code{vc-toggle-read-only}$B!K!#(B
$B$3$l$O!"FI$_=P$7@lMQ%P%C%U%!$O=q$-9~$_2DG=$K$7!"(B
$B=q$-9~$_2DG=%P%C%U%!$OFI$_=P$7@lMQ$K$7$^$9!#(B
$BB?$/$N>l9g!"$3$l$OJQ?t(B@code{buffer-read-only}$B$r@_Dj$9$k$3$H$GF0:n$7$^$9!#(B
$B$3$NJQ?t$O3F%P%C%U%!$G%m!<%+%k$JCM$r;}$A!"(B
$BCM$,(B@code{nil}$B0J30$@$H%P%C%U%!$OFI$_=P$7@lMQ$K$J$j$^$9!#(B
$B%U%!%$%k$,HG4IM}$N2<$KCV$+$l$F$$$k>l9g$K$O!"(B
@kbd{C-x C-q}$B$OHG4IM}%7%9%F%`$r2p$7$F(B
$B%P%C%U%!$@$1$G$J$/%U%!%$%k$NFI$_=P$7@lMQ$N>uBV$bJQ99$7$^$9!#(B
@xref{Version Control}$B!#(B
@c @findex rename-buffer
@c @kbd{M-x rename-buffer} changes the name of the current buffer. Specify
@c the new name as a minibuffer argument. There is no default. If you
@c specify a name that is in use for some other buffer, an error happens and
@c no renaming is done.
@kbd{M-x rename-buffer}$B$O!"%+%l%s%H%P%C%U%!$NL>A0$rJQ99$7$^$9!#(B
$B%_%K%P%C%U%!0z?t$H$7$F?7$7$$L>A0$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$O$"$j$^$;$s!#(B
$B$9$G$KB>$N%P%C%U%!$K;H$C$F$$$kL>A0$r;XDj$9$k$H!"(B
$B%(%i!<$K$J$j!"L>A0$OJQ99$5$l$^$;$s!#(B
@c @kbd{M-x rename-uniquely} renames the current buffer to a similar name
@c with a numeric suffix added to make it both different and unique. This
@c command does not need an argument. It is useful for creating multiple
@c shell buffers: if you rename the @samp{*Shell*} buffer, then do @kbd{M-x
@c shell} again, it makes a new shell buffer named @samp{*Shell*};
@c meanwhile, the old shell buffer continues to exist under its new name.
@c This method is also good for mail buffers, compilation buffers, and most
@c Emacs features that create special buffers with particular names.
@kbd{M-x rename-uniquely}$B$O!"(B
$BB>$N$I$l$H$b0c$&M#0l$NL>A0$K$9$k$?$a$K!"(B
$B%+%l%s%H%P%C%U%!L>$K?t;z$N@\Hx<-$rIU$12C$($F;w$?L>A0$KJQ99$7$^$9!#(B
$B$3$N%3%^%s%I$O0z?t$rI,MW$H$7$^$;$s!#(B
$B$3$N%3%^%s%I$OJ#?t$N%7%'%k%P%C%U%!$r:n$k$N$KJXMx$G$9!#(B
$B%P%C%U%!(B@samp{*Shell*}$B$r2~L>$9$l$P!"(B
@kbd{M-x shell}$B$r$U$?$?$S<B9T$7$F(B
$B%P%C%U%!L>(B@samp{*Shell*}$B$N?7$7$$%7%'%k%P%C%U%!$r:n$l$^$9!#(B
$B0lJ}!"8E$$%7%'%k%P%C%U%!$O!"?7$7$$L>A0$GB8:_$7B3$1$^$9!#(B
$B$3$NJ}K!$O!"%a%$%k%P%C%U%!!"%3%s%Q%$%k%P%C%U%!!"(B
$BFCDj$NL>A0$N%P%C%U%!$r:n$k(BEmacs$B$NB?$/$N5!G=$K$bM-8z$G$9!#(B
@findex view-buffer
@c @kbd{M-x view-buffer} is much like @kbd{M-x view-file} (@pxref{Misc
@c File Ops}) except that it examines an already existing Emacs buffer.
@c View mode provides commands for scrolling through the buffer
@c conveniently but not for changing it. When you exit View mode with
@c @kbd{q}, that switches back to the buffer (and the position) which was
@c previously displayed in the window. Alternatively, if you exit View
@c mode with @kbd{e}, the buffer and the value of point that resulted from
@c your perusal remain in effect.
@kbd{M-x view-buffer}$B$O!"4{B8$N(BEmacs$B%P%C%U%!$rD4$Y$k$3$H$r=|$1$P!"(B
@kbd{M-x view-file}$B!J(B@pxref{Misc File Ops}$B!K$K$h$/;w$F$$$^$9!#(B
$B1\Mw!J(Bview$B!K%b!<%I$K$O!"%P%C%U%!$r4JC1$K%9%/%m!<%k$9$k$?$a$N(B
$B%3%^%s%I$,$"$j$^$9$,!"JQ99$9$k%3%^%s%I$O$"$j$^$;$s!#(B
@kbd{q}$B$G1\Mw!J(Bview$B!K%b!<%I$+$iH4$1$k$H!"(B
$B%&%#%s%I%&$K$^$($KI=<($7$F$$$?%P%C%U%!!J$H$=$NCf$G$N2U=j!K$K@Z$jBX$o$j$^$9!#(B
$B$"$k$$$O!"(B@kbd{e}$B$G1\Mw!J(Bview$B!K%b!<%I$+$iH4$1$k$H!"(B
$B1\Mw$7$F$$$?%P%C%U%!$H$=$N%]%$%s%H0LCV$O$=$N$^$^;D$j$^$9!#(B
@c The commands @kbd{M-x append-to-buffer} and @kbd{M-x insert-buffer}
@c can be used to copy text from one buffer to another. @xref{Accumulating
@c Text}.@refill
$B%3%^%s%I!"(B@kbd{M-x append-to-buffer}$B$H(B@kbd{M-x insert-buffer}$B$O!"(B
1$B$D$N%P%C%U%!$+$iJL$N%P%C%U%!$X%F%-%9%H$r%3%T!<$9$k$N$K;H$$$^$9!#(B
@xref{Accumulating Text}$B!#(B
@node Kill Buffer
@c @section Killing Buffers
@section $B%P%C%U%!$N>C5n(B
@c @cindex killing buffers
@cindex $B%P%C%U%!$N>C5n(B
@c If you continue an Emacs session for a while, you may accumulate a
@c large number of buffers. You may then find it convenient to @dfn{kill}
@c the buffers you no longer need. On most operating systems, killing a
@c buffer releases its space back to the operating system so that other
@c programs can use it. Here are some commands for killing buffers:
Emacs$B$N%;%C%7%g%s$r$7$P$i$/B3$1$k$H!"(B
$B$?$/$5$s$N?t$N%P%C%U%!$,N/$C$F$$$k$G$7$g$&!#(B
$B$b$&I,MW$H$7$J$$%P%C%U%!$r(B@dfn{$B>C5n(B}$B$7$?$[$&$,$h$$$H;W$&$+$b$7$l$^$;$s!#(B
$BB?$/$N%*%Z%l!<%F%#%s%0%7%9%F%`$G$O!"(B
$B%P%C%U%!$r>C5n$9$k$H$=$N%a%b%jNN0h$r2rJ|$7$F(B
$B%*%Z%l!<%F%#%s%0%7%9%F%`$KJV$9$N$G!"(B
$BB>$N%W%m%0%i%`$,;H$($k$h$&$K$J$j$^$9!#(B
$B%P%C%U%!$r>C5n$9$k%3%^%s%I$r$$$/$D$+$"$2$^$9!#(B
@c WideCommands
@table @kbd
@item C-x k @var{bufname} @key{RET}
@c Kill buffer @var{bufname} (@code{kill-buffer}).
$B%P%C%U%!(B@var{bufname}$B$r>C5n$9$k!J(B@code{kill-buffer}$B!K!#(B
@item M-x kill-some-buffers
@c Offer to kill each buffer, one by one.
1$B$D(B1$B$D3F%P%C%U%!$r>C5n$9$k$+$I$&$+J9$$$F$/$k!#(B
@end table
@findex kill-buffer
@findex kill-some-buffers
@kindex C-x k
@c @kbd{C-x k} (@code{kill-buffer}) kills one buffer, whose name you
@c specify in the minibuffer. The default, used if you type just @key{RET}
@c in the minibuffer, is to kill the current buffer. If you kill the
@c current buffer, another buffer is selected; one that has been selected
@c recently but does not appear in any window now. If you ask to kill a
@c file-visiting buffer that is modified (has unsaved editing), then you
@c must confirm with @kbd{yes} before the buffer is killed.
@kbd{C-x k}$B!J(B@code{kill-buffer}$B!K$O!"(B
$B%_%K%P%C%U%!$G;XDj$7$?L>A0$N%P%C%U%!$r>C5n$7$^$9!#(B
$B%_%K%P%C%U%!$G(B@key{RET}$B$@$1BG$C$?$H$-$K;H$o$l$k%G%U%)%k%H$O!"(B
$B%+%l%s%H%P%C%U%!$r>C5n$9$k$3$H$G$9!#(B
$B%+%l%s%H%P%C%U%!$r>C5n$9$k$H!"JL$N%P%C%U%!$,A*Br$5$l$^$9!#(B
$B$I$N%&%#%s%I%&$K$bI=<($5$l$F$$$J$$!"(B
$B$b$C$H$b:G6a$KA*Br$5$l$?%P%C%U%!$G$9!#(B
$B%U%!%$%k$rK,Ld$7$F=$@5$7$F$"$k!JJT=88e$KJ]B8$7$F$$$J$$!K%P%C%U%!$r(B
$B>C5n$7$h$&$H$9$k$H!"%P%C%U%!$r>C5n$9$k$^$($K(B@kbd{yes}$B$G$N3NG'$r5a$a$^$9!#(B
@c The command @kbd{M-x kill-some-buffers} asks about each buffer, one by
@c one. An answer of @kbd{y} means to kill the buffer. Killing the current
@c buffer or a buffer containing unsaved changes selects a new buffer or asks
@c for confirmation just like @code{kill-buffer}.
$B%3%^%s%I(B@kbd{M-x kill-some-buffers}$B$O!"(B
1$B$D(B1$B$D3F%P%C%U%!$K$D$$$F>C5n$9$k$+J9$$$F$-$^$9!#(B
@kbd{y}$B$HEz$($k$H!"$=$N%P%C%U%!$r>C5n$7$^$9!#(B
$B%+%l%s%H%P%C%U%!$dL$J]B8$NJQ99$r4^$`%P%C%U%!$r>C5n$7$h$&$H$9$k$H!"(B
$B?7$7$$%P%C%U%!$rA*Br$9$k$+(B@code{kill-buffer}$B$N$h$&$K3NG'$r5a$a$F$-$^$9!#(B
@c The buffer menu feature (@pxref{Several Buffers}) is also convenient
@c for killing various buffers.
$B%P%C%U%!%a%K%e!<5!G=!J(B@pxref{Several Buffers}$B!K$b!"(B
$B$5$^$6$^$J%P%C%U%!$r:o=|$9$k$N$KJXMx$G$9!#(B
@vindex kill-buffer-hook
@c If you want to do something special every time a buffer is killed, you
@c can add hook functions to the hook @code{kill-buffer-hook} (@pxref{Hooks}).
$B%P%C%U%!$r:o=|$9$k$H$-$K!"Kh2s2?$+FCJL$J$3$H$r$7$?$$$J$i$P!"(B
$B%U%C%/(B@code{kill-buffer-hook}$B$K%U%C%/4X?t$rDI2C$7$^$9!J(B@pxref{Hooks}$B!K!#(B
@findex clean-buffer-list
@c If you run one Emacs session for a period of days, as many people do,
@c it can fill up with buffers that you used several days ago. The command
@c @kbd{M-x clean-buffer-list} is a convenient way to purge them; it kills
@c all the unmodified buffers that you have not used for a long time. An
@c ordinary buffer is killed if it has not been displayed for three days;
@c however, you can specify certain buffers that should never be killed
@c automatically, and others that should be killed if they have been unused
@c for a mere hour.
$BB?$/$N?M!9$,$d$k$h$&$K!"2?F|$K$b$o$?$C$F$?$C$?(B1$B$D$N(BEmacs$B%;%C%7%g%s$r(B
$B<B9T$9$k>l9g!"?tF|A0$K;H$C$?%P%C%U%!$G0lGU$K$J$k$3$H$,$"$j$^$9!#(B
$B%3%^%s%I(B@kbd{M-x clean-buffer-list}$B$O!"(B
$B$=$l$i$N%P%C%U%!$r>C5n$9$kJXMx$JJ}K!$G$9!#(B
$BD9$$4|4V$K$o$?$C$F;H$C$F$$$J$$L$=$@5$N%P%C%U%!$9$Y$F$r>C5n$7$^$9!#(B
3$BF|4VI=<($7$F$$$J$$IaDL$N%P%C%U%!$O>C5n$5$l$^$9!#(B
$B$7$+$7!"FCDj$N%P%C%U%!$r<+F0E*$K$O>C5n$7$J$$$h$&$K$7$?$j!"(B
$B$[$s$N?t;~4V;HMQ$7$J$$$@$1$G>C5n$9$k$h$&$K$b;XDj$G$-$^$9!#(B
@c @cindex Midnight mode
@cindex $B??LkCf%b!<%I!J(BMidnight mode$B!K(B
@vindex midnight-mode
@vindex midnight-hook
@c You can also have this buffer purging done for you, every day at
@c midnight, by enabling Midnight mode. Midnight mode operates each day at
@c midnight; at that time, it runs @code{clean-buffer-list}, or whichever
@c functions you have placed in the normal hook @code{midnight-hook}
@c (@pxref{Hooks}).
$B??LkCf!J(Bmidnight$B!K%b!<%I$r%*%s$K$9$l$P!"(B
$B$3$N$h$&$J%P%C%U%!$N>C5n$rKhF|??LkCf$K9T$o$;$k$3$H$b$G$-$^$9!#(B
$B??LkCf!J(Bmidnight$B!K%b!<%I$O!"KhF|??LkCf$KF0:n$7$^$9!#(B
$B??LkCf$K!"(B@code{clean-buffer-list}$B!"$"$k$$$O!"(B
$B%N!<%^%k%U%C%/(B@code{midnight-hook}$B$K;XDj$7$?4X?t$r<B9T$7$^$9!#(B
@c To enable Midnight mode, use the Customization buffer to set the
@c variable @code{midnight-mode} to @code{t}. @xref{Easy Customization}.
$B??LkCf!J(Bmidnight$B!K%b!<%I$r%*%s$K$9$k$K$O!"(B
$B%+%9%?%^%$%:!J(Bcustomization$B!K%P%C%U%!$r;H$C$F!"(B
$BJQ?t(B@code{midnight-mode}$B$K(B@code{t}$B$r@_Dj$7$^$9!#(B
@xref{Easy Customization}$B!#(B
@node Several Buffers
@c @section Operating on Several Buffers
@c @cindex buffer menu
@section $BJ#?t%P%C%U%!$NA`:n(B
@cindex $B%P%C%U%!%a%K%e!<(B
@c The @dfn{buffer-menu} facility is like a ``Dired for buffers''; it allows
@c you to request operations on various Emacs buffers by editing an Emacs
@c buffer containing a list of them. You can save buffers, kill them
@c (here called @dfn{deleting} them, for consistency with Dired), or display
@c them.
@dfn{$B%P%C%U%!%a%K%e!<(B}$B!J(Bbuffer-menu$B!K5!G=$O(B
$B!X%P%C%U%!$KBP$9$k(Bdired$B!Y$K;w$F$$$^$9!#(B
$B$3$N%3%^%s%I$O!"%P%C%U%!0lMw$r<}$a$?(BEmacs$B%P%C%U%!$rJT=8$9$k$3$H$G!"(B
$B$5$^$6$^$J(BEmacs$B%P%C%U%!$rA`:n$G$-$^$9!#(B
$B%P%C%U%!$NJ]B8!">C5n!J$3$3$G$O(Bdired$B$H$N0l4S@-$N$?$a$K(B@dfn{$B:o=|(B}$B$H8F$V!K!"(B
$BI=<($r9T$&$3$H$,$G$-$^$9!#(B
@table @kbd
@item M-x buffer-menu
@c Begin editing a buffer listing all Emacs buffers.
$B$9$Y$F$N(BEmacs$B%P%C%U%!$N0lMw$r<}$a$?%P%C%U%!$rJT=8$7;O$a$k!#(B
@end table
@findex buffer-menu
@c The command @code{buffer-menu} writes a list of all Emacs buffers into
@c the buffer @samp{*Buffer List*}, and selects that buffer in Buffer Menu
@c mode. The buffer is read-only, and can be changed only through the
@c special commands described in this section. The usual Emacs cursor
@c motion commands can be used in the @samp{*Buffer List*} buffer. The
@c following commands apply to the buffer described on the current line.
$B%3%^%s%I(B@code{buffer-menu}$B$O!"(B
$B$9$Y$F$N(BEmacs$B%P%C%U%!$N0lMw$r%P%C%U%!(B@samp{*Buffer List*}$B$K=q$-!"(B
$B$=$N%P%C%U%!$r%P%C%U%!%a%K%e!<!J(Bbuffer-menu$B!K%b!<%I$K$7$F(B
$BA*Br$7$^$9!#(B
$B$=$N%P%C%U%!$OFI$_=P$7@lMQ$G!"K\@a$G=R$Y$kFCJL$J%3%^%s%I$G$N$_JQ99$G$-$^$9!#(B
$BIaDL$N(BEmacs$B%+!<%=%k0\F0%3%^%s%I$O!"(B@samp{*Buffer List*}$B%P%C%U%!$G$b;H$($^$9!#(B
$B$D$.$K$"$2$k%3%^%s%I$O!"8=:_9T$K=q$+$l$F$$$k%P%C%U%!$K:nMQ$7$^$9!#(B
@table @kbd
@item d
@c Request to delete (kill) the buffer, then move down. The request
@c shows as a @samp{D} on the line, before the buffer name. Requested
@c deletions take place when you type the @kbd{x} command.
$B%P%C%U%!$r:o=|!J>C5n!K$9$k$h$&$K;X<($7!"(B1$B9T2<$X0\F0$9$k!#(B
$B$3$N;X<($O!"$=$N9T$N%P%C%U%!L>$N$^$($K(B@samp{D}$B$rI=<($9$k!#(B
$B;X<($7$?:o=|$O!"(B@kbd{x}$B%3%^%s%I$rBG$C$?$H$-$K<B9T$5$l$k!#(B
@item C-d
@c Like @kbd{d} but move up afterwards instead of down.
@kbd{d}$B$K;w$F$$$k$,!"(B1$B9T2<$X0\F0$9$k$+$o$j$K>e$X0\F0$9$k!#(B
@item s
@c Request to save the buffer. The request shows as an @samp{S} on the
@c line. Requested saves take place when you type the @kbd{x} command.
@c You may request both saving and deletion for the same buffer.
$B%P%C%U%!$rJ]B8$9$k$h$&$K;X<($9$k!#(B
$B$3$N;X<($K$h$j!"9T$K$O(B@samp{S}$B$,I=<($5$l$k!#(B
$B;X<($7$?J]B8$O!"(B@kbd{x}$B%3%^%s%I$rBG$C$?$H$-$K<B9T$5$l$k!#(B
$BF1$8%P%C%U%!$KBP$7$F!"J]B8$H:o=|$NN>J}$r;X<($G$-$k!#(B
@item x
@c Perform previously requested deletions and saves.
$B$^$($K;X<($7$?:o=|$HJ]B8$r<B9T$9$k!#(B
@item u
@c Remove any request made for the current line, and move down.
$B8=:_9T$KBP$9$k;X<($r>C$7!"(B1$B9T2<$X0\F0$9$k!#(B
@item @key{DEL}
@c Move to previous line and remove any request made for that line.
1$B$D$^$($N9T$K0\F0$7!"$=$N9T$KBP$9$k$I$s$J;X<($b>C$9!#(B
@end table
@c The @kbd{d}, @kbd{C-d}, @kbd{s} and @kbd{u} commands to add or remove
@c flags also move down (or up) one line. They accept a numeric argument
@c as a repeat count.
@kbd{d}$B!"(B@kbd{C-d}$B!"(B@kbd{s}$B!"(B@kbd{u}$B%3%^%s%I$O!"(B
$B%U%i%0$rDI2C$^$?$O:o=|$7$F!"(B1$B9T2<$X!J$"$k$$$O>e$X!K0\F0$7$^$9!#(B
$B$3$l$i$N%3%^%s%I$O!"H?I|2s?t$H$7$F?t0z?t$r<h$j$^$9!#(B
@c These commands operate immediately on the buffer listed on the current
@c line:
$B$D$.$K$"$2$k%3%^%s%I$O!"8=:_9T$K=q$+$l$F$$$k%P%C%U%!$K$?$@$A$K:nMQ$7$^$9!#(B
@table @kbd
@item ~
@c Mark the buffer ``unmodified.'' The command @kbd{~} does this
@c immediately when you type it.
$B%P%C%U%!$K!XJQ99$J$7!Y$H0u$rIU$1$k!#(B
$B%3%^%s%I(B@kbd{~}$B$rBG$D$H!"$?$@$A$K<B9T$9$k!#(B
@item %
@c Toggle the buffer's read-only flag. The command @kbd{%} does
@c this immediately when you type it.
$B%P%C%U%!$NFI$_=P$7@lMQ%U%i%0$r%H%0%k$9$k!#(B
$B%3%^%s%I(B@kbd{%}$B$rBG$D$H!"$?$@$A$K<B9T$9$k!#(B
@item t
@c Visit the buffer as a tags table. @xref{Select Tags Table}.
$B%?%0%F!<%V%k$H$7$F%P%C%U%!$rK,Ld$9$k!#(B
@pxref{Select Tags Table}$B!#(B
@end table
@c There are also commands to select another buffer or buffers:
$BB>$N%P%C%U%!$dJ#?t$N%P%C%U%!$rA*Br$9$k%3%^%s%I$b$"$j$^$9!#(B
@table @kbd
@item q
@c Quit the buffer menu---immediately display the most recent formerly
@c visible buffer in its place.
$B%P%C%U%!%a%K%e!<$r$d$a$k!#(B
$B$3$N%&%#%s%I%&$K$O!"$3$3$KI=<($7$F$$$?$b$C$H$b:G6a$N%P%C%U%!$rI=<($9$k!#(B
@item @key{RET}
@itemx f
@c Immediately select this line's buffer in place of the @samp{*Buffer
@c List*} buffer.
@samp{*Buffer List*}$B$N$+$o$j$K!"$3$N9T$N%P%C%U%!$r$?$@$A$KA*Br$9$k!#(B
@item o
@c Immediately select this line's buffer in another window as if by
@c @kbd{C-x 4 b}, leaving @samp{*Buffer List*} visible.
@kbd{C-x 4 b}$B$N$h$&$K!"JL$N%&%#%s%I%&$G$3$N9T$N%P%C%U%!$r$?$@$A$KA*Br$9$k!#(B
@samp{*Buffer List*}$B$O$=$N$^$^!#(B
@item C-o
@c Immediately display this line's buffer in another window, but don't
@c select the window.
$BJL$N%&%#%s%I%&$K$3$N9T$N%P%C%U%!$r$?$@$A$KI=<($9$k$,!"(B
$B$=$N%&%#%s%I%&$rA*Br$7$J$$!#(B
@item 1
@c Immediately select this line's buffer in a full-screen window.
$B$3$N9T$N%P%C%U%!$r2hLL0lGU$N%&%#%s%I%&$K$?$@$A$KA*Br$9$k!#(B
@item 2
@c Immediately set up two windows, with this line's buffer in one, and the
@c previously selected buffer (aside from the buffer @samp{*Buffer List*})
@c in the other.
$B$?$@$A$K(B2$B$D$N%&%#%s%I%&$K$7$F!"(B
$B$3$N9T$N%P%C%U%!$r$=$N(B1$B$D$K!"(B
$B!J(B@samp{*Buffer List*}$B%P%C%U%!$r=|$$$F!K$^$($KA*Br$7$F$$$?%P%C%U%!$r(B
$B$b$&(B1$B$D$KI=<($9$k!#(B
@item b
@c Bury the buffer listed on this line.
$B$3$N9T$N%P%C%U%!$r0lMw$N:G8e$K0\$9!#(B
@item m
@c Mark this line's buffer to be displayed in another window if you exit
@c with the @kbd{v} command. The request shows as a @samp{>} at the
@c beginning of the line. (A single buffer may not have both a delete
@c request and a display request.)
@kbd{v}$B%3%^%s%I$G%P%C%U%!%a%K%e!<$r$d$a$?$H$-$K!"(B
$B$3$N9T$N%P%C%U%!$rJL$N%&%#%s%I%&$KI=<($9$k$h$&$K0u$rIU$1$k!#(B
$B$3$N;X<($O!"9TF,$K(B@samp{>} $B$rI=<($9$k!#(B
$B!J(B1$B$D$N%P%C%U%!$K!":o=|;X<($HI=<(;X<($NN>J}$rIU$1$k$3$H$O$G$-$J$$!#!K(B
@item v
@c Immediately select this line's buffer, and also display in other windows
@c any buffers previously marked with the @kbd{m} command. If you have not
@c marked any buffers, this command is equivalent to @kbd{1}.
$B$?$@$A$K$3$N9T$N%P%C%U%!$rA*Br$7!"(B
$BJL$N%&%#%s%I%&72$K$O(B@kbd{m}$B%3%^%s%I$G0u$rIU$1$?%P%C%U%!72$rI=<($9$k!#(B
$B0u$rIU$1$?%P%C%U%!$,$J$1$l$P!"$3$N%3%^%s%I$O(B@kbd{1}$B%3%^%s%I$HF1$8!#(B
@end table
@c All that @code{buffer-menu} does directly is create and switch to a
@c suitable buffer, and turn on Buffer Menu mode. Everything else
@c described above is implemented by the special commands provided in
@c Buffer Menu mode. One consequence of this is that you can switch from
@c the @samp{*Buffer List*} buffer to another Emacs buffer, and edit there.
@c You can reselect the @samp{*Buffer List*} buffer later, to perform the
@c operations already requested, or you can kill it, or pay no further
@c attention to it.
@code{buffer-menu}$B$,D>@\9T$&$3$H$O!"(B
$BE,@Z$J%P%C%U%!$r:n@.$7$F$=$l$K@Z$jBX$($F$+$i!"(B
$B%P%C%U%!%a%K%e!<!J(Bbuffer-menu$B!K%b!<%I$K$9$k$3$H$G$9!#(B
$B$=$l0J30$N>e$K=R$Y$?$3$H$O$9$Y$F!"(B
$B%P%C%U%!%a%K%e!<!J(Bbuffer-menu$B!K%b!<%I$,MQ0U$7$?FCJL$J%3%^%s%I$G(B
$B<BAu$5$l$F$$$^$9!#(B
$B$=$N7k2L!"(B@samp{*Buffer List*}$B%P%C%U%!$+$iJL$N(BEmacs$B%P%C%U%!$X@Z$jBX$($F!"(B
$B$=$3$GJT=8$G$-$^$9!#(B
$B$"$H$G(B@samp{*Buffer List*}$B%P%C%U%!$r$U$?$?$SA*Br$7$F$9$G$K;X<($7$?A`:n$r<B9T$7$?$j!"(B
$B$3$N%P%C%U%!$r:o=|$7$?$j!"L5;k$7$?$j$b$G$-$^$9!#(B
@c The only difference between @code{buffer-menu} and @code{list-buffers}
@c is that @code{buffer-menu} switches to the @samp{*Buffer List*} buffer
@c in the selected window; @code{list-buffers} displays it in another
@c window. If you run @code{list-buffers} (that is, type @kbd{C-x C-b})
@c and select the buffer list manually, you can use all of the commands
@c described here.
@code{buffer-menu}$B$H(B@code{list-buffers}$B$NM#0l$N0c$$$O!"(B
@code{buffer-menu}$B$OA*Br$5$l$?%&%#%s%I%&$G(B
@samp{*Buffer List*}$B%P%C%U%!$K@Z$jBX$($k$3$H$G$9!#(B
@code{list-buffers}$B$OJL$N%&%#%s%I%&$K$3$N%P%C%U%!$rI=<($9$k$@$1$G$9!#(B
@code{list-buffers}$B$r<B9T$7!J$D$^$j!"(B@kbd{C-x C-b}$B$HBG$D!K!"(B
@samp{*Buffer List*}$B%P%C%U%!$r<jF0$GA*Br$9$k$H!"(B
$B$3$3$K=R$Y$?$9$Y$F$N%3%^%s%I$r;H$($^$9!#(B
@c The buffer @samp{*Buffer List*} is not updated automatically when
@c buffers are created and killed; its contents are just text. If you have
@c created, deleted or renamed buffers, the way to update @samp{*Buffer
@c List*} to show what you have done is to type @kbd{g}
@c (@code{revert-buffer}) or repeat the @code{buffer-menu} command.
$B%P%C%U%!$r:n@.$7$?$j:o=|$7$?$j$7$F$b!"(B
$B%P%C%U%!(B@samp{*Buffer List*}$B$O<+F0E*$K99?7$5$l$^$;$s!#(B
$B$=$NFbMF$O$?$@$N%F%-%9%H$K$9$.$^$;$s!#(B
$B%P%C%U%!$r:n@.!?:o=|!?2~L>$7$?$i!"(B
$B8=:_$N%P%C%U%!$N>uBV$r8+$k$?$a$K(B@samp{*Buffer List*}$B$r99?7$9$kJ}K!$O!"(B
@kbd{g}$B!J(B@code{revert-buffer}$B!K$rBG$D$+!"(B
@code{buffer-menu}$B%3%^%s%I$r:FEY<B9T$9$k$3$H$G$9!#(B
@node Indirect Buffers
@c @section Indirect Buffers
@c @cindex indirect buffer
@c @cindex base buffer
@section $B4V@\%P%C%U%!(B
@cindex $B4V@\%P%C%U%!(B
@cindex $B4pDl%P%C%U%!(B
@c An @dfn{indirect buffer} shares the text of some other buffer, which
@c is called the @dfn{base buffer} of the indirect buffer. In some ways it
@c is the analogue, for buffers, of a symbolic link between files.
@dfn{$B4V@\%P%C%U%!(B}$B$O!"B>$N%P%C%U%!$H%F%-%9%H$r6&M-$7$^$9!#(B
$B$=$N$h$&$JB>$N%P%C%U%!$r4V@\%P%C%U%!$N(B@dfn{$B4pDl%P%C%U%!(B}$B$H8F$S$^$9!#(B
$B$"$k0UL#$G!"%U%!%$%k$N$"$$$@$N%7%s%\%j%C%/%j%s%/$K;w$F$$$^$9!#(B
@table @kbd
@findex make-indirect-buffer
@item M-x make-indirect-buffer @var{base-buffer} @key{RET} @var{indirect-name} @key{RET}
@c Create an indirect buffer named @var{indirect-name} whose base buffer
@c is @var{base-buffer}.
@var{base-buffer}$B$r4pDl%P%C%U%!$H$9$k4V@\%P%C%U%!(B@var{indirect-name}$B$r:n$k!#(B
@end table
@c The text of the indirect buffer is always identical to the text of its
@c base buffer; changes made by editing either one are visible immediately
@c in the other. But in all other respects, the indirect buffer and its
@c base buffer are completely separate. They have different names,
@c different values of point, different narrowing, different markers,
@c different major modes, and different local variables.
$B4V@\%P%C%U%!$N%F%-%9%H$O$D$M$K4pDl%P%C%U%!$N%F%-%9%H$HF1$8$G$9!#(B
$B$I$A$i$+JRJ}$rJT=8$7$FJQ99$9$k$H!"B>J}$N%P%C%U%!$G$b$9$0$K$=$l$,8+$($^$9!#(B
$B$7$+$7!"$=$l0J30$N$9$Y$F$NE@$G$O!"(B
$B4V@\%P%C%U%!$H$=$N4pDl%P%C%U%!$O40A4$KJL$N$b$N$G$9!#(B
$B$3$l$i$O!"0[$J$kL>A0!"0[$J$k%]%$%s%H$NCM!"0[$J$k%J%m%$%s%0!"(B
$B0[$J$k%^!<%+!"0[$J$k%a%8%c!<%b!<%I!"0[$J$k%m!<%+%kJQ?t$r;}$A$^$9!#(B
@c An indirect buffer cannot visit a file, but its base buffer can. If
@c you try to save the indirect buffer, that actually works by saving the
@c base buffer. Killing the base buffer effectively kills the indirect
@c buffer, but killing an indirect buffer has no effect on its base buffer.
$B4V@\%P%C%U%!$G$O%U%!%$%k$rK,Ld$G$-$^$;$s$,!"(B
$B4pDl%P%C%U%!$G$O$G$-$^$9!#(B
$B4V@\%P%C%U%!$rJ]B8$7$h$&$H$9$k$H!"<B:]$K$O4pDl%P%C%U%!$rJ]B8$7$^$9!#(B
$B4pDl%P%C%U%!$r>C5n$9$k$H4V@\%P%C%U%!$b>C5n$5$l$^$9$,!"(B
$B4V@\%P%C%U%!$r>C5n$7$F$b4pDl%P%C%U%!$K$O1F6A$7$^$;$s!#(B
@c One way to use indirect buffers is to display multiple views of an
@c outline. @xref{Outline Views}.
$B4V@\%P%C%U%!$N;H$$J}$N(B1$B$D$O!"%"%&%H%i%$%s$rJ#?t$N;kE@$GI=<($9$k$3$H$G$9!#(B
@xref{Outline Views}$B!#(B
|