comparison man/lispref/buffers.texi @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents 05472e90ae02
children
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
888 @cindex base buffer 888 @cindex base buffer
889 889
890 An @dfn{indirect buffer} shares the text of some other buffer, which 890 An @dfn{indirect buffer} shares the text of some other buffer, which
891 is called the @dfn{base buffer} of the indirect buffer. In some ways it 891 is called the @dfn{base buffer} of the indirect buffer. In some ways it
892 is the analogue, for buffers, of a symbolic link among files. The base 892 is the analogue, for buffers, of a symbolic link among files. The base
893 buffer may not itself be an indirect buffer. 893 buffer may not itself be an indirect buffer. One base buffer may have
894 several @dfn{indirect children}.
894 895
895 The text of the indirect buffer is always identical to the text of its 896 The text of the indirect buffer is always identical to the text of its
896 base buffer; changes made by editing either one are visible immediately 897 base buffer; changes made by editing either one are visible immediately
897 in the other. This includes the text properties as well as the characters 898 in the other.
898 themselves.
899 899
900 But in all other respects, the indirect buffer and its base buffer are 900 But in all other respects, the indirect buffer and its base buffer are
901 completely separate. They have different names, different values of 901 completely separate. They have different names, different values of
902 point, different narrowing, different markers and overlays (though 902 point and mark, different narrowing, different markers and extents
903 inserting or deleting text in either buffer relocates the markers and 903 (though inserting or deleting text in either buffer relocates the
904 overlays for both), different major modes, and different local 904 markers and extents for both), different major modes, and different
905 variables. 905 local variables. Unlike in FSF Emacs, XEmacs indirect buffers do not
906 automatically share text properties among themselves and their base
907 buffer.
906 908
907 An indirect buffer cannot visit a file, but its base buffer can. If 909 An indirect buffer cannot visit a file, but its base buffer can. If
908 you try to save the indirect buffer, that actually works by saving the 910 you try to save the indirect buffer, that actually works by saving the
909 base buffer. 911 base buffer.
910 912
911 Killing an indirect buffer has no effect on its base buffer. Killing 913 Killing an indirect buffer has no effect on its base buffer. Killing
912 the base buffer effectively kills the indirect buffer in that it cannot 914 the base buffer kills all its indirect children.
913 ever again be the current buffer.
914 915
915 @deffn Command make-indirect-buffer base-buffer name 916 @deffn Command make-indirect-buffer base-buffer name
916 This creates an indirect buffer named @var{name} whose base buffer 917 This creates an indirect buffer named @var{name} whose base buffer
917 is @var{base-buffer}. The argument @var{base-buffer} may be a buffer 918 is @var{base-buffer}. The argument @var{base-buffer} may be a buffer
918 or a string. 919 or a string.
919 920
920 If @var{base-buffer} is an indirect buffer, its base buffer is used as 921 If @var{base-buffer} is an indirect buffer, its base buffer is used as
921 the base for the new buffer. 922 the base for the new buffer.
923
924 @example
925 @group
926 (make-indirect-buffer "*scratch*" "indirect")
927 @result{} #<buffer "indirect">
928 @end group
929 @end example
922 @end deffn 930 @end deffn
923 931
924 @defun buffer-base-buffer buffer 932 @defun buffer-base-buffer &optional buffer
925 This function returns the base buffer of @var{buffer}. If @var{buffer} 933 This function returns the base buffer of @var{buffer}. If @var{buffer}
926 is not indirect, the value is @code{nil}. Otherwise, the value is 934 is not indirect, the value is @code{nil}. Otherwise, the value is
927 another buffer, which is never an indirect buffer. 935 another buffer, which is never an indirect buffer. If @var{buffer} is
928 @end defun 936 not supplied, it defaults to the current buffer.
929 937
938 @example
939 @group
940 (buffer-base-buffer (get-buffer "indirect"))
941 @result{} #<buffer "*scratch*">
942 @end group
943 @end example
944 @end defun
945
946 @defun buffer-indirect-children &optional buffer
947 This function returns a list of all indirect buffers whose base buffer
948 is @var{buffer}. If @var{buffer} is indirect, the return value will
949 always be nil; see @code{make-indirect-buffer}. If @var{buffer} is not
950 supplied, it defaults to the current buffer.
951
952 @example
953 @group
954 (buffer-indirect-children (get-buffer "*scratch*"))
955 @result{} (#<buffer "indirect">)
956 @end group
957 @end example
958 @end defun