Update documentation of 'clone-indirect-buffer-hook'

* doc/emacs/buffers.texi (Indirect Buffers):
* src/buffer.c (syms_of_buffer) <clone-indirect-buffer-hook>:
Update the documentation of 'clone-indirect-buffer-hook' due the
recent changes.
* etc/NEWS: Mention the change in where the hook is run.

* lisp/face-remap.el (face-attrs--make-indirect-safe): Doc fix.
This commit is contained in:
Eli Zaretskii 2022-01-20 19:18:54 +02:00
parent cce813a4e7
commit b01604b362
4 changed files with 19 additions and 5 deletions

View file

@ -629,7 +629,6 @@ buffer, but killing an indirect buffer has no effect on its base buffer.
One way to use indirect buffers is to display multiple views of an
outline. @xref{Outline Views}.
@vindex clone-indirect-buffer-hook
A quick and handy way to make an indirect buffer is with the command
@kbd{M-x clone-indirect-buffer}. It creates and selects an indirect
buffer whose base buffer is the current buffer. With a numeric
@ -637,14 +636,19 @@ argument, it prompts for the name of the indirect buffer; otherwise it
uses the name of the current buffer, with a @samp{<@var{n}>} suffix
added. @kbd{C-x 4 c} (@code{clone-indirect-buffer-other-window})
works like @kbd{M-x clone-indirect-buffer}, but it selects the new
buffer in another window. These functions run the hook
@code{clone-indirect-buffer-hook} after creating the indirect buffer.
buffer in another window.
The more general way to make an indirect buffer is with the command
@kbd{M-x make-indirect-buffer}. It creates an indirect buffer
named @var{indirect-name} from a buffer @var{base-buffer}, prompting for
both using the minibuffer.
@vindex clone-indirect-buffer-hook
The functions that create indirect buffers run the hook
@code{clone-indirect-buffer-hook} after creating the indirect buffer.
When this hook runs, the newly created indirect buffer is the current
buffer.
@node Buffer Convenience
@section Convenience Features and Customization of Buffer Handling

View file

@ -957,6 +957,13 @@ characters in the range U+0080..U+00FF as substitutes for single bytes
in the range 128..255, but signal an error for all multibyte characters.
The input must be encoded text.
+++
** The 'clone-indirect-buffer-hook' is now run by 'make-indirect-buffer'.
It was previously only run by 'clone-indirect-buffer' and
'clone-indirect-buffer-other-window'. Since 'make-indirect-buffer' is
called by both of these, the hook is now run by all 3 of these
functions.
* Lisp Changes in Emacs 29.1

View file

@ -71,7 +71,7 @@
:font :inherit :fontset :distant-foreground :extend :vector])
(defun face-attrs--make-indirect-safe ()
"Deep copy `face-remapping-alist' on cloning for safety."
"Deep-copy the buffer's `face-remapping-alist' upon cloning the buffer."
(setq-local face-remapping-alist
(mapcar #'copy-sequence face-remapping-alist)))

View file

@ -6399,7 +6399,10 @@ This is the default. If nil, auto-save file deletion is inhibited. */);
delete_auto_save_files = 1;
DEFVAR_LISP ("clone-indirect-buffer-hook", Vclone_indirect_buffer_hook,
doc: /* Normal hook to run in the new buffer at the end of `clone-indirect-buffer'. */);
doc: /* Normal hook to run in the new buffer at the end of `make-indirect-buffer'.
Since `clone-indirect-buffer' calls `make-indirect-buffer', this hook
will run for `clone-indirect-buffer' calls as well. */);
Vclone_indirect_buffer_hook = Qnil;
defsubr (&Sbuffer_live_p);