GNU bug report logs - #17446
24.4.50; What is the situation around `called-interactively-p'?

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>

Date: Fri, 9 May 2014 12:31:01 UTC

Severity: wishlist

Found in version 24.4.50

Fixed in version 25.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #71 received at 17446 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17446 <at> debbugs.gnu.org, Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Subject: Re: bug#17446: 24.4.50;
 What is the situation around `called-interactively-p'?
Date: Sat, 10 May 2014 09:40:18 +0200
Stefan Monnier <monnier <at> 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.





This bug report was last modified 8 years and 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.