From 1b3511890ede16c79616816c8c3ced43c5db23f7 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 20 Sep 2018 22:27:15 -0400 Subject: [PATCH] feature/evil: fix overzealous folding from :n TAB Changes +evil/matchit-or-toggle-fold to be less trigger-happy about toggling folds (it will only open folds not, not toggle them). Also updates its docstring. --- modules/feature/evil/autoload/folds.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/feature/evil/autoload/folds.el b/modules/feature/evil/autoload/folds.el index 68cf16ad5..1acefc5dd 100644 --- a/modules/feature/evil/autoload/folds.el +++ b/modules/feature/evil/autoload/folds.el @@ -147,15 +147,16 @@ ;;;###autoload (defun +evil/matchit-or-toggle-fold () - "Do what I mean. If on a fold-able element, toggle the fold with -`hs-toggle-hiding'. Otherwise, if on a delimiter, jump to the matching one with -`evilmi-jump-items'. If in a magit-status buffer, use `magit-section-toggle'." + "Do what I mean. + +If in a magit-status buffer, use `magit-section-toggle'. +If on a folded element, unfold it. +Otherwise, jump to the matching delimiter with `evilmi-jump-items'." (interactive) (ignore-errors (call-interactively (cond ((derived-mode-p 'magit-mode) #'magit-section-toggle) - ((+evil-fold-p) - #'+evil:fold-toggle) - (t - #'evilmi-jump-items))))) + ((+evil-from-eol (invisible-p (point))) + #'+evil/fold-toggle) + (#'evilmi-jump-items)))))