evil-paredit-mode.el mode map blues
Hello. I'm trying Evil since a few days ago (looks great so far) and, as a heavy user of paredit.el, I'll like to avoid the possibility of damaging the structure of my Lisp code with Evil commands. A quick search reveals the existence of a small hack named evil-paredit-mode: https://github.com/roman/evil-paredit/blob/master/evil-paredit.el but, after visiting a Lisp file and executing M-x evil-paredit-mode, at first it seems that it has no effect and M-x x shows that the key is still bound to evil-delete-char. But after some random edit operations, the key becomes bound to paredit-forward-delete, as it should since the activation of evil-paredit-mode. Why could this happen? I'm using Emacs compiled from trunk 5 days ago, Evil from latest git sources and paredit-beta.
Óscar Fuentes <[email protected]> writes:
I'm trying Evil since a few days ago (looks great so far) and, as a heavy user of paredit.el, I'll like to avoid the possibility of damaging the structure of my Lisp code with Evil commands. A quick search reveals the existence of a small hack named evil-paredit-mode:
https://github.com/roman/evil-paredit/blob/master/evil-paredit.el
but, after visiting a Lisp file and executing M-x evil-paredit-mode, at first it seems that it has no effect and M-x x shows that the key is still bound to evil-delete-char. But after some random edit operations, the key becomes bound to paredit-forward-delete, as it should since the activation of evil-paredit-mode.
Why could this happen?
I'm using Emacs compiled from trunk 5 days ago, Evil from latest git sources and paredit-beta.
It seems that the method used by evil-paredit-mode is not adequate for the job. Modifying the local keymap seems to work: (defun foo () (interactive) (define-key evil-normal-state-local-map "d" 'evil-paredit-delete) (define-key evil-normal-state-local-map "c" 'evil-paredit-change) (define-key evil-normal-state-local-map "y" 'evil-paredit-yank) (define-key evil-normal-state-local-map "D" 'evil-paredit-delete-line) (define-key evil-normal-state-local-map "C" 'evil-paredit-change-line) (define-key evil-normal-state-local-map "Y" 'evil-paredit-yank-line) (define-key evil-normal-state-local-map "X" 'paredit-backward-delete) (define-key evil-normal-state-local-map "x" 'paredit-forward-delete) )
On Tue, Mar 19 2013 (00:04), Óscar Fuentes <[email protected]> wrote:
Óscar Fuentes <[email protected]> writes:
But after some random edit operations, the key becomes bound to paredit-forward-delete, as it should since the activation of evil-paredit-mode.
Why could this happen?
The problem is that the bindings come only into effect if the normal mode is activated. So change states and back to normal-state and the bindings come into effect. Also "random operations" is a bad description, C-h l (view-lossage) tells you about your recently typed keys.
It seems that the method used by evil-paredit-mode is not adequate for the job. Modifying the local keymap seems to work:
Modifying evil-paredit-mode also works (you may want to bring this to the attention of the author): (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))) You may also want to add an issue because I also don't think the current behavior is desired. Michael
Hello Michael. Michael Markert <[email protected]> writes:
The problem is that the bindings come only into effect if the normal mode is activated. So change states and back to normal-state and the bindings come into effect.
Also "random operations" is a bad description, C-h l (view-lossage) tells you about your recently typed keys.
I said "random" because different sequences worked on different trials. Didn't notice the "state change" pattern.
It seems that the method used by evil-paredit-mode is not adequate for the job. Modifying the local keymap seems to work:
Modifying evil-paredit-mode also works (you may want to bring this to the attention of the author):
(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)))
Yes, confirmed that it works.
You may also want to add an issue because I also don't think the current behavior is desired.
Done in https://github.com/roman/evil-paredit/issues/7 Thanks Michael.
participants (2)
-
Michael Markert -
Óscar Fuentes