emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b01604b362: Update documentation of 'clone-indirect-buffer-hook'


From: Eli Zaretskii
Subject: master b01604b362: Update documentation of 'clone-indirect-buffer-hook'
Date: Thu, 20 Jan 2022 12:19:15 -0500 (EST)

branch: master
commit b01604b362755d02a05c65df4fca321ec84007d9
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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.
---
 doc/emacs/buffers.texi | 10 +++++++---
 etc/NEWS               |  7 +++++++
 lisp/face-remap.el     |  2 +-
 src/buffer.c           |  5 ++++-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 8a8584689f..94e9d2760e 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 5e78730bc8..c6d9c32a82 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 95dffcadd6..3675ea14b4 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 f5f7127a63..0bdad086dd 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]