Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Wrong type argument: commandp" error when binding a lambda to a key

Tags:

emacs

elisp

I am getting a "Wrong type argument: commandp, (lambda nil (forward-line 5))" here.

(global-set-key [?\M-n] (lambda () (forward-line 5))) 

What is the error? I'm fairly sure it's simple & I'm missing something obvious.

like image 967
Paul Nathan Avatar asked Aug 09 '09 06:08

Paul Nathan


1 Answers

global-set-key expects an interactive command. (lambda () (interactive) (forward-line 5)) ought to work.

By the way, C-h f commandp is a pretty good starting point for errors like that.

like image 65
brendan Avatar answered Oct 07 '22 03:10

brendan