nit(fold): fix non idiomatic code

- remove final t in cond
- replace cond with if
- replace seq-filter with cl-remove-if-not
This commit is contained in:
Jeetaditya Chatterjee 2022-04-02 02:40:38 +01:00
parent cd6cb8c499
commit 4334eb285f
No known key found for this signature in database
GPG key ID: 09D54CECD2132B91

View file

@ -113,7 +113,7 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(ts-fold-open-all)) (ts-fold-open-all))
((featurep 'vimish-fold) ((featurep 'vimish-fold)
(vimish-fold-unfold-all)) (vimish-fold-unfold-all))
(t (save-excursion ((save-excursion
(+fold--ensure-hideshow-mode) (+fold--ensure-hideshow-mode)
(if (integerp level) (if (integerp level)
(progn (progn
@ -130,9 +130,10 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(interactive (interactive
(list (if current-prefix-arg (prefix-numeric-value current-prefix-arg)))) (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg))))
(save-excursion (save-excursion
(cond ((+fold--ts-fold-p) (if (+fold--ts-fold-p)
(ts-fold-close-all)) (ts-fold-close-all)
(t (when (featurep 'vimish-fold) (progn
(when (featurep 'vimish-fold)
(vimish-fold-refold-all)) (vimish-fold-refold-all))
(+fold--ensure-hideshow-mode) (+fold--ensure-hideshow-mode)
(hs-life-goes-on (hs-life-goes-on
@ -164,7 +165,7 @@ Targets `vimmish-fold', `hideshow', `ts-fold' and `outline' folds."
(comp-fun (if (> count 0) ;; also depending on direction we need to change how we sort the list (comp-fun (if (> count 0) ;; also depending on direction we need to change how we sort the list
#'< #'<
#'>)) #'>))
(ovs (seq-filter (ovs (cl-remove-if-not
(lambda (ov) (lambda (ov)
(eq (overlay-get ov 'creator) 'ts-fold)) (eq (overlay-get ov 'creator) 'ts-fold))
;; `overlays-in' does not provide a list that is sorted ;; `overlays-in' does not provide a list that is sorted