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

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

bug#17446: 24.4.50; What is the situation around `called-interactively-p


From: Thierry Volpiatto
Subject: bug#17446: 24.4.50; What is the situation around `called-interactively-p'?
Date: Sat, 10 May 2014 10:41:53 +0200
User-agent: mu4e 0.9.9.6pre3; emacs 24.4.50.1

Michael Heerdegen <address@hidden> writes:

> Stefan Monnier <address@hidden> writes:
>
>> BTW, for older Emacsen, you can probably use a hack along the lines of
>> the guaranteed 100% untested code below:
>
> I tried to make it work:
>
>    (defun funcall-interactively (fun &rest args)
>      (setq fun (indirect-function fun))
>      (call-interactively
>        (cond
>         ((consp fun)
>          (mapcar (lambda (x)
>                    (if (eq (car-safe x) 'interactive)
>                        `(interactive ',args) x))
>                  fun))
>         ((byte-code-function-p fun)
>          (apply #'make-byte-code
>                 (aref fun 0)
>                 (aref fun 1)
>                 (aref fun 2)
>                 (aref fun 3)
>                 (aref fun 4)
>                 (aref fun 5)
>                 args)))))
>
> Works at least with the count-words case:
>
>   (funcall-interactively 'count-words nil nil) ==> something useful

Great, works also with `count-words-region'.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






reply via email to

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