When I use Emacs with Evil mode for some time, I sometimes get to a point, where I have no choice to what I want to delete when pressing d
(or calling evil-delete
). The current line gets deleted without that I have pressed d
for the line a second time. Same behavior is shown when pressing c
or calling evil-change
. Both are acting like having pressed dd
or cd
instead.
Certainly I have accidentally pressed some keyboard shortcuts to activate this mapping, but I have no clue how to find out what is happening there. At the moment my only chance is to restart Emacs to get back to normal behavior. If I only knew what happens, maybe I would be able to switch back to normal behavior without restarting Emacs.
2 Answers
I noticed the d key deleting a line on a single press as well. I am using Spacemacs [email protected] on the develop branch. I do not know if this is your case, but I had an incomplete search in progress.
Steps to reproduce:
- In command mode, initiate a search by pressing the / key
- With the mouse, click on any text in your buffer
- Press the d key a single time and a line will be deleted
Steps to resolve:
- With the mouse, click on your incomplete search
- Either cancel the search by pressing the DEL key until the search is cleared OR complete the search by pressing the RET key
- The behavior of the d key should return to normal (at least it did for me)
Update 2019-05-14
I stumbled upon a solution from @trey-jackson. For spacemacs users, plunking Trey's solution:
(defun stop-using-minibuffer ()
"kill the minibuffer"
(when (and (>= (recursion-depth) 1) (active-minibuffer-window))
(abort-recursive-edit)))
(add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)
in .spacemacs
under dotspacemacs/user-config
seems to resolve the problem.
-
1Good catch! This appears to boil down to an unhandled case in
evil-operator-range
where it falls back to regular motions. Now, if you have any ideas how to detect this state, that would be nice.– wasamasaCommented Mar 12, 2019 at 7:56 -
-
I created an account to upvote you. thought i was crazy Commented Nov 1, 2021 at 20:38
What worked for me: I was using (evil-set-undo-system 'undo-tree)
, and getting "Re-entering top level after C stack overflow"
errors frequently when saving large files with long undo-tree histories. When I stopped using undo-tree I stopped getting those errors, and also stopped getting the "pressing d
a single time deletes the whole line as if I pressed dd
" behavior.
F1 l
. The other option of debugging is instrumenting the relevant functions to log their internal state and inspect the log whenever running into that situation.F1 l
switches me to a different frame. The only solution I have found is to quit and restart emacs.