emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/eglot 356100a 19/69: Fix #220: don't sort xref's by def


From: João Távora
Subject: [elpa] externals/eglot 356100a 19/69: Fix #220: don't sort xref's by default
Date: Sun, 20 Oct 2019 08:21:44 -0400 (EDT)

branch: externals/eglot
commit 356100ab177cc51c73980ed5a8b7a3168158f526
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Fix #220: don't sort xref's by default
    
    But use a eglot-xref-lessp-function in case someone wants to tweak
    this.
    
    * eglot.el (eglot-xref-lessp-function): New variable.
    (eglot--handling-xrefs): Use it.
---
 eglot.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eglot.el b/eglot.el
index 79e4146..4fdd5c4 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1678,13 +1678,13 @@ DUMMY is ignored."
 (defvar eglot--temp-location-buffers (make-hash-table :test #'equal)
   "Helper variable for `eglot--handling-xrefs'.")
 
+(defvar eglot-xref-lessp-function #'ignore
+  "Compare two `xref-item' objects for sorting.")
+
 (defmacro eglot--handling-xrefs (&rest body)
   "Properly sort and handle xrefs produced and returned by BODY."
   `(unwind-protect
-       (sort (progn ,@body)
-             (lambda (a b)
-               (< (xref-location-line (xref-item-location a))
-                  (xref-location-line (xref-item-location b)))))
+       (sort (progn ,@body) eglot-xref-sort-function)
      (maphash (lambda (_uri buf) (kill-buffer buf)) 
eglot--temp-location-buffers)
      (clrhash eglot--temp-location-buffers)))
 



reply via email to

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