[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: factor out error message functions, access function stack to know lo
From: |
Emanuel Berg |
Subject: |
Re: factor out error message functions, access function stack to know location |
Date: |
Tue, 27 Oct 2015 02:50:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Emanuel Berg <embe8573@student.uu.se> writes:
> Using `backtrace-frame', this almost worked ...
This excludes the "subr" functions - are they the
C ones?
Probably those are all you need to steer the flow to
the error communicator. And then it should work!
To quote the Captain of Titanic, "Now, nothing can
go wrong!"
(defun backtrace-to-non-subr-frame ()
(let ((i 6) ; offset determined by how *this* function is built
(f) )
(cl-loop while (setq f (cadr (backtrace-frame (incf i)))) do
(when (member (type-of (symbol-function f)) '(cons
compiled-function))
(cl-return f) ))))
(defun function-stack-caller ()
(backtrace-to-non-subr-frame) )
;; (function-stack-caller) ; function-stack-caller
(defun function-stack-embedded-caller ()
(if 'some-error-check (backtrace-to-non-subr-frame) ))
;; (function-stack-embedded-caller) ; function-stack-embedded-caller
--
underground experts united
http://user.it.uu.se/~embe8573