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: Michael Heerdegen
Subject: bug#17446: 24.4.50; What is the situation around `called-interactively-p'?
Date: Sat, 10 May 2014 09:40:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.90 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> 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

Michael.






reply via email to

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