0

Something like the example below, which I want to test whether you are eligible to enter a number before you actually enter this number

(defun foo (x) (cond (condition (progn (interactive "nEnter your number: ") ...)) (t (message "You cannot enter a number right now!")))) 
1
  • You can pass an expression that evaluates to the list of arguments to interactive. Commented Feb 7, 2019 at 16:31

1 Answer 1

0

You want something like this, as suggested by @DoMiNeLa10.

(defun foo(x) (interactive (list (if condition (read-number "Enter your number: ") (error"You cannot enter a number right now!")))) (message "%s" x)) 
1
  • Perfect, an example is exactly what`s needed for a beginner like me! Thank you! Commented Feb 7, 2019 at 20:58

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.