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: Drew Adams
Subject: bug#17446: 24.4.50; What is the situation around `called-interactively-p'?
Date: Fri, 9 May 2014 06:39:06 -0700 (PDT)

> I recently had to use `called-interactively-p-functions' to fix a
> command similar to `repeat-complex-command'.
> I used similar hack than the one found in `repeat-complex-command',
> but as mentionned in `called-interactively-p' this is not working with
> code compiled (I use lexical-binding), thus `dont-compile' have been
> made obsolete.
> 
> So what to do actually to fix such issues ?
> 
> Do you plan to make something better around the terrible
> `called-interactively-p' ?
> 
> What about a special var to force `called-interactively-p' to return
> true when it find this var (Actually this is crashing emacs) ?
> 
> It seems the only reason `dont-compile' have been made obsolete is
> to force people fixing their code to make it working compiled;
> That's ok, but what to do when nothing else is possible ?
> IOW why is this obsolete ?
> 
> Ref: https://github.com/emacs-helm/helm/issues/489

FWIW (I think this is related; apologies if not), this is what
I did:

;; Same as `repeat-complex-command--called-interactively-skip'
;; in `simple.el', but tests for `icicle-repeat-complex-command',
;; not `repeat-complex-command'.
(when (> emacs-major-version 23)

  (defun icicle-repeat-complex-command--called-interactively-skip
         (i _frame1 frame2)
    "If currently `icicle-repeat-complex-command', return 1 to skip over it."
    (and (eq 'eval (cadr frame2))
         (eq 'icicle-repeat-complex-command
             (cadr (backtrace-frame i #'called-interactively-p)))
         1))

  (byte-compile 'icicle-repeat-complex-command))

The reason for the `byte-compile' is that I found that it does
not work when interpreted.  (That seems opposite to what you are
saying (?).  I do not have non-nil `lexical-binding', however.)

I agree that this all seems complicated & fragile.  Dunno what
the solution is.





reply via email to

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