roman / evil-paredit

Evil extension to integrate nicely with paredit
MIT License
53 stars 18 forks source link

Bindings are ineffective until mode is changed #7

Closed oscarfv closed 11 years ago

oscarfv commented 11 years ago

After visiting a file and activating evil-paredit, the new bindings are ineffective until state is changed to Normal (even when the initial state is already Normal.)

Steps to reproduce:

  1. Visit a Lisp file
  2. Activate paredit-mode, if necessary
  3. Activate evil-paredit-mode, if necessary
  4. Put the cursor over a parenthesis.
  5. Press x

The parenthesis goes away. "M-x x" shows that the key is still bound to evil-delete-char. Now undo the change and press i to change to Insert mode and Esc to change back to Normal. Put the cursor over a parenthesis again and press x. This time the deletion doesn't happen, as expected, and "M-x x" shows that the key is bound to paredit-forward-delete, so the state brought evil-paredit to working state.

This is a fix suggested in the Evil mailing list:

(define-minor-mode evil-paredit-mode
  "Minor mode for setting up Evil with paredit in a single buffer"
  :keymap '()
  (let ((prev-state evil-state))
    (evil-normal-state)
    (evil-change-state prev-state)))

The discussion in the mailing list:

http://article.gmane.org/gmane.emacs.vim-emulation/1815