1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-08 12:40:49 -08:00

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.
This commit is contained in:
Lars Ingebrigtsen 2022-04-28 13:04:28 +02:00
parent 8a007ebc2e
commit 6db90a412a
2 changed files with 23 additions and 2 deletions

View file

@ -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

View file

@ -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);