summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-01-20 19:18:54 +0200
committerEli Zaretskii <eliz@gnu.org>2022-01-20 19:18:54 +0200
commitb01604b362755d02a05c65df4fca321ec84007d9 (patch)
tree92bbdf5a36daba6e34496723e31c85058823300f
parentcce813a4e70324956d6546102e26dbb312319bbd (diff)
downloademacs-b01604b362755d02a05c65df4fca321ec84007d9.tar.gz
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.
-rw-r--r--doc/emacs/buffers.texi10
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/face-remap.el2
-rw-r--r--src/buffer.c5
4 files changed, 19 insertions, 5 deletions
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 8a8584689fc..94e9d2760ec 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 5e78730bc88..c6d9c32a82c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 95dffcadd68..3675ea14b4c 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -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)))
diff --git a/src/buffer.c b/src/buffer.c
index f5f7127a638..0bdad086ddd 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -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);