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

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

RE: A way for interactive to modify a let-bound variable?


From: Drew Adams
Subject: RE: A way for interactive to modify a let-bound variable?
Date: Fri, 12 Feb 2016 08:57:49 -0800 (PST)

> (defun my-dummy-fn ()
>   (let (msg)
>     (interactive (progn
>                    (if (use-region-p)
>                        (setq msg "Region")
>                      (setq msg "No region"))
>                    nil))
>     (message msg)))
> 
> This is a very simplified example. But I need to change a let-bound
> variable in the interactive form based on some condition and then use that
> variable in the defun body.  Is that possible?

No. The only thing available in the defun body that comes from
the `interactive' form is its return value, which is the list of
arguments passed to the function.

Show or explain what you are really trying to do. IOW, this sounds
like an X-Y problem: you are asking about your try at a solution
instead of asking about your actual problem.

(You can of course use `let' _inside_ `interactive', but it is not
clear what you are trying to do, so I hesitate to guess what
code might help.)



reply via email to

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