I really like typing in vim, but vimscript makes zero sense. Since I'm getting interested in Lisp/Clojure, and I've heard nice things about evil mode for emacs, I thought I'd give it a try.

Unfortunately I got weird behavior within moments of my first test file. I expected S to delete a line and drop me into insert mode; instead I got a "Wrong number of arguments" error and a lot of noise in the minibuffer.

I discovered that using c-h k while in insert mode will tell you what command is run by the following keystroke. Emacs tells me that S runs the self-insert-command, but googling around suggests this might be a red herring, as this command is evidently run frequently by processes and not so much by users.

How can I get the key behavior that I want?

ETA: I'm using someone else's .emacs.d. They did define a keybinding for "s-s", but the behavior persists after it's commented out. I don't know how to find if the key is defined elsewhere other than grepping for "s-s" and eyeballing the large number of results.

  • 1
    Are you sure evil-mode is enabled? After enabling evil-mode and typing S, it deleted the line and dropped into insert mode. – dgtized Nov 10 '14 at 5:36
  • Pretty sure--e.g., it has an insert and a command mode, other vim commands like dd work as expected. – tom Nov 10 '14 at 5:56
  • 3
    Then something is conflicting with evil-mode, try using evil-mode alone with emacs -Q and then slowly add back in your other packages. – dgtized Nov 10 '14 at 6:23
  • 5
    (1) Please change your title to /"S key throws error in Evil-mode"/. (2) Report this error to the person whose .emacs.d you're using. It will help them if you get a backtrace by calling M-x toggle-debug-on-error and then reproduce the problem. – Malabarba Nov 10 '14 at 9:58
  • Please do the following: 1) go to normal state, 2) hit C-h k S (which will identify the function to which S is bound). Tell us which function/command is bound to S in normal state. – Dan Nov 11 '14 at 15:09

The quick and dirty version: it sounds like there's Something Odd in the .emacs.d setup that you're using. To get back to the original binding for S in normal state, evaluate the following after loading the rest of your init file (simplest way: stick this line at the end of that file):

(define-key evil-normal-state-map "S" #'evil-change-whole-line)

This line will clobber whatever binding clobbered the original binding.

More generally, follow the advice given in the comments about bisecting your init file and report the problem to the originator of the .emacs.d that you're using in order to figure out what/where the problem is.

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