emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2d53f87: Fix order of sorted overlays returned by '


From: Eli Zaretskii
Subject: [Emacs-diffs] master 2d53f87: Fix order of sorted overlays returned by 'overlays-at'
Date: Sat, 16 Sep 2017 06:03:47 -0400 (EDT)

branch: master
commit 2d53f8783ff8e48d91809741adab6a2402587fad
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 etc/NEWS     | 8 ++++++++
 src/buffer.c | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index ce82804..a042ce9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1336,6 +1336,14 @@ Affected functions include add-name-to-file, 
copy-directory,
 copy-file, format-write-file, gnus-copy-file, make-symbolic-link,
 rename-file, thumbs-rename-images, and write-file.
 
+---
+** The list returned by 'overlays-at' is now in decreasing priority order.
+The documentation of this function always said the order should be
+that of decreasing priority, if the 2nd argument of the function is
+non-nil, but the code returned the list in the increasing order of
+priority instead.  Now the code does what the documentation says it
+should do.
+
 
 * Lisp Changes in Emacs 26.1
 
diff --git a/src/buffer.c b/src/buffer.c
index bc28ac7..76670b8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4179,6 +4179,12 @@ If SORTED is non-nil, then sort them by decreasing 
priority.  */)
   /* Make a list of them all.  */
   result = Flist (noverlays, overlay_vec);
 
+  /* The doc string says the list should be in decreasing order of
+     priority, so we reverse the list, because sort_overlays sorts in
+     the increasing order of priority.  */
+  if (!NILP (sorted))
+    result = Fnreverse (result);
+
   xfree (overlay_vec);
   return result;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]