From 6127692848385556d9221e73b0543751bf90c976 Mon Sep 17 00:00:00 2001 From: Jeetaditya Chatterjee Date: Mon, 8 Nov 2021 15:22:49 +0000 Subject: [PATCH] fix(fold): handle bounding error This basically stops the "not overlay" error we were getting when you tried to jump to many times. this does have the disadvantage of not jumping at all if the amount of jumps is higher than the amount of overlays but this can be fixed in a future commit if necessary. --- modules/editor/fold/autoload/fold.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/editor/fold/autoload/fold.el b/modules/editor/fold/autoload/fold.el index b3bd8ad6c..7ae2aef1c 100644 --- a/modules/editor/fold/autoload/fold.el +++ b/modules/editor/fold/autoload/fold.el @@ -172,7 +172,8 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds." (cl-sort (eval `(overlays-in ,@arg-list)) (lambda (ov1 ov2) (funcall comp-fun (overlay-start ov1) (overlay-start ov2))))))) - (if ovs (goto-char (overlay-start (nth (- (abs count) 1) ovs)))))))) + (if (and ovs (<= count (length ovs))) + (goto-char (overlay-start (nth (- (abs count) 1) ovs)))))))) if (save-excursion (funcall fn)) collect it into points finally do