From 32bf2ee4cfd5c6d5681c883eab5e6f7a447855e8 Mon Sep 17 00:00:00 2001 From: Jeetaditya Chatterjee Date: Thu, 9 Dec 2021 03:22:33 +0000 Subject: [PATCH] fix(tree-sitter): message raised when jumping up as opposed to a nasty error, the error was raised because I was not using the abs of count this commit also comes with general code cleanup, this includes - removal of the eval quasiquote antipattern when an apply would work better - use of the :key keyword instead of the lambda --- modules/editor/fold/autoload/fold.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/editor/fold/autoload/fold.el b/modules/editor/fold/autoload/fold.el index 7ae2aef1c..5386d376b 100644 --- a/modules/editor/fold/autoload/fold.el +++ b/modules/editor/fold/autoload/fold.el @@ -169,11 +169,9 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds." (eq (overlay-get ov 'creator) 'ts-fold)) ;; `overlays-in' does not provide a list that is sorted ;; (in the way we need it atleast) so we need to sort it based on direction - (cl-sort (eval `(overlays-in ,@arg-list)) - (lambda (ov1 ov2) - (funcall comp-fun (overlay-start ov1) (overlay-start ov2))))))) - (if (and ovs (<= count (length ovs))) - (goto-char (overlay-start (nth (- (abs count) 1) ovs)))))))) + (cl-sort (apply #'overlays-in arg-list) comp-fun :key #'overlay-start)))) + (if (and ovs (<= (abs count) (length ovs))) + (goto-char (overlay-start (nth (- (abs count) 1) ovs)))))))) if (save-excursion (funcall fn)) collect it into points finally do