aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-08-25 11:04:38 +0000
committerRichard M. Stallman2005-08-25 11:04:38 +0000
commit7fdba7057b6f95da5217c18cd7f9b4c031c2140c (patch)
treee89c45ab1d305ce142dbac2d933629dccfa0d0f1
parentc6a816dfe1387deccbb9d293e054f2a6d09b8b34 (diff)
downloademacs-7fdba7057b6f95da5217c18cd7f9b4c031c2140c.tar.gz
emacs-7fdba7057b6f95da5217c18cd7f9b4c031c2140c.zip
(Finding Overlays): Fix `find-overlay-prop' in `next-overlay-change' example.
-rw-r--r--lispref/display.texi14
1 files changed, 10 insertions, 4 deletions
diff --git a/lispref/display.texi b/lispref/display.texi
index d4be7b54cc0..8addb3b67ec 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -1501,20 +1501,26 @@ end of an overlay, before @var{pos}. If there is none, it returns
1501@code{(point-min)}. 1501@code{(point-min)}.
1502@end defun 1502@end defun
1503 1503
1504 Here's an easy way to use @code{next-overlay-change} to search for the 1504 Here's a function which uses @code{next-overlay-change} to search
1505next character which gets a non-@code{nil} @code{happy} property from 1505for the next character which gets a given property @code{prop} from
1506either its overlays or its text properties (@pxref{Property Search}): 1506either its overlays or its text properties (@pxref{Property Search}):
1507 1507
1508@smallexample 1508@smallexample
1509(defun find-overlay-prop (prop) 1509(defun find-overlay-prop (prop)
1510 (save-excursion 1510 (save-excursion
1511 (while (and (not (eobp)) 1511 (while (and (not (eobp))
1512 (not (get-char-property (point) 'happy))) 1512 (not (get-char-property (point) prop)))
1513 (goto-char (min (next-overlay-change (point)) 1513 (goto-char (min (next-overlay-change (point))
1514 (next-single-property-change (point) 'happy)))) 1514 (next-single-property-change (point) prop))))
1515 (point))) 1515 (point)))
1516@end smallexample 1516@end smallexample
1517 1517
1518 Now you can search for a @code{happy} property like this:
1519
1520@smallexample
1521(find-overlay-prop 'happy)
1522@end smallexample
1523
1518@node Width 1524@node Width
1519@section Width 1525@section Width
1520 1526