diff options
| author | Luc Teirlinck | 2004-04-14 02:48:08 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2004-04-14 02:48:08 +0000 |
| commit | 619fb950d62377bf562f597ff81264d3386cc502 (patch) | |
| tree | 504e37e03898c8d5c552f6f452ac3d1dbf0e5484 | |
| parent | 19efcb46346e5eb24211348c6b04bc89f68ed74a (diff) | |
| download | emacs-619fb950d62377bf562f597ff81264d3386cc502.tar.gz emacs-619fb950d62377bf562f597ff81264d3386cc502.zip | |
Various changes in addition to:
(Buffer File Name): Add `find-buffer-visiting'.
(Buffer Modification): Mention optional ARG to `not-modified'.
(Indirect Buffers): Mention optional CLONE argument to `make-indirect-buffer'.
| -rw-r--r-- | lispref/ChangeLog | 17 | ||||
| -rw-r--r-- | lispref/buffers.texi | 207 |
2 files changed, 164 insertions, 60 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index aa20df10307..47a987fdb75 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2004-04-13 Luc Teirlinck <teirllm@auburn.edu> | ||
| 2 | |||
| 3 | * buffers.texi: Various changes in addition to: | ||
| 4 | (Buffer File Name): Add `find-buffer-visiting'. | ||
| 5 | (Buffer Modification): Mention optional ARG to `not-modified'. | ||
| 6 | (Indirect Buffers): Mention optional CLONE argument to | ||
| 7 | `make-indirect-buffer'. | ||
| 8 | |||
| 9 | * files.texi: Various changes in addition to: | ||
| 10 | (Visiting Functions): `find-file-hook' is now a normal hook. | ||
| 11 | (File Name Expansion): Explain difference between the way that | ||
| 12 | `expand-file-name' and `file-truename' treat `..'. | ||
| 13 | (Contents of Directories): Mention optional ID-FORMAT argument to | ||
| 14 | `directory-files-and-attributes'. | ||
| 15 | (Format Conversion): Mention new optional CONFIRM argument to | ||
| 16 | `format-write-file'. | ||
| 17 | |||
| 1 | 2004-04-12 Miles Bader <miles@gnu.org> | 18 | 2004-04-12 Miles Bader <miles@gnu.org> |
| 2 | 19 | ||
| 3 | * macros.texi (Expansion): Add description of `macroexpand-all'. | 20 | * macros.texi (Expansion): Add description of `macroexpand-all'. |
diff --git a/lispref/buffers.texi b/lispref/buffers.texi index 4ca375a5c26..0eee01d980d 100644 --- a/lispref/buffers.texi +++ b/lispref/buffers.texi | |||
| @@ -215,12 +215,16 @@ of course. Instead, whichever buffer was current just before exit | |||
| 215 | remains current. | 215 | remains current. |
| 216 | @end defspec | 216 | @end defspec |
| 217 | 217 | ||
| 218 | @defmac with-current-buffer buffer body... | 218 | @defmac with-current-buffer buffer-or-name body... |
| 219 | The @code{with-current-buffer} macro saves the identity of the current | 219 | The @code{with-current-buffer} macro saves the identity of the current |
| 220 | buffer, makes @var{buffer} current, evaluates the @var{body} forms, and | 220 | buffer, makes @var{buffer-or-name} current, evaluates the @var{body} |
| 221 | finally restores the buffer. The return value is the value of the last | 221 | forms, and finally restores the buffer. The return value is the value |
| 222 | form in @var{body}. The current buffer is restored even in case of an | 222 | of the last form in @var{body}. The current buffer is restored even |
| 223 | abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). | 223 | in case of an abnormal exit via @code{throw} or error (@pxref{Nonlocal |
| 224 | Exits}). | ||
| 225 | |||
| 226 | An error is signaled if @var{buffer-or-name} does not identify an | ||
| 227 | existing buffer. | ||
| 224 | @end defmac | 228 | @end defmac |
| 225 | 229 | ||
| 226 | @anchor{Definition of with-temp-buffer} | 230 | @anchor{Definition of with-temp-buffer} |
| @@ -237,9 +241,10 @@ return the contents of the temporary buffer by using | |||
| 237 | 241 | ||
| 238 | The current buffer is restored even in case of an abnormal exit via | 242 | The current buffer is restored even in case of an abnormal exit via |
| 239 | @code{throw} or error (@pxref{Nonlocal Exits}). | 243 | @code{throw} or error (@pxref{Nonlocal Exits}). |
| 240 | @end defmac | ||
| 241 | 244 | ||
| 242 | See also @code{with-temp-file} in @ref{Writing to Files}. | 245 | See also @code{with-temp-file} in @ref{Definition of with-temp-file,, |
| 246 | Writing to Files}. | ||
| 247 | @end defmac | ||
| 243 | 248 | ||
| 244 | @node Buffer Names | 249 | @node Buffer Names |
| 245 | @section Buffer Names | 250 | @section Buffer Names |
| @@ -293,8 +298,7 @@ foo | |||
| 293 | 298 | ||
| 294 | @deffn Command rename-buffer newname &optional unique | 299 | @deffn Command rename-buffer newname &optional unique |
| 295 | This function renames the current buffer to @var{newname}. An error | 300 | This function renames the current buffer to @var{newname}. An error |
| 296 | is signaled if @var{newname} is not a string, or if there is already a | 301 | is signaled if @var{newname} is not a string. |
| 297 | buffer with that name. The function returns @var{newname}. | ||
| 298 | 302 | ||
| 299 | @c Emacs 19 feature | 303 | @c Emacs 19 feature |
| 300 | Ordinarily, @code{rename-buffer} signals an error if @var{newname} is | 304 | Ordinarily, @code{rename-buffer} signals an error if @var{newname} is |
| @@ -302,6 +306,8 @@ already in use. However, if @var{unique} is non-@code{nil}, it modifies | |||
| 302 | @var{newname} to make a name that is not in use. Interactively, you can | 306 | @var{newname} to make a name that is not in use. Interactively, you can |
| 303 | make @var{unique} non-@code{nil} with a numeric prefix argument. | 307 | make @var{unique} non-@code{nil} with a numeric prefix argument. |
| 304 | (This is how the command @code{rename-uniquely} is implemented.) | 308 | (This is how the command @code{rename-uniquely} is implemented.) |
| 309 | |||
| 310 | This function returns the name actually given to the buffer. | ||
| 305 | @end deffn | 311 | @end deffn |
| 306 | 312 | ||
| 307 | @defun get-buffer buffer-or-name | 313 | @defun get-buffer buffer-or-name |
| @@ -330,11 +336,12 @@ See also the function @code{get-buffer-create} in @ref{Creating Buffers}. | |||
| 330 | @end defun | 336 | @end defun |
| 331 | 337 | ||
| 332 | @c Emacs 19 feature | 338 | @c Emacs 19 feature |
| 333 | @defun generate-new-buffer-name starting-name &rest ignore | 339 | @defun generate-new-buffer-name starting-name &optional ignore |
| 334 | This function returns a name that would be unique for a new buffer---but | 340 | This function returns a name that would be unique for a new buffer---but |
| 335 | does not create the buffer. It starts with @var{starting-name}, and | 341 | does not create the buffer. It starts with @var{starting-name}, and |
| 336 | produces a name not currently in use for any buffer by appending a | 342 | produces a name not currently in use for any buffer by appending a |
| 337 | number inside of @samp{<@dots{}>}. | 343 | number inside of @samp{<@dots{}>}. It starts at 2 and keeps |
| 344 | incrementing the number until it is not the name of an existing buffer. | ||
| 338 | 345 | ||
| 339 | If the optional second argument @var{ignore} is non-@code{nil}, it | 346 | If the optional second argument @var{ignore} is non-@code{nil}, it |
| 340 | should be a string; it makes a difference if it is a name in the | 347 | should be a string; it makes a difference if it is a name in the |
| @@ -404,9 +411,11 @@ Emacs. | |||
| 404 | @end defvar | 411 | @end defvar |
| 405 | 412 | ||
| 406 | @defvar buffer-file-truename | 413 | @defvar buffer-file-truename |
| 407 | This buffer-local variable holds the truename of the file visited in the | 414 | This buffer-local variable holds the abbreviated truename of the file |
| 408 | current buffer, or @code{nil} if no file is visited. It is a permanent | 415 | visited in the current buffer, or @code{nil} if no file is visited. |
| 409 | local, unaffected by @code{kill-all-local-variables}. @xref{Truenames}. | 416 | It is a permanent local, unaffected by |
| 417 | @code{kill-all-local-variables}. @xref{Truenames}, and | ||
| 418 | @ref{Definition of abbreviate-file-name}. | ||
| 410 | @end defvar | 419 | @end defvar |
| 411 | 420 | ||
| 412 | @defvar buffer-file-number | 421 | @defvar buffer-file-number |
| @@ -420,6 +429,9 @@ The value is normally a list of the form @code{(@var{filenum} | |||
| 420 | all files accessible on the system. See the function | 429 | all files accessible on the system. See the function |
| 421 | @code{file-attributes}, in @ref{File Attributes}, for more information | 430 | @code{file-attributes}, in @ref{File Attributes}, for more information |
| 422 | about them. | 431 | about them. |
| 432 | |||
| 433 | If @code{buffer-file-name} is the name of a symbolic link, then both | ||
| 434 | numbers refer to the recursive target. | ||
| 423 | @end defvar | 435 | @end defvar |
| 424 | 436 | ||
| 425 | @defun get-file-buffer filename | 437 | @defun get-file-buffer filename |
| @@ -427,7 +439,9 @@ This function returns the buffer visiting file @var{filename}. If | |||
| 427 | there is no such buffer, it returns @code{nil}. The argument | 439 | there is no such buffer, it returns @code{nil}. The argument |
| 428 | @var{filename}, which must be a string, is expanded (@pxref{File Name | 440 | @var{filename}, which must be a string, is expanded (@pxref{File Name |
| 429 | Expansion}), then compared against the visited file names of all live | 441 | Expansion}), then compared against the visited file names of all live |
| 430 | buffers. | 442 | buffers. Note that the buffer's @code{buffer-file-name} must match |
| 443 | the expansion of @var{filename} exactly. This function will not | ||
| 444 | recognize other names for the same file. | ||
| 431 | 445 | ||
| 432 | @example | 446 | @example |
| 433 | @group | 447 | @group |
| @@ -441,6 +455,18 @@ the same file name. In such cases, this function returns the first | |||
| 441 | such buffer in the buffer list. | 455 | such buffer in the buffer list. |
| 442 | @end defun | 456 | @end defun |
| 443 | 457 | ||
| 458 | @defun find-buffer-visiting filename &optional predicate | ||
| 459 | This is like @code{get-file-buffer}, except that it can return any | ||
| 460 | buffer visiting the file @emph{possibly under a different name}. That | ||
| 461 | is, the buffer's @code{buffer-file-name} does not need to match the | ||
| 462 | expansion of @var{filename} exactly, it only needs to refer to the | ||
| 463 | same file. If @var{predicate} is non-@code{nil}, it should be a | ||
| 464 | function of one argument, a buffer visiting @var{filename}. The | ||
| 465 | buffer is only considered a suitable return value if @var{predicate} | ||
| 466 | returns non-@code{nil}. If it can not find a suitable buffer to | ||
| 467 | return, @code{find-buffer-visiting} returns @code{nil}. | ||
| 468 | @end defun | ||
| 469 | |||
| 444 | @deffn Command set-visited-file-name filename &optional no-query along-with-file | 470 | @deffn Command set-visited-file-name filename &optional no-query along-with-file |
| 445 | If @var{filename} is a non-empty string, this function changes the | 471 | If @var{filename} is a non-empty string, this function changes the |
| 446 | name of the file visited in the current buffer to @var{filename}. (If the | 472 | name of the file visited in the current buffer to @var{filename}. (If the |
| @@ -455,14 +481,24 @@ use. | |||
| 455 | 481 | ||
| 456 | If @var{filename} is @code{nil} or the empty string, that stands for | 482 | If @var{filename} is @code{nil} or the empty string, that stands for |
| 457 | ``no visited file''. In this case, @code{set-visited-file-name} marks | 483 | ``no visited file''. In this case, @code{set-visited-file-name} marks |
| 458 | the buffer as having no visited file. | 484 | the buffer as having no visited file, without changing the buffer's |
| 459 | 485 | modified flag. | |
| 460 | Normally, this function asks the user for confirmation if the specified | 486 | |
| 461 | file already exists. If @var{no-query} is non-@code{nil}, that prevents | 487 | Normally, this function asks the user for confirmation if there |
| 462 | asking this question. | 488 | already is a buffer visiting @var{filename}. If @var{no-query} is |
| 463 | 489 | non-@code{nil}, that prevents asking this question. If there already | |
| 464 | If @var{along-with-file} is non-@code{nil}, that means to assume that the | 490 | is a buffer visiting @var{filename}, and the user confirms or |
| 465 | former visited file has been renamed to @var{filename}. | 491 | @var{query} is non-@code{nil}, this function makes the new buffer name |
| 492 | unique by appending a number inside of @samp{<@dots{}>} to @var{filename}. | ||
| 493 | |||
| 494 | If @var{along-with-file} is non-@code{nil}, that means to assume that | ||
| 495 | the former visited file has been renamed to @var{filename}. In this | ||
| 496 | case, the command does not change the buffer's modified flag, nor the | ||
| 497 | buffer's recorded last file modification time as reported by | ||
| 498 | @code{visited-file-modtime} (@pxref{Modification Time}). If | ||
| 499 | @var{along-with-file} is @code{nil}, this function clears the recorded | ||
| 500 | last file modification time, after which @code{visited-file-modtime} | ||
| 501 | returns zero. | ||
| 466 | 502 | ||
| 467 | @c Wordy to avoid overfull hbox. --rjc 16mar92 | 503 | @c Wordy to avoid overfull hbox. --rjc 16mar92 |
| 468 | When the function @code{set-visited-file-name} is called interactively, it | 504 | When the function @code{set-visited-file-name} is called interactively, it |
| @@ -523,10 +559,11 @@ Like @code{set-buffer-modified-p}, but does not force redisplay | |||
| 523 | of mode lines. | 559 | of mode lines. |
| 524 | @end defun | 560 | @end defun |
| 525 | 561 | ||
| 526 | @deffn Command not-modified | 562 | @deffn Command not-modified &optional arg |
| 527 | This command marks the current buffer as unmodified, and not needing to | 563 | This command marks the current buffer as unmodified, and not needing |
| 528 | be saved. With prefix arg, it marks the buffer as modified, so that it | 564 | to be saved. If @var{arg} is non-@code{nil}, it marks the buffer as |
| 529 | will be saved at the next suitable occasion. | 565 | modified, so that it will be saved at the next suitable occasion. |
| 566 | Interactively, @var{arg} is the prefix argument. | ||
| 530 | 567 | ||
| 531 | Don't use this function in programs, since it prints a message in the | 568 | Don't use this function in programs, since it prints a message in the |
| 532 | echo area; use @code{set-buffer-modified-p} (above) instead. | 569 | echo area; use @code{set-buffer-modified-p} (above) instead. |
| @@ -537,6 +574,7 @@ echo area; use @code{set-buffer-modified-p} (above) instead. | |||
| 537 | This function returns @var{buffer}'s modification-count. This is a | 574 | This function returns @var{buffer}'s modification-count. This is a |
| 538 | counter that increments every time the buffer is modified. If | 575 | counter that increments every time the buffer is modified. If |
| 539 | @var{buffer} is @code{nil} (or omitted), the current buffer is used. | 576 | @var{buffer} is @code{nil} (or omitted), the current buffer is used. |
| 577 | The counter can wrap around occasionally. | ||
| 540 | @end defun | 578 | @end defun |
| 541 | 579 | ||
| 542 | @node Modification Time | 580 | @node Modification Time |
| @@ -561,6 +599,16 @@ visited or saved it. | |||
| 561 | 599 | ||
| 562 | The function returns @code{t} if the last actual modification time and | 600 | The function returns @code{t} if the last actual modification time and |
| 563 | Emacs's recorded modification time are the same, @code{nil} otherwise. | 601 | Emacs's recorded modification time are the same, @code{nil} otherwise. |
| 602 | It also returns @code{t} if the buffer has no recorded last | ||
| 603 | modification time, that is if @code{visited-file-modtime} would return | ||
| 604 | zero. | ||
| 605 | |||
| 606 | It always returns @code{t} for buffers that are not visiting a file, | ||
| 607 | even if @code{visited-file-modtime} returns a non-zero value. For | ||
| 608 | instance, it always returns @code{t} for dired buffers. It returns | ||
| 609 | @code{t} for buffers that are visiting a file that does not exist and | ||
| 610 | never existed, but @code{nil} for file-visiting buffers whose file has | ||
| 611 | been deleted. | ||
| 564 | @end defun | 612 | @end defun |
| 565 | 613 | ||
| 566 | @defun clear-visited-file-modtime | 614 | @defun clear-visited-file-modtime |
| @@ -576,10 +624,30 @@ file should not be done. | |||
| 576 | 624 | ||
| 577 | @c Emacs 19 feature | 625 | @c Emacs 19 feature |
| 578 | @defun visited-file-modtime | 626 | @defun visited-file-modtime |
| 579 | This function returns the buffer's recorded last file modification time, | 627 | This function returns the current buffer's recorded last file |
| 580 | as a list of the form @code{(@var{high} . @var{low})}. (This is the | 628 | modification time, as a list of the form @code{(@var{high} . |
| 581 | same format that @code{file-attributes} uses to return time values; see | 629 | @var{low})}. (This is the same format that @code{file-attributes} |
| 582 | @ref{File Attributes}.) | 630 | uses to return time values; see @ref{File Attributes}.) |
| 631 | |||
| 632 | The function returns zero if the buffer has no recorded last | ||
| 633 | modification time, which can happen, for instance, if the record has | ||
| 634 | been explicitly cleared by @code{clear-visited-file-modtime} or if the | ||
| 635 | buffer is not visiting a file. Note, however, that | ||
| 636 | @code{visited-file-modtime} can return a non-zero value for some | ||
| 637 | buffers that are not visiting files, but are nevertheless closely | ||
| 638 | associated with a file. This happens, for instance, with dired | ||
| 639 | buffers listing a directory. For such buffers, | ||
| 640 | @code{visited-file-modtime} returns the last modification time of that | ||
| 641 | directory, as recorded by dired. | ||
| 642 | |||
| 643 | For a new buffer visiting a not yet existing file, @var{high} is | ||
| 644 | @minus{}1 and @var{low} is 65535, that is, | ||
| 645 | @ifnottex | ||
| 646 | @w{2**16 - 1.} | ||
| 647 | @end ifnottex | ||
| 648 | @tex | ||
| 649 | @math{2^{16}-1}. | ||
| 650 | @end tex | ||
| 583 | @end defun | 651 | @end defun |
| 584 | 652 | ||
| 585 | @c Emacs 19 feature | 653 | @c Emacs 19 feature |
| @@ -589,7 +657,7 @@ of the visited file, to the value specified by @var{time} if @var{time} | |||
| 589 | is not @code{nil}, and otherwise to the last modification time of the | 657 | is not @code{nil}, and otherwise to the last modification time of the |
| 590 | visited file. | 658 | visited file. |
| 591 | 659 | ||
| 592 | If @var{time} is not @code{nil}, it should have the form | 660 | If @var{time} is neither @code{nil} nor zero, it should have the form |
| 593 | @code{(@var{high} . @var{low})} or @code{(@var{high} @var{low})}, in | 661 | @code{(@var{high} . @var{low})} or @code{(@var{high} @var{low})}, in |
| 594 | either case containing two integers, each of which holds 16 bits of the | 662 | either case containing two integers, each of which holds 16 bits of the |
| 595 | time. | 663 | time. |
| @@ -655,12 +723,13 @@ The buffer is read-only if this variable is non-@code{nil}. | |||
| 655 | @end defvar | 723 | @end defvar |
| 656 | 724 | ||
| 657 | @defvar inhibit-read-only | 725 | @defvar inhibit-read-only |
| 658 | If this variable is non-@code{nil}, then read-only buffers and read-only | 726 | If this variable is non-@code{nil}, then read-only buffers and, |
| 659 | characters may be modified. Read-only characters in a buffer are those | 727 | depending on the actual value, some or all read-only characters may be |
| 660 | that have non-@code{nil} @code{read-only} properties (either text | 728 | modified. Read-only characters in a buffer are those that have |
| 661 | properties or overlay properties). @xref{Special Properties}, for more | 729 | non-@code{nil} @code{read-only} properties (either text properties or |
| 662 | information about text properties. @xref{Overlays}, for more | 730 | overlay properties). @xref{Special Properties}, for more information |
| 663 | information about overlays and their properties. | 731 | about text properties. @xref{Overlays}, for more information about |
| 732 | overlays and their properties. | ||
| 664 | 733 | ||
| 665 | If @code{inhibit-read-only} is @code{t}, all @code{read-only} character | 734 | If @code{inhibit-read-only} is @code{t}, all @code{read-only} character |
| 666 | properties have no effect. If @code{inhibit-read-only} is a list, then | 735 | properties have no effect. If @code{inhibit-read-only} is a list, then |
| @@ -816,12 +885,14 @@ buffer and gives it a unique name. | |||
| 816 | subprocess can also create a buffer (@pxref{Processes}). | 885 | subprocess can also create a buffer (@pxref{Processes}). |
| 817 | 886 | ||
| 818 | @defun get-buffer-create name | 887 | @defun get-buffer-create name |
| 819 | This function returns a buffer named @var{name}. It returns an existing | 888 | This function returns a buffer named @var{name}. It returns a live |
| 820 | buffer with that name, if one exists; otherwise, it creates a new | 889 | buffer with that name, if one exists; otherwise, it creates a new |
| 821 | buffer. The buffer does not become the current buffer---this function | 890 | buffer. The buffer does not become the current buffer---this function |
| 822 | does not change which buffer is current. | 891 | does not change which buffer is current. |
| 823 | 892 | ||
| 824 | An error is signaled if @var{name} is not a string. | 893 | If @var{name} is a buffer instead of a string, it is returned, even if |
| 894 | it is dead. An error is signaled if @var{name} is neither a string | ||
| 895 | nor a buffer. | ||
| 825 | 896 | ||
| 826 | @example | 897 | @example |
| 827 | @group | 898 | @group |
| @@ -830,8 +901,8 @@ An error is signaled if @var{name} is not a string. | |||
| 830 | @end group | 901 | @end group |
| 831 | @end example | 902 | @end example |
| 832 | 903 | ||
| 833 | The major mode for the new buffer is set to Fundamental mode. The | 904 | The major mode for a newly created buffer is set to Fundamental mode. |
| 834 | variable @code{default-major-mode} is handled at a higher level. | 905 | The variable @code{default-major-mode} is handled at a higher level. |
| 835 | @xref{Auto Major Mode}. | 906 | @xref{Auto Major Mode}. |
| 836 | @end defun | 907 | @end defun |
| 837 | 908 | ||
| @@ -905,8 +976,8 @@ this feature to test whether a buffer has been killed: | |||
| 905 | 976 | ||
| 906 | @deffn Command kill-buffer buffer-or-name | 977 | @deffn Command kill-buffer buffer-or-name |
| 907 | This function kills the buffer @var{buffer-or-name}, freeing all its | 978 | This function kills the buffer @var{buffer-or-name}, freeing all its |
| 908 | memory for other uses or to be returned to the operating system. It | 979 | memory for other uses or to be returned to the operating system. If |
| 909 | returns @code{nil}. | 980 | @var{buffer-or-name} is @code{nil}, it kills the current buffer. |
| 910 | 981 | ||
| 911 | Any processes that have this buffer as the @code{process-buffer} are | 982 | Any processes that have this buffer as the @code{process-buffer} are |
| 912 | sent the @code{SIGHUP} signal, which normally causes them to terminate. | 983 | sent the @code{SIGHUP} signal, which normally causes them to terminate. |
| @@ -921,16 +992,20 @@ for confirmation, clear the modified flag before calling | |||
| 921 | 992 | ||
| 922 | Killing a buffer that is already dead has no effect. | 993 | Killing a buffer that is already dead has no effect. |
| 923 | 994 | ||
| 995 | This function returns @code{t} if it actually killed the buffer. It | ||
| 996 | returns @code{nil} if the user refuses to confirm or if | ||
| 997 | @var{buffer-or-name} was already dead. | ||
| 998 | |||
| 924 | @smallexample | 999 | @smallexample |
| 925 | (kill-buffer "foo.unchanged") | 1000 | (kill-buffer "foo.unchanged") |
| 926 | @result{} nil | 1001 | @result{} t |
| 927 | (kill-buffer "foo.changed") | 1002 | (kill-buffer "foo.changed") |
| 928 | 1003 | ||
| 929 | ---------- Buffer: Minibuffer ---------- | 1004 | ---------- Buffer: Minibuffer ---------- |
| 930 | Buffer foo.changed modified; kill anyway? (yes or no) @kbd{yes} | 1005 | Buffer foo.changed modified; kill anyway? (yes or no) @kbd{yes} |
| 931 | ---------- Buffer: Minibuffer ---------- | 1006 | ---------- Buffer: Minibuffer ---------- |
| 932 | 1007 | ||
| 933 | @result{} nil | 1008 | @result{} t |
| 934 | @end smallexample | 1009 | @end smallexample |
| 935 | @end deffn | 1010 | @end deffn |
| 936 | 1011 | ||
| @@ -953,13 +1028,15 @@ is not cleared by changing major modes. | |||
| 953 | 1028 | ||
| 954 | @defvar buffer-offer-save | 1029 | @defvar buffer-offer-save |
| 955 | This variable, if non-@code{nil} in a particular buffer, tells | 1030 | This variable, if non-@code{nil} in a particular buffer, tells |
| 956 | @code{save-buffers-kill-emacs} and @code{save-some-buffers} to offer to | 1031 | @code{save-buffers-kill-emacs} and @code{save-some-buffers} (if the |
| 957 | save that buffer, just as they offer to save file-visiting buffers. The | 1032 | second optional argument to that function is @code{t}) to offer to |
| 958 | variable @code{buffer-offer-save} automatically becomes buffer-local | 1033 | save that buffer, just as they offer to save file-visiting buffers. |
| 959 | when set for any reason. @xref{Buffer-Local Variables}. | 1034 | @xref{Definition of save-some-buffers}. The variable |
| 1035 | @code{buffer-offer-save} automatically becomes buffer-local when set | ||
| 1036 | for any reason. @xref{Buffer-Local Variables}. | ||
| 960 | @end defvar | 1037 | @end defvar |
| 961 | 1038 | ||
| 962 | @defun buffer-live-p buffer | 1039 | @defun buffer-live-p object |
| 963 | This function returns @code{t} if @var{object} is a buffer which has | 1040 | This function returns @code{t} if @var{object} is a buffer which has |
| 964 | not been killed, @code{nil} otherwise. | 1041 | not been killed, @code{nil} otherwise. |
| 965 | @end defun | 1042 | @end defun |
| @@ -994,19 +1071,29 @@ buffer. | |||
| 994 | the base buffer effectively kills the indirect buffer in that it cannot | 1071 | the base buffer effectively kills the indirect buffer in that it cannot |
| 995 | ever again be the current buffer. | 1072 | ever again be the current buffer. |
| 996 | 1073 | ||
| 997 | @deffn Command make-indirect-buffer base-buffer name | 1074 | @deffn Command make-indirect-buffer base-buffer name &optional clone |
| 998 | This creates an indirect buffer named @var{name} whose base buffer | 1075 | This creates and returns an indirect buffer named @var{name} whose |
| 999 | is @var{base-buffer}. The argument @var{base-buffer} may be a buffer | 1076 | base buffer is @var{base-buffer}. The argument @var{base-buffer} may |
| 1000 | or a string. | 1077 | be a live buffer or the name (a string) of an existing buffer. If |
| 1078 | @var{name} is the name of an existing buffer, an error is signaled. | ||
| 1079 | |||
| 1080 | If @var{clone} is non-@code{nil}, then the indirect buffer originally | ||
| 1081 | shares the ``state'' of @var{base-buffer} such as major mode, minor | ||
| 1082 | modes, buffer local variables and so on. If @var{clone} is omitted | ||
| 1083 | or @code{nil} the indirect buffer's state is set to the default state | ||
| 1084 | for new buffers. | ||
| 1001 | 1085 | ||
| 1002 | If @var{base-buffer} is an indirect buffer, its base buffer is used as | 1086 | If @var{base-buffer} is an indirect buffer, its base buffer is used as |
| 1003 | the base for the new buffer. | 1087 | the base for the new buffer. If, in addition, @var{clone} is |
| 1088 | non-@code{nil}, the initial state is copied from the actual base | ||
| 1089 | buffer, not from @var{base-buffer}. | ||
| 1004 | @end deffn | 1090 | @end deffn |
| 1005 | 1091 | ||
| 1006 | @defun buffer-base-buffer buffer | 1092 | @defun buffer-base-buffer &optional buffer |
| 1007 | This function returns the base buffer of @var{buffer}. If @var{buffer} | 1093 | This function returns the base buffer of @var{buffer}, which defaults |
| 1008 | is not indirect, the value is @code{nil}. Otherwise, the value is | 1094 | to the current buffer. If @var{buffer} is not indirect, the value is |
| 1009 | another buffer, which is never an indirect buffer. | 1095 | @code{nil}. Otherwise, the value is another buffer, which is never an |
| 1096 | indirect buffer. | ||
| 1010 | @end defun | 1097 | @end defun |
| 1011 | 1098 | ||
| 1012 | @node Buffer Gap | 1099 | @node Buffer Gap |