[Top][All Lists]

[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: Drew Adams
Subject: RE: [External] : Re: Making a function than can only be used interactively
Date: Sat, 9 Jul 2022 14:53:38 +0000

> I also found no way to get the equivalent of
> Code Character "P" if the function includes
> an arg that stores the prefix within a list

"P" stands for `current-prefix-arg'.  Just put
that in the list.

> (defun guling (&optional prefix a b) "Docstring"
>  (interactive
>   (cond
>    ((equal current-prefix-arg 2)
>     (list
>      () ;  What should one put here???


(or even just 2 in this case, since you know it's 2)

>      (read-from-minibuffer "a: ")
>      (read-from-minibuffer "b: "))))) 
>  (processing))

If you want to pass the value of the raw prefix
arg as one of the arguments to your command (in
this case the arg PREFIX), then just put its
value in the list arg of `interactive' (in this
case as the first list element).

You really owe it to yourself, if you're starting
to write some Elisp code, to dig into the fine
manual Emacs that gives you (with `C-h i'):

"An Introduction to Programming in Emacs Lisp"

reply via email to

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