Mercurial > emacs
comparison lispref/buffers.texi @ 21682:90da2489c498
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 20 Apr 1998 17:43:57 +0000 |
parents | 66d807bdc5b4 |
children | d4ac295a98b3 |
comparison
equal
deleted
inserted
replaced
21681:11eafe90b842 | 21682:90da2489c498 |
---|---|
128 (insert-buffer-substring oldbuf start end)))) | 128 (insert-buffer-substring oldbuf start end)))) |
129 @end group | 129 @end group |
130 @end example | 130 @end example |
131 | 131 |
132 @noindent | 132 @noindent |
133 This function binds a local variable to the current buffer, and then | 133 This function binds a local variable to record the current buffer, and |
134 @code{save-current-buffer} records which buffer that was. Next, | 134 then @code{save-current-buffer} arranges to make it current again. |
135 @code{set-buffer} makes another buffer current. Finally, | 135 Next, @code{set-buffer} makes the specified buffer current. Finally, |
136 @code{insert-buffer-substring} copies the string from the original | 136 @code{insert-buffer-substring} copies the string from the original |
137 current buffer to the new current buffer. | 137 current buffer to the specified (and now current) buffer. |
138 | 138 |
139 If the buffer appended to happens to be displayed in some window, | 139 If the buffer appended to happens to be displayed in some window, |
140 the next redisplay will show how its text has changed. Otherwise, you | 140 the next redisplay will show how its text has changed. Otherwise, you |
141 will not see the change immediately on the screen. The buffer becomes | 141 will not see the change immediately on the screen. The buffer becomes |
142 current temporarily during the execution of the command, but this does | 142 current temporarily during the execution of the command, but this does |
202 @end defun | 202 @end defun |
203 | 203 |
204 @tindex save-current-buffer | 204 @tindex save-current-buffer |
205 @defmac save-current-buffer body... | 205 @defmac save-current-buffer body... |
206 The @code{save-current-buffer} macro saves the identity of the current | 206 The @code{save-current-buffer} macro saves the identity of the current |
207 buffer, evaluates the @var{body} forms, and finally restores the buffer. | 207 buffer, evaluates the @var{body} forms, and finally restores that buffer |
208 The return value is the value of the last form in @var{body}. The | 208 as current. The return value is the value of the last form in |
209 current buffer is restored even in case of an abnormal exit via | 209 @var{body}. The current buffer is restored even in case of an abnormal |
210 @code{throw} or error (@pxref{Nonlocal Exits}). | 210 exit via @code{throw} or error (@pxref{Nonlocal Exits}). |
211 | 211 |
212 If the buffer that used to be current has been killed by the time of | 212 If the buffer that used to be current has been killed by the time of |
213 exit from @code{save-current-buffer}, then it is not made current again, | 213 exit from @code{save-current-buffer}, then it is not made current again, |
214 of course. Instead, whichever buffer was current just before exit | 214 of course. Instead, whichever buffer was current just before exit |
215 remains current. | 215 remains current. |
381 @result{} "/usr/user/lewis/manual/buffers.texi" | 381 @result{} "/usr/user/lewis/manual/buffers.texi" |
382 @end group | 382 @end group |
383 @end example | 383 @end example |
384 | 384 |
385 It is risky to change this variable's value without doing various other | 385 It is risky to change this variable's value without doing various other |
386 things. See the definition of @code{set-visited-file-name} in | 386 things. Normally it is better to use @code{set-visited-file-name} (see |
387 @file{files.el}; some of the things done there, such as changing the | 387 below); some of the things done there, such as changing the buffer name, |
388 buffer name, are not strictly necessary, but others are essential to | 388 are not strictly necessary, but others are essential to avoid confusing |
389 avoid confusing Emacs. | 389 Emacs. |
390 @end defvar | 390 @end defvar |
391 | 391 |
392 @defvar buffer-file-truename | 392 @defvar buffer-file-truename |
393 This buffer-local variable holds the truename of the file visited in the | 393 This buffer-local variable holds the truename of the file visited in the |
394 current buffer, or @code{nil} if no file is visited. It is a permanent | 394 current buffer, or @code{nil} if no file is visited. It is a permanent |
397 | 397 |
398 @defvar buffer-file-number | 398 @defvar buffer-file-number |
399 This buffer-local variable holds the file number and directory device | 399 This buffer-local variable holds the file number and directory device |
400 number of the file visited in the current buffer, or @code{nil} if no | 400 number of the file visited in the current buffer, or @code{nil} if no |
401 file or a nonexistent file is visited. It is a permanent local, | 401 file or a nonexistent file is visited. It is a permanent local, |
402 unaffected by @code{kill-local-variables}. @xref{Truenames}. | 402 unaffected by @code{kill-local-variables}. |
403 | 403 |
404 The value is normally a list of the form @code{(@var{filenum} | 404 The value is normally a list of the form @code{(@var{filenum} |
405 @var{devnum})}. This pair of numbers uniquely identifies the file among | 405 @var{devnum})}. This pair of numbers uniquely identifies the file among |
406 all files accessible on the system. See the function | 406 all files accessible on the system. See the function |
407 @code{file-attributes}, in @ref{File Attributes}, for more information | 407 @code{file-attributes}, in @ref{File Attributes}, for more information |
441 the buffer as having no visited file. | 441 the buffer as having no visited file. |
442 | 442 |
443 @c Wordy to avoid overfull hbox. --rjc 16mar92 | 443 @c Wordy to avoid overfull hbox. --rjc 16mar92 |
444 When the function @code{set-visited-file-name} is called interactively, it | 444 When the function @code{set-visited-file-name} is called interactively, it |
445 prompts for @var{filename} in the minibuffer. | 445 prompts for @var{filename} in the minibuffer. |
446 | |
447 See also @code{clear-visited-file-modtime} and | |
448 @code{verify-visited-file-modtime} in @ref{Buffer Modification}. | |
449 @end deffn | 446 @end deffn |
450 | 447 |
451 @defvar list-buffers-directory | 448 @defvar list-buffers-directory |
452 This buffer-local variable specifies a string to display in a buffer | 449 This buffer-local variable specifies a string to display in a buffer |
453 listing where the visited file name would go, for buffers that don't | 450 listing where the visited file name would go, for buffers that don't |
667 front of the list when they are selected and to the end when they are | 664 front of the list when they are selected and to the end when they are |
668 buried (see @code{bury-buffer}, below). Several functions, notably | 665 buried (see @code{bury-buffer}, below). Several functions, notably |
669 @code{other-buffer}, use this ordering. A buffer list displayed for the | 666 @code{other-buffer}, use this ordering. A buffer list displayed for the |
670 user also follows this order. | 667 user also follows this order. |
671 | 668 |
669 In addition to the fundamental Emacs buffer list, each frame has its | |
670 own version of the buffer list, in which the buffers that have been | |
671 selected in that frame come first, starting with the buffers most | |
672 recently selected @emph{in that frame}. (This order is recorded in | |
673 @var{frame}'s @code{buffer-list} frame parameter; see @ref{Window Frame | |
674 Parameters}.) The buffers that were never selected in @var{frame} come | |
675 afterward, ordered according to the fundamental Emacs buffer list. | |
676 | |
672 @defun buffer-list &optional frame | 677 @defun buffer-list &optional frame |
673 This function returns a list of all buffers, including those whose names | 678 This function returns the buffer list, including all buffers, even those |
674 begin with a space. The elements are actual buffers, not their names. | 679 whose names begin with a space. The elements are actual buffers, not |
675 | 680 their names. |
676 If @var{frame} is @code{nil}, all the buffers appear in order of most | 681 |
677 recent selection, regardless of which frames they were selected in. | 682 If @var{frame} is a frame, this returns @var{frame}'s buffer list. If |
678 | 683 @var{frame} is @code{nil}, the fundamental Emacs buffer list is used: |
679 If @var{frame} is a frame, then the buffers that have been selected in | 684 all the buffers appear in order of most recent selection, regardless of |
680 @var{frame} all come at the front of the list, ordered by most recent | 685 which frames they were selected in. |
681 selection in @var{frame}. (This order is recorded in @var{frame}'s | |
682 @code{buffer-list} frame parameter; see @ref{X Frame Parameters}.) The | |
683 buffers that were never selected in @var{frame} come afterward, ordered | |
684 according to most recent selection in other frames. | |
685 | 686 |
686 @example | 687 @example |
687 @group | 688 @group |
688 (buffer-list) | 689 (buffer-list) |
689 @result{} (#<buffer buffers.texi> | 690 @result{} (#<buffer buffers.texi> |
733 buffer list that is not now visible in any window in a visible frame. | 734 buffer list that is not now visible in any window in a visible frame. |
734 | 735 |
735 If the selected frame has a non-@code{nil} @code{buffer-predicate} | 736 If the selected frame has a non-@code{nil} @code{buffer-predicate} |
736 parameter, then @code{other-buffer} uses that predicate to decide which | 737 parameter, then @code{other-buffer} uses that predicate to decide which |
737 buffers to consider. It calls the predicate once for each buffer, and | 738 buffers to consider. It calls the predicate once for each buffer, and |
738 if the value is @code{nil}, that buffer is ignored. @xref{X Frame | 739 if the value is @code{nil}, that buffer is ignored. @xref{Window Frame |
739 Parameters}. | 740 Parameters}. |
740 | 741 |
741 @c Emacs 19 feature | 742 @c Emacs 19 feature |
742 If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning | 743 If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning |
743 a buffer visible in any window on any visible frame, except as a last | 744 a buffer visible in any window on any visible frame, except as a last |
944 | 945 |
945 But in all other respects, the indirect buffer and its base buffer are | 946 But in all other respects, the indirect buffer and its base buffer are |
946 completely separate. They have different names, different values of | 947 completely separate. They have different names, different values of |
947 point, different narrowing, different markers and overlays (though | 948 point, different narrowing, different markers and overlays (though |
948 inserting or deleting text in either buffer relocates the markers and | 949 inserting or deleting text in either buffer relocates the markers and |
949 overlays for both), different major modes, and different local | 950 overlays for both), different major modes, and different buffer-local |
950 variables. | 951 variables. |
951 | 952 |
952 An indirect buffer cannot visit a file, but its base buffer can. If | 953 An indirect buffer cannot visit a file, but its base buffer can. If |
953 you try to save the indirect buffer, that actually works by saving the | 954 you try to save the indirect buffer, that actually works by saving the |
954 base buffer. | 955 base buffer. |