From dfbef2177209e3a045e981b7d2956ec46ce3b25b Mon Sep 17 00:00:00 2001 From: Ola Nilsson Date: Thu, 18 Jul 2024 02:03:05 +0200 Subject: [PATCH] Find the stackframe marker in interpreted-function objects interpreted-function objects (introduced in Emacs 30) are not lists, and were not checked by the inner function tree-find in buttercup--backtrace. Check for buttercup--thunk Oclosures and check the code. --- buttercup.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/buttercup.el b/buttercup.el index 5f0086b..cf6019d 100644 --- a/buttercup.el +++ b/buttercup.el @@ -2131,7 +2131,7 @@ ARGS according to `debugger'." (setq in-program-stack t)) ;; keep frames until one of the known functions are found, after ;; this is just the buttercup framework and not interesting for - ;; users incorrect for testing buttercup. Some frames before the + ;; users (incorrect for testing buttercup). Some frames before the ;; function also have to be discarded (cl-labels ((tree-find (key tree) (cl-block tree-find @@ -2139,10 +2139,16 @@ ARGS according to `debugger'." (let ((elem (pop tree))) (when (or (and (consp elem) (tree-find key elem)) + (and (buttercup--thunk-p elem) + (tree-find key (aref elem 1))) (eql key elem)) (cl-return-from tree-find t)))) (cl-return-from tree-find (and tree (eql tree key)))))) + ;; TODO: Only check the cadr of frame, that is where the function is. + ;; The buttercup--mark-stackframe should only be in wrapped expressions, + ;; optimize by checking if it is a wrapped expression? + ;; Will we even need the marker if we can check that? (when (and in-program-stack (tree-find 'buttercup--mark-stackframe frame)) (pop frame-list) (cl-return frame-list)))))