有没有办法获取当前函数的函数名?

tom*_*tom 6 debugging emacs elisp function

(defun foo ()
    (send-to-debug-log "Error. Function terminated." (get-current-function-name)))
Run Code Online (Sandbox Code Playgroud)

我目前正在这样做:

(defun foo ()
    (send-to-debug-log "Error. Function terminated." 'foo)))
Run Code Online (Sandbox Code Playgroud)

硬编码函数名称似乎不是一个好习惯。有关实施get-current-function-name或的任何建议get-function-name-that-call-me。

Mic*_*nus 5

(defun foo ()
  (send-to-debug-log "Error. Function terminated." (nth 1 (backtrace-frame 2))))
Run Code Online (Sandbox Code Playgroud)