sighol
sighol

Reputation: 2828

Emacs: error wrong number of arguments when trying to call my function

I'm trying to make a function that moves to the end of line and inserts a newline.

(defun newline-below ()
    (interactive)
    (move-end-of-line)
    (newline)
)

However, I get a cryptic error when I try to run it.

newline-below: Wrong number of arguments: #[(arg) "

Upvotes: 6

Views: 8013

Answers (1)

choroba
choroba

Reputation: 242168

The function move-end-of-line needs an argument (try C-hf while the cursor is over the function). Just nil might work for your purpose:

(move-end-of-line nil)

Upvotes: 12

Related Questions