all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to determine the current function?
@ 2003-02-13 23:14 Kevin Rodgers
  2003-02-14 15:45 ` Stefan Monnier <foo@acm.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Rodgers @ 2003-02-13 23:14 UTC (permalink / raw)


I could probably find out how to do this by looking into the implementation of
the Emacs Lisp debuggers (debug.el and edebug.el), but I thought I'd be lazy and
ask the experts here first.

I want to know whether I can distinguish between calls to 2 functions defined
like this:

(defun foo () ...)
(fset 'bar 'foo)

within a piece of advice:

(defadvice foo (after ...)
   ;; How can I determine whether called as foo or as bar?
   ...)

Thanks,
-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to determine the current function?
  2003-02-13 23:14 how to determine the current function? Kevin Rodgers
@ 2003-02-14 15:45 ` Stefan Monnier <foo@acm.com>
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2003-02-14 15:45 UTC (permalink / raw)


>>>>> "Kevin" == Kevin Rodgers <kevin.rodgers@ihs.com> writes:
> I could probably find out how to do this by looking into the
> implementation of the Emacs Lisp debuggers (debug.el and edebug.el), but
> I thought I'd be lazy and ask the experts here first.

It's a function named something like `backtrace'.

> I want to know whether I can distinguish between calls to 2 functions defined
> like this:
> (defun foo () ...)
> (fset 'bar 'foo)
> within a piece of advice:
> (defadvice foo (after ...)
>    ;; How can I determine whether called as foo or as bar?
>    ...)

I recommend you avoid the above-mentioned function and put an advice
around `bar' additionally to an advice around `foo' instead.
The advice around bar could just be

  (defadvice bar (around ...)
    (let ((i-m-in-bar t))
      ad-do-it))


-- Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-14 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-13 23:14 how to determine the current function? Kevin Rodgers
2003-02-14 15:45 ` Stefan Monnier <foo@acm.com>

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.