aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorEli Zaretskii2026-02-14 11:37:52 +0200
committerEli Zaretskii2026-02-14 11:37:52 +0200
commit6aefaca819a5f89fd29bd53835d1a1fa9fd595cf (patch)
tree46cf07c78de185fb32dd5a160301d5a3c3d215d7 /src/buffer.c
parent187867f0a99e72737c5efb4409e5372616a80a73 (diff)
downloademacs-6aefaca819a5f89fd29bd53835d1a1fa9fd595cf.tar.gz
emacs-6aefaca819a5f89fd29bd53835d1a1fa9fd595cf.zip
Adjust documentation to changes in 'overlays-in' and 'overlays-at'
* src/buffer.c (overlays_in): Fix commentary to match the code. (Foverlays_in, Foverlays_at): Doc fixes. (Bug#80242) * test/src/buffer-tests.el (test-overlays-at-2): Add one test. * doc/lispref/display.texi (Finding Overlays): Update and improve the documentation of 'overlays-in' and 'overlays-at'. * etc/NEWS: Announce the changes.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/buffer.c b/src/buffer.c
index b1a835b7ac5..b554cf41874 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3052,18 +3052,20 @@ the normal hook `change-major-mode-hook'. */)
3052/* Find all the overlays in the current buffer that overlap the range 3052/* Find all the overlays in the current buffer that overlap the range
3053 [BEG, END). 3053 [BEG, END).
3054 3054
3055 If EMPTY is true, include empty overlays in that range and also at 3055 If EMPTY is true, include empty overlays in that range and also
3056 END, provided END denotes the position at the end of the accessible 3056 those at END, provided END denotes the position at the end of the
3057 part of the buffer.
3058
3059 If TRAILING is true, include overlays that begin at END, provided
3060 END denotes the position at the end of the accessible part of the
3061 buffer. 3057 buffer.
3062 3058
3059 If TRAILING is true, include overlays that begin at ZV.
3060 (FIXME: This argument is nowadays effectively ignored, since the code
3061 no longer pays any attention to ZV. We basically rely on the caller
3062 to ensure that TRAILING is only true when END > ZV. This happens, e.g.,
3063 when we are called from overlays_at with BEG = ZV and END = ZV + 1.)
3064
3063 Return the number found, and store them in a vector in *VEC_PTR. 3065 Return the number found, and store them in a vector in *VEC_PTR.
3064 Store in *LEN_PTR the size allocated for the vector. 3066 Store in *LEN_PTR the size allocated for the vector.
3065 Store in *NEXT_PTR the next position after POS where an overlay starts, 3067 Store in *NEXT_PTR the next position after POS where an overlay starts,
3066 or ZV if there are no more overlays. 3068 or Z if there are no more overlays after POS.
3067 NEXT_PTR may be 0, meaning don't store that info. 3069 NEXT_PTR may be 0, meaning don't store that info.
3068 3070
3069 *VEC_PTR and *LEN_PTR should contain a valid vector and size 3071 *VEC_PTR and *LEN_PTR should contain a valid vector and size
@@ -3875,9 +3877,12 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 2, 0,
3875 doc: /* Return a list of the overlays that contain the character at POS. 3877 doc: /* Return a list of the overlays that contain the character at POS.
3876If SORTED is non-nil, then sort them by decreasing priority. 3878If SORTED is non-nil, then sort them by decreasing priority.
3877 3879
3878Zero-length overlays that start and stop at POS are not included in 3880Zero-length (a.k.a. "empty") overlays that start and stop at POS are not
3879the return value. Instead use `overlays-in' if those overlays are of 3881included in the return value. Use `overlays-in' if empty overlays are of
3880interest. */) 3882interest.
3883
3884This function can return overlays outside of the current narrowing of
3885the buffer if POS is outside of the narrowing. */)
3881 (Lisp_Object pos, Lisp_Object sorted) 3886 (Lisp_Object pos, Lisp_Object sorted)
3882{ 3887{
3883 ptrdiff_t len, noverlays; 3888 ptrdiff_t len, noverlays;
@@ -3916,14 +3921,18 @@ interest. */)
3916 3921
3917DEFUN ("overlays-in", Foverlays_in, Soverlays_in, 2, 2, 0, 3922DEFUN ("overlays-in", Foverlays_in, Soverlays_in, 2, 2, 0,
3918 doc: /* Return a list of the overlays that overlap the region BEG ... END. 3923 doc: /* Return a list of the overlays that overlap the region BEG ... END.
3919Overlap means that at least one character is contained within the overlay 3924Overlap means that at least one character between BEG and END is contained
3920and also contained within the specified region. 3925within the overlay. Note that this excludes the character at (i.e., after)
3926END.
3927
3928Empty overlays do not contain any characters, so they are included in the
3929result if they are located at BEG, between BEG and END, or at END provided
3930END denotes the position at the end of the buffer.
3921 3931
3922Empty overlays are included in the result if they are located at BEG, 3932The resulting list of overlays is in an arbitrary unpredictable order.
3923between BEG and END, or at END provided END denotes the position at the
3924end of the accessible part of the buffer.
3925 3933
3926The resulting list of overlays is in an arbitrary unpredictable order. */) 3934This function can return overlays outside of the current narrowing of
3935the buffer if BEG and/or END are outside of the narrowing. */)
3927 (Lisp_Object beg, Lisp_Object end) 3936 (Lisp_Object beg, Lisp_Object end)
3928{ 3937{
3929 ptrdiff_t len, noverlays; 3938 ptrdiff_t len, noverlays;