“Wrong type argument: commandp” error when binding a lambda to a key
问题 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. 回答1: 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. 回答2: The correct form should be this - (global-set-key (kbd "M-n") (lambda ()