When I define a function using define-skeleton I'm able to create an abbreviation for it in my abbrev table through,
("abbrev_name" "" function_name nil)
However, if I use defun (which needs arguements), e.g.,
(defun function_name (arg)
""
(interactive "sThe argument is")
(insert arg)
)
then I can still call it using "M-x function_name" but I'm not able to call it using an abbreviation (I get an error message pertaining wrong number of arguments). Is there a workaround that I can use here?
Emacs is calling your function with 0 arguments
Instead of
("abbrev_name" "" function_name nil)
use this:
("abbrev_name" "" (lambda () (call-interactively 'function_name)) nil)
This way, emacs will prompt you to insert the string at the minibuffer.