|
From: | Stefan Monnier |
Subject: | Re: Prefix Argument and optional argument |
Date: | Thu, 07 Jul 2022 15:04:01 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> (defun poke (&optional prefix) > "TODO" > (interactive "P") > > (cond > ((equal current-prefix-arg nil) ; no C-u > (setq poke-name-mode 1)) > > ((equal current-prefix-arg '(4)) ; C-u > (setq poke-name-mode 0) > (arktika-workbench)) > > ((equal current-prefix-arg 1) ; C-u 1 > (setq poke-name-mode 0) > > (let* ( (name (read-from-minibuffer " Name: ")) ) > (arktika-workbench name))) ) )) The byte-compiler should tell you that the `prefix` argument is unused, so you can remove it and replace (interactive "P") with (interactive) and that will work just the same. What the "P" does above is provide the (interactive) value of `prefix` by setting it to `current-prefix-arg`. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |