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
    This sounds as if you have accidentally enabled capslock. You should be able to verify this with 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.
    – wasamasa
    Commented Oct 5, 2017 at 10:11
  • 2
    @wasamasa I am sure, that I have not enabled capslock. Than even other keys would behave different from normal, which is not the case. Could you explain, how to log state in the relevant functions? I assume I have to edit the evil source for that? Commented Oct 6, 2017 at 9:14
  • 1
    This happens to me in Spacemacs (develop branch) now and then. I have capslock remapped to control, so @wasamasa's hypothesis can't be correct. F1 l switches me to a different frame. The only solution I have found is to quit and restart emacs.
    – ken
    Commented Jun 28, 2018 at 22:12

2 Answers 2


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:

  1. In command mode, initiate a search by pressing the / key
  2. With the mouse, click on any text in your buffer
  3. Press the d key a single time and a line will be deleted

Steps to resolve:

  1. With the mouse, click on your incomplete search
  2. Either cancel the search by pressing the DEL key until the search is cleared OR complete the search by pressing the RET key
  3. 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))

(add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)

in .spacemacs under dotspacemacs/user-config seems to resolve the problem.

  • 1
    Good 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.
    – wasamasa
    Commented Mar 12, 2019 at 7:56
  • Thanks @wasamasa, one work-around is to stop using the mouse! I am pretty new to emacs, so delving into evil code is beyond me right now. Is this the right place to raise an issue?
    – Lee Read
    Commented Mar 30, 2019 at 15:01
  • 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.