Skip to content

Commit

Permalink
hybrid: redefine evil-insert-state-p
Browse files Browse the repository at this point in the history
If it has nasty side effects we will just revert it in favor of the
precedent commit.
  • Loading branch information
syl20bnr committed Sep 26, 2015
1 parent 90fc25a commit 983e569
Showing 1 changed file with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,13 @@
(setf (symbol-function 'hybrid-mode--evil-insert-state-backup)
(symbol-function 'evil-insert-state))

(eval-after-load 'evil
'(progn
(defun evil-visual-activate-hook (&optional command)
"Enable Visual state if the region is activated."
(unless (evil-visual-state-p)
(evil-delay nil
;; the activation may only be momentary, so re-check
;; in `post-command-hook' before entering Visual state
'(unless (or (evil-visual-state-p)
(evil-insert-state-p)
(evil-hybrid-state-p)
(evil-emacs-state-p))
(when (and (region-active-p)
(not deactivate-mark))
(evil-visual-state)))
'post-command-hook nil t
"evil-activate-visual-state")))
(put 'evil-visual-activate-hook 'permanent-local-hook t)))
;; Override stock evil function `evil-insert-state-p'
(defun evil-insert-state-p (&optional state)
"Whether the current state is insert.
\(That is, whether `evil-state' is either `evil-insert-state' or
`evil-hybrid-state'.)"
(and evil-local-mode
(memq (or state evil-state) '(insert hybrid))))

;;;###autoload
(define-minor-mode hybrid-mode
Expand Down

0 comments on commit 983e569

Please sign in to comment.