help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Passing arguments to functions


From: Drew Adams
Subject: RE: Passing arguments to functions
Date: Tue, 22 Feb 2011 06:13:19 -0800

> - How do I pass arguments to a function call? i.e. if I do "M-x
> some-function" and "some-function" takes optional arguments, 
> how do I pass those arguments to the function call? 

If you are writing the function, then you do this using an `interactive' spec.
`C-h i m elisp m using interactive'.

If you are not writing the function yourself, and it has no `interactive' spec,
and it does not use the universal argument (`C-u') in any conditional way, then
you're (almost) out of luck.  In that case, you can use `M-: (function arg 1
arg2...)' or define your own command (function with an interactive spec) that
takes care of the arguments and then calls the ready-made function.

> - Also, why is it that "C-h f function-name" will document 
> some functions, but when I type "M-x function-name" it says
> [no match]?

`M-x' is for commands, that is, interactive functions, that is, functions that
have an `interactive' spec.  `[no match]' tells you that the function is not a
command.

You will help yourself if you take a look at the doc.  Start with the Emacs
manual, but the Elisp manual is helpful for writing your own functions
(including commands).  See also the `Emacs Lisp Intro' manual.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]