Improve documentation of 'invisible-p'
* doc/lispref/display.texi (Invisible Text): Document the return value of 'invisible-p'. * src/xdisp.c (Finvisible_p): Rename the argument POS. Doc fix. (Bug#29721)
This commit is contained in:
parent
a1327bbc64
commit
7890864413
2 changed files with 23 additions and 12 deletions
|
@ -929,13 +929,18 @@ major mode should use the mode's own name as an element of
|
|||
|
||||
@defun invisible-p pos-or-prop
|
||||
If @var{pos-or-prop} is a marker or number, this function returns a
|
||||
non-@code{nil} value if the text at that position is invisible.
|
||||
non-@code{nil} value if the text at that position is currently
|
||||
invisible.
|
||||
|
||||
If @var{pos-or-prop} is any other kind of Lisp object, that is taken
|
||||
to mean a possible value of the @code{invisible} text or overlay
|
||||
property. In that case, this function returns a non-@code{nil} value
|
||||
if that value would cause text to become invisible, based on the
|
||||
current value of @code{buffer-invisibility-spec}.
|
||||
|
||||
The return value of this function is @code{t} if the text would be
|
||||
completely hidden on display, or a non-@code{nil}, non-@code{t} value
|
||||
if the text would be replaced by an ellipsis.
|
||||
@end defun
|
||||
|
||||
@vindex line-move-ignore-invisible
|
||||
|
|
28
src/xdisp.c
28
src/xdisp.c
|
@ -25086,19 +25086,25 @@ invisible_prop (Lisp_Object propval, Lisp_Object list)
|
|||
}
|
||||
|
||||
DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0,
|
||||
doc: /* Non-nil if the property makes the text invisible.
|
||||
POS-OR-PROP can be a marker or number, in which case it is taken to be
|
||||
a position in the current buffer and the value of the `invisible' property
|
||||
is checked; or it can be some other value, which is then presumed to be the
|
||||
value of the `invisible' property of the text of interest.
|
||||
The non-nil value returned can be t for truly invisible text or something
|
||||
else if the text is replaced by an ellipsis. */)
|
||||
(Lisp_Object pos_or_prop)
|
||||
doc: /* Non-nil if text properties at POS cause text there to be currently invisible.
|
||||
POS should be a marker or a buffer position; the value of the `invisible'
|
||||
property at that position in the current buffer is examined.
|
||||
POS can also be the actual value of the `invisible' text or overlay
|
||||
property of the text of interest, in which case the value itself is
|
||||
examined.
|
||||
|
||||
The non-nil value returned can be t for currently invisible text that is
|
||||
entirely hidden on display, or some other non-nil, non-t value if the
|
||||
text is replaced by an ellipsis.
|
||||
|
||||
Note that whether text with `invisible' property is actually hidden on
|
||||
display may depend on `buffer-invisibility-spec', which see. */)
|
||||
(Lisp_Object pos)
|
||||
{
|
||||
Lisp_Object prop
|
||||
= (NATNUMP (pos_or_prop) || MARKERP (pos_or_prop)
|
||||
? Fget_char_property (pos_or_prop, Qinvisible, Qnil)
|
||||
: pos_or_prop);
|
||||
= (NATNUMP (pos) || MARKERP (pos)
|
||||
? Fget_char_property (pos, Qinvisible, Qnil)
|
||||
: pos);
|
||||
int invis = TEXT_PROP_MEANS_INVISIBLE (prop);
|
||||
return (invis == 0 ? Qnil
|
||||
: invis == 1 ? Qt
|
||||
|
|
Loading…
Add table
Reference in a new issue