From ... From: Erik Naggum Subject: Re: Function called from the Listener or from another function Date: 1997/12/12 Message-ID: <3090936459477164@naggum.no>#1/1 X-Deja-AN: 298397301 References: <349508ee.21987289@news.tu-darmstadt.de> mail-copies-to: never Organization: Naggum Software; +47 8800 8879; http://www.naggum.no Newsgroups: comp.lang.lisp * Hrvoje Niksic | Judging on experience from Emacs, there *is* use in distinguishing | whether a function has been called interactively or noninteractively, | but checking whether it has been evaluated from the listener | definitely sounds like the wrong thing to do. Emacs exports its Lisp call stack. `interactivep' actually walks up the call stack and looks for a call frame with `call-interactively' in it, skipping only a few known call frames on the way. if it finds it, the function is deemed "interactive". if your Lisp has a debugger that can print backtraces, it has a way to locate call frames. if you can also use it, you can do the same job as Emacs' `interactive-p': look for a particular function you expect to mean "interactive" in the backtrace. there are many other ways to distinguish between an interactive call and a normal call, but they generally require changes in the caller. this is most easily solved by writing one's own top-level loop, which is not all that hard. in any case, I miss the ability in Common Lisp to obtain the function object corresponding to the running function. in Emacs, this is (almost) achievable through (backtrace-frame 0). #\Erik -- If you think this year is number 97, | Help fight MULE in GNU Emacs 20! _you_ are not "Year 2000 Compliant". | http://sourcery.naggum.no/emacs/