"arguments" refer to those inputs to a function or program which are configurable by the caller, potentially differing on each call. Every argument is an input, but not every input is an argument -- for instance, a stream of data from a mouse could be an input and not an argument.
Questions tagged [arguments]
54 questions
12
votes
3 answers
How to manipulate argument list in nadvice.el?
Following on from an answer to another question about the new advice system:
In old-style advice.el, it was possible to manipulate individual members of an advised function's argument list, without making any assertions regarding those members not…

Aaron Miller
- 552
- 2
- 12
12
votes
3 answers
How to write a transparent "pass-through" function wrapper?
What I mean by a "transparent 'pass-through' function wrapper" is a function, let's call it wrapper, that returns the result from passing all its argument to some other function, let's call it wrappee.
How is this done in Emacs Lisp?
NB: The ideal…

kjo
- 3,145
- 14
- 42
8
votes
1 answer
How to programmatically answer "yes" to those commands that prompt for a decision from the user?
I made a custom function that combines two functions of twittering-mode , twittering-favorite and twittering-native-retweet, however these two needs input from me by answering an yes or no question.
I want to know if there is a way to wrap those…

shackra
- 2,702
- 18
- 47
7
votes
2 answers
Is there a way to only accept certain arguments to a function?
I want to write a function where the only two valid values for the input argument are "dag" or "rulegraph". Is there a way to specify that only these two arguments are accepted this in the elisp function header?
If this is not possible, I'd accept…

The Unfun Cat
- 2,393
- 16
- 32
5
votes
2 answers
What is a good strategy to locating function arguments in a buffer?
I'd like to create a few routines for manipulating function arguments in buffers, which of course requires me to first locate the arguments. Suppose that I'm operating on a buffer with a programming language with a C-like syntax, then I could…

dpritch
- 425
- 5
- 7
4
votes
3 answers
Reflection on function argument signatures
Is there anything built into elisp for reflection on function argument signatures?
I have used (length (cadr (symbol-function #'my/function))), but this notably fails on built-in C functions.
I'm sure there are probably limitations because of…

ebpa
- 7,319
- 26
- 53
4
votes
2 answers
Calling a function with a shorter but unknown argument signature length
Is there a terse idiomatic way of calling a function in the manner of funcall (dereferencing function symbols) when that function may have a variably shorter function signature?
Say for example: a hook assumes a signature of (VALUE PARENT), but for…

ebpa
- 7,319
- 26
- 53
3
votes
1 answer
How to introspect function & macro arguments in elisp?
Is there a programmatic way to access function/macro arguments,
Something like this, which returns the the arg count and true if it accepts any number of additional arguments.
eg:
(number-of-arguments-and-rest "if") -> '(2,…

ideasman42
- 8,375
- 1
- 28
- 105
3
votes
1 answer
Was Emacs launched with a filename argument?
Suppose I want Emacs to be configured differently depending on whether or not it was launched with a filename as an argument.
Is there a way I can deduce this as part of my init file?
One way is to check if there are any buffers open:
(require…

Caterpillar
- 274
- 1
- 8
3
votes
2 answers
Error: Wrong type argument: symbolp, (t)
I'm new to emacs and try to learn elisp. I've read some tutorials and try to build now my own customized emacs. Looking at this blog I want to write a similar script for automatically installing required packages.
In the blog the author defines a…

user8
- 171
- 2
- 11
2
votes
1 answer
How to check whether an optional param was input?
I have a command with an optional argument whose value is a number.
I need:
If no input argument then use default value (1000) else use input arg.
(random t)
(defun insert-random-number-at-point(&optional to)
"Insert at point a random number…

a_subscriber
- 3,854
- 1
- 17
- 47
2
votes
2 answers
Evaluating symbol in function arguments affected by destructive operations?
While evaluating a function call, the arguments is from left to right. For example,
(let ((x '(1 2 3)))
(list (nreverse x) x))
;; => ((3 2 1) (1))
The first argument (nreverse x) evaluates to (3 2 1), as a side effect, x is changed to (1), then…

xuchunyang
- 14,302
- 1
- 18
- 39
2
votes
2 answers
Arbitrary length lists as argument for interactive function
Say I have a defun with a dolist inside that I want to be able to pass a string that is then converted to a list with a length equal to the number of words in said string via the minibuffer, so something like:
minibuffer:
list: arg1
or
list: arg1…

Frede
- 55
- 5
2
votes
1 answer
Find out about arguments passed to functions
When I press C-h k C-SPC, Emacs shows me:
C-SPC runs the command set-mark-command (found in global-map), which
is an interactive compiled Lisp function.
It is bound to C-@, C-SPC.
(set-mark-command ARG)
Set the mark where point is, and activate…

UTF-8
- 885
- 6
- 22
2
votes
2 answers
Can I pass an arbitrary symbol/keyword as a non-nil argument?
If a function takes a parameter whose only significance is in whether it's nil or non-nil, is there any reason not to pass it a well-named symbol to clarify what's going on in the calling code?
For example, add-to-list takes an optional APPEND…

ivan
- 1,928
- 10
- 20