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

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

Re: [External] : Re: Making a function than can only be used interactive


From: Emanuel Berg
Subject: Re: [External] : Re: Making a function than can only be used interactively
Date: Sat, 09 Jul 2022 01:19:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Drew Adams wrote:

> but in the past couple of weeks there've been a
> boatload of similar questions on emacs.SE

The Emacs world is not that big ...

> 1. There's no connection between an argument being optional
>    and it being provided as a prefix argument - none.
>
> 2. The only implication of an arg being mandatory or
>    optional is for calling the function. If it's mandatory
>    then omitting it raises an error; otherwise, no error.
>    That's all

Good points, and the others, but that's not all, that's easy -
to do something sensible with it can be tricky. Don't know how
one succeeds at that tho, maybe one just do something that
works, use it, and refine it, including the interface, little
by little when one get better intuition how it works, what can
be improved and so on?

After doing that one will see certain patterns that reappear
and such things can then be instantly brought into new stuff
that's similar, so the process gets more involved the further
you go ...

> A prefix arg is not necessarily an arg to the function, and
> vice versa.

But it's a good idea for clarity, documentation and also how
do you call it from Lisp in a neat way without it if you want
the same functionality?

> A prefix arg need not be optional.

But it's useful for defaults and the optional arguments
default themselves if not set so it's an easy way to do that.

> Don't ask when to use X. Just get to know X. When and how
> and why to use it will come to you when you know it.

100%

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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