emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 7ae4588: Document that `buffer-string' retains text properties


From: Eli Zaretskii
Subject: emacs-27 7ae4588: Document that `buffer-string' retains text properties
Date: Thu, 18 Mar 2021 05:05:41 -0400 (EDT)

branch: emacs-27
commit 7ae4588bb4800694d841da1684538191cb291617
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Document that `buffer-string' retains text properties
    
    * doc/lispref/text.texi (Buffer Contents): Mention text properties
    in the `buffer-string' documentation.
    * src/editfns.c (Fbuffer_string): Mention text properties in the
    doc string (bug#47220).
    
    (cherry picked from commit 60af754170f22f5d25510af069ed0ebfec95f992)
---
 doc/lispref/text.texi | 4 +++-
 src/editfns.c         | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 89582ac..6eda581 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -222,7 +222,9 @@ properties, just the characters themselves.  @xref{Text 
Properties}.
 
 @defun buffer-string
 This function returns the contents of the entire accessible portion of
-the current buffer, as a string.
+the current buffer, as a string.  If the text being copied has any
+text properties, these are copied into the string along with the
+characters they belong to.
 @end defun
 
   If you need to make sure the resulting string, when copied to a
diff --git a/src/editfns.c b/src/editfns.c
index 255537c..621e351 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1682,7 +1682,11 @@ they can be in either order.  */)
 DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0,
        doc: /* Return the contents of the current buffer as a string.
 If narrowing is in effect, this function returns only the visible part
-of the buffer.  */)
+of the buffer.
+
+This function copies the text properties of that part of the buffer
+into the result string; if you don’t want the text properties,
+use `buffer-substring-no-properties' instead.  */)
   (void)
 {
   return make_buffer_string_both (BEGV, BEGV_BYTE, ZV, ZV_BYTE, 1);



reply via email to

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