From 78b8ceb0fcef5f516913d5868c74966fe06b9d44 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 1 Feb 2023 19:57:43 +0200 Subject: [PATCH] * (xref-backend-references): report progress while formatting refs --- sweeprolog.el | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/sweeprolog.el b/sweeprolog.el index 1f283d7..f8acb87 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -4514,17 +4514,20 @@ accordingly." (list (xref-make (concat path ":" (number-to-string line)) (xref-make-file-location path line 0))))) (cl-defmethod xref-backend-references ((_backend (eql sweeprolog)) mfn) - (let ((refs (sweeprolog-predicate-references mfn))) - (seq-map (lambda (loc) - (let* ((by (nth 0 loc)) - (file (nth 1 loc)) - (beg (nth 2 loc)) - (buf (find-file-noselect file t))) - (xref-make (format "Call from %s at line %s" by - (with-current-buffer buf - (line-number-at-pos beg t))) - (xref-make-buffer-location buf beg)))) - refs))) + (let ((xref-items nil) + (refs (sweeprolog-predicate-references mfn))) + (dolist-with-progress-reporter (loc refs) + "Formatting cross references... " + (push (let* ((by (nth 0 loc)) + (file (nth 1 loc)) + (beg (nth 2 loc)) + (buf (find-file-noselect file t))) + (xref-make (format "Call from %s at line %s" by + (with-current-buffer buf + (line-number-at-pos beg t))) + (xref-make-buffer-location buf beg))) + xref-items)) + (reverse xref-items))) (cl-defmethod xref-backend-apropos ((_backend (eql sweeprolog)) pattern) (let ((matches (sweeprolog-predicate-apropos pattern))) -- 2.39.2