emacs-diffs
[Top][All Lists]
Advanced

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

master 6db90a412a: Document the non-effect of narrowing on get-text-prop


From: Lars Ingebrigtsen
Subject: master 6db90a412a: Document the non-effect of narrowing on get-text-property
Date: Thu, 28 Apr 2022 07:04:43 -0400 (EDT)

branch: master
commit 6db90a412ac3aac6ff44d0d92ac26b2ecb228071
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Document the non-effect of narrowing on get-text-property
    
    * doc/lispref/text.texi (Examining Properties): Document
    surprising non-effect of narrowing (bug#16413).
    
    * src/textprop.c (Ftext_properties_at, Fget_text_property):
    Mention narrowing.
---
 doc/lispref/text.texi | 12 ++++++++++++
 src/textprop.c        | 13 +++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index ab9abd0495..ca6a483c54 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -2969,6 +2969,12 @@ character after position @var{pos} in @var{object} (a 
buffer or
 string).  The argument @var{object} is optional and defaults to the
 current buffer.
 
+If @var{position} is at the end of @var{object}, the value is
+@code{nil}, but note that buffer narrowing does not affect the value.
+That is, if @var{object} is a buffer or @code{nil}, and the buffer is
+narrowed and @var{position} is at the end of the narrowed buffer, the
+result may be non-@code{nil}.
+
 If there is no @var{prop} property strictly speaking, but the character
 has a property category that is a symbol, then @code{get-text-property} returns
 the @var{prop} property of that symbol.
@@ -3021,6 +3027,12 @@ properties take precedence over this variable.
 This function returns the entire property list of the character at
 @var{position} in the string or buffer @var{object}.  If @var{object} is
 @code{nil}, it defaults to the current buffer.
+
+If @var{position} is at the end of @var{object}, the value is
+@code{nil}, but note that buffer narrowing does not affect the value.
+That is, if @var{object} is a buffer or @code{nil}, and the buffer is
+narrowed and @var{position} is at the end of the narrowed buffer, the
+result may be non-@code{nil}.
 @end defun
 
 @defvar default-text-properties
diff --git a/src/textprop.c b/src/textprop.c
index c6c9e102e3..072aac2866 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -561,8 +561,13 @@ DEFUN ("text-properties-at", Ftext_properties_at,
        doc: /* Return the list of properties of the character at POSITION in 
OBJECT.
 If the optional second argument OBJECT is a buffer (or nil, which means
 the current buffer), POSITION is a buffer position (integer or marker).
+
 If OBJECT is a string, POSITION is a 0-based index into it.
-If POSITION is at the end of OBJECT, the value is nil.
+
+If POSITION is at the end of OBJECT, the value is nil, but note that
+buffer narrowing does not affect the value.  That is, if OBJECT is a
+buffer or nil, and the buffer is narrowed and POSITION is at the end
+of the narrowed buffer, the result may be non-nil.
 
 If you want to display the text properties at point in a human-readable
 form, use the `describe-text-properties' command.  */)
@@ -590,7 +595,11 @@ DEFUN ("get-text-property", Fget_text_property, 
Sget_text_property, 2, 3, 0,
        doc: /* Return the value of POSITION's property PROP, in OBJECT.
 OBJECT should be a buffer or a string; if omitted or nil, it defaults
 to the current buffer.
-If POSITION is at the end of OBJECT, the value is nil.  */)
+
+If POSITION is at the end of OBJECT, the value is nil, but note that
+buffer narrowing does not affect the value.  That is, if the buffer is
+narrowed and POSITION is at the end of the narrowed buffer, the result
+may be non-nil.  */)
   (Lisp_Object position, Lisp_Object prop, Lisp_Object object)
 {
   return textget (Ftext_properties_at (position, object), prop);



reply via email to

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