Fix improperly initialized code folding system

This commit is contained in:
Henrik Lissner 2017-05-19 02:59:25 +02:00
parent 323b2f6c2f
commit 34d1364c5b
2 changed files with 31 additions and 27 deletions

View File

@ -7,15 +7,17 @@
;;
;; So this is my effort to combine them.
;; Initialize the two modes
(evil-vimish-fold-mode +1)
;; --- fold functions ---------------------
(defun +evil--vimish-fold-p ()
(cl-some #'vimish-fold--vimish-overlay-p (overlays-at (point))))
(defun +evil--ensure-modes ()
"Ensure hs-minor-mode is enabled."
(unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode +1)))
;; --- fold commands ----------------------
;;;###autoload
(defun +evil-fold-p ()
(or (+evil--vimish-fold-p)

View File

@ -51,24 +51,6 @@
;; Don't interfere with localleader key
(define-key evil-motion-state-map "\\" nil)
;; Custom folding system
(add-to-list
'evil-fold-list
'((evil-vimish-mode hs-minor-mode)
:delete vimish-fold-delete
:open-all +evil/fold-open-all
:close-all +evil/fold-close-all
:toggle +evil/fold-toggle
:open +evil/fold-open
:open-rec nil
:close +evil/fold-close))
(defun +evil*fold-hs-minor-mode (&rest args)
"Lazily activate buffer-local hs-minor-mode."
(unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode +1)))
(advice-add #'evil-fold-action :before #'+evil*fold-hs-minor-mode)
;; Set cursor colors later, once theme is loaded
(defun +evil*init-cursors (&rest _)
(setq evil-default-cursor (face-background 'cursor nil t)
@ -420,11 +402,31 @@ the new algorithm is confusing, like in python or ruby."
:config (global-evil-surround-mode 1))
(def-package! evil-vimish-fold
:commands evil-vimish-fold-mode
(def-package! evil-vimish-fold :demand t
:init
(setq vimish-fold-dir (concat doom-cache-dir "vimish-fold/")
vimish-fold-indication-mode 'right-fringe))
vimish-fold-indication-mode 'right-fringe)
:config
(evil-vimish-fold-mode +1)
;; custom folding system
(defun +evil*fold-hs-minor-mode (&rest args)
"Lazily activate buffer-local hs-minor-mode."
(unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode +1)))
(advice-add #'evil-fold-action :before #'+evil*fold-hs-minor-mode)
(add-to-list
'evil-fold-list
'((evil-vimish-fold-mode hs-minor-mode)
:delete vimish-fold-delete
:open-all +evil/fold-open-all
:close-all +evil/fold-close-all
:toggle +evil/fold-toggle
:open +evil/fold-open
:open-rec nil
:close +evil/fold-close)))
;; Without `evil-visualstar', * and # grab the word at point and search, no