diff options
| author | Eli Zaretskii | 2017-09-16 13:02:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-09-16 13:02:31 +0300 |
| commit | 2d53f8783ff8e48d91809741adab6a2402587fad (patch) | |
| tree | c1c1ddb669858bba255fdf2333acf1b52580f3d6 | |
| parent | a103dbe36022cd2454eaeed96def1c777c049762 (diff) | |
| download | emacs-2d53f8783ff8e48d91809741adab6a2402587fad.tar.gz emacs-2d53f8783ff8e48d91809741adab6a2402587fad.zip | |
Fix order of sorted overlays returned by 'overlays-at'
* src/buffer.c (Foverlays_at): If SORTED is non-nil, reverse the
list of results, to have their order as per the documentation.
(Bug#28390)
* etc/NEWS: Mention the change in the behavior of overlays-at.
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | src/buffer.c | 6 |
2 files changed, 14 insertions, 0 deletions
| @@ -1336,6 +1336,14 @@ Affected functions include add-name-to-file, copy-directory, | |||
| 1336 | copy-file, format-write-file, gnus-copy-file, make-symbolic-link, | 1336 | copy-file, format-write-file, gnus-copy-file, make-symbolic-link, |
| 1337 | rename-file, thumbs-rename-images, and write-file. | 1337 | rename-file, thumbs-rename-images, and write-file. |
| 1338 | 1338 | ||
| 1339 | --- | ||
| 1340 | ** The list returned by 'overlays-at' is now in decreasing priority order. | ||
| 1341 | The documentation of this function always said the order should be | ||
| 1342 | that of decreasing priority, if the 2nd argument of the function is | ||
| 1343 | non-nil, but the code returned the list in the increasing order of | ||
| 1344 | priority instead. Now the code does what the documentation says it | ||
| 1345 | should do. | ||
| 1346 | |||
| 1339 | 1347 | ||
| 1340 | * Lisp Changes in Emacs 26.1 | 1348 | * Lisp Changes in Emacs 26.1 |
| 1341 | 1349 | ||
diff --git a/src/buffer.c b/src/buffer.c index bc28ac7d1aa..76670b89545 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4179,6 +4179,12 @@ If SORTED is non-nil, then sort them by decreasing priority. */) | |||
| 4179 | /* Make a list of them all. */ | 4179 | /* Make a list of them all. */ |
| 4180 | result = Flist (noverlays, overlay_vec); | 4180 | result = Flist (noverlays, overlay_vec); |
| 4181 | 4181 | ||
| 4182 | /* The doc string says the list should be in decreasing order of | ||
| 4183 | priority, so we reverse the list, because sort_overlays sorts in | ||
| 4184 | the increasing order of priority. */ | ||
| 4185 | if (!NILP (sorted)) | ||
| 4186 | result = Fnreverse (result); | ||
| 4187 | |||
| 4182 | xfree (overlay_vec); | 4188 | xfree (overlay_vec); |
| 4183 | return result; | 4189 | return result; |
| 4184 | } | 4190 | } |