The below dummy
foo describes how I need the
prefix variable setting to work.
I'd like the
read-number prompt to show up only if the user entered
C-u as prefix. In all other cases, the prefix will be read as
(interactive "p") would usually do.
(defun foo (prefix) ;; (interactive "p") ?? ;; (interactive (list (read-number "Num: "))) ?? ;; Only if `C-u' prefix is used, show the prompt for user entry ;; else set PREFIX to user entered numeric prefix using ;; the C-0/C-1 or M-0/M-1 style. (message "prefix = %0d" prefix)) ;; Desired outcome ;; C-0 M-x foo => prefix = 0 (no prompt) ;; M-6 M-x foo => prefix = 6 (no prompt) ;; C-u M-x foo => Prompt appears => User enters 7 => prefix = 7