help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can function know its own name?


From: Jean Louis
Subject: Re: How can function know its own name?
Date: Sun, 26 Jun 2022 13:31:42 +0300
User-agent: Mutt/+ () (2022-05-21)

* Philip Kaludercic <philipk@posteo.net> [2022-06-26 12:45]:
> This might do the job: 
> https://emacs.stackexchange.com/questions/2310/can-functions-access-their-name/2312#2312

This way it somehow starts working. Condition is that I have to call
`my-function-name' in the first `let' as otherwise the index would
change.

It is very useful however on my side. I can also get arguments to
function. I will use that for refresh and logging. 

(defun my-function-name ()
  (cadr (backtrace-frame 5)))

(defun my-aware-function ()
  (let ((my-name (my-function-name)))
    my-name))

(my-aware-function) ⇒ my-aware-function


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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