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

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

Re: `call-interactively' and prefix args


From: Nicolas Richard
Subject: Re: `call-interactively' and prefix args
Date: Tue, 03 Jun 2014 14:58:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.91 (gnu/linux)

Thorsten Jolitz <tjolitz@gmail.com> writes:
> So, when I have an (interactive) command cmd1 that calls a
> non-interactive function fun that calls another (interactive "P")
> command cmd2 with `call-interactively' - can I assume that a prefix arg
> (e.g. by C-u) given before calling cmd1 will be transferred to cmd2?

current-prefix-arg is used. If cmd1 changes it, anything can happen.

e.g.

(global-set-key (kbd "<f6>") (lambda () (interactive) (yffoo)))
(defun yffoo () (setq current-prefix-arg '(5)) (call-interactively 'yfbar))
(defun yfbar (&optional arg) (interactive "P") (message "arg is %S" arg))

hitting f6 will show that arg is (5) (which doesn't make sense in an
true interactive call)

-- 
Nico.



reply via email to

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