branch: externals/consult
commit b48ff6bf0527baeb6bfd07c6da9d303ff0b79c3d
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
consult-register--alist: Filter registers with marker-buffer=nil (Fix #970)
---
consult-register.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/consult-register.el b/consult-register.el
index a4b858cd0e..ec01cae043 100644
--- a/consult-register.el
+++ b/consult-register.el
@@ -170,11 +170,14 @@ If COMPLETION is non-nil format the register for
completion."
(defun consult-register--alist (&optional noerror filter)
"Return register list, sorted and filtered with FILTER.
Raise an error if the list is empty and NOERROR is nil."
- (or (sort (seq-filter
- ;; Sometimes, registers are made without a `cdr'.
- ;; Such registers don't do anything, and can be ignored.
- (lambda (x) (and (cdr x) (or (not filter) (funcall filter x))))
- register-alist)
+ (or (sort (cl-loop for reg in register-alist
+ ;; Sometimes, registers are made without a `cdr' or with
+ ;; invalid markers. Such registers don't do anything, and
+ ;; can be ignored.
+ if (and (cdr reg)
+ (or (not (markerp (cdr reg))) (marker-buffer (cdr
reg)))
+ (or (not filter) (funcall filter reg)))
+ collect reg)
#'car-less-than-car)
(and (not noerror) (user-error "All registers are empty"))))