0

Consider this:

(defun kill-arg-words (arg)
  "kill `arg' words ahead of you"
  (interactive)
  (kill-region (point)
               (progn (forward-word arg) (point)
                      )))

I want to call it as M-x kill-arg-words <RET> 5 <RET>, but instead, it does not provide me the option to type in arguments after the first <RET>. How can I enable this?

3

1 Answer 1

1

In addition to specifying the arglist of the function, you have to declare where the args come from when it is called interactively.

(interactive) alone declares that an interactive call should supply no arguments. Use (interactive "n") to instead specify that when called interactively, it should first prompt for a number in the minibuffer and then supply it as the first argument.

You really should read the help message for it. Use C-h f to pull it up; it goes into some detail.

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.