From mboxrd@z Thu Jan 1 00:00:00 1970 From: abst.proc.do@qq.com (abst.proc.do) Subject: Indirect trace-function results to org-babel current-buffer Date: Sat, 28 Mar 2020 11:09:13 +0800 Message-ID: <87d08xch0m.fsf@abst.proc.do> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56935) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jI1tv-0007bN-Cu for emacs-orgmode@gnu.org; Fri, 27 Mar 2020 23:12:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jI1to-0001XK-EM for emacs-orgmode@gnu.org; Fri, 27 Mar 2020 23:12:41 -0400 Received: from out203-205-221-155.mail.qq.com ([203.205.221.155]:40516 helo=qq.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jI1tn-0001CF-D3 for emacs-orgmode@gnu.org; Fri, 27 Mar 2020 23:12:40 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org When tried to apply =trace-function= to a recursive-factorial which print the tracing course to the current buffer: #+BEGIN_SRC elisp (defun factorial(n) (if (= n 1) 1 (* n (factorial (- n 1))))) (trace-function #'factorial (current-buffer)) (factorial 4) #+END_SRC====================================================================== 1 -> (factorial 4) | 2 -> (factorial 3) | | 3 -> (factorial 2) | | | 4 -> (factorial 1) | | | 4 <- factorial: 1 | | 3 <- factorial: 2 | 2 <- factorial: 6 1 <- factorial: 24 It works as expected but report in the echo area the error : : org-babel-insert-result: Wrong type argument: markerp, nil Additionally, the tracing result does not append immediately to the source code but join to its next heading. #+BEGIN_SRC elisp (defun factorial(n) (if (= n 1) 1 (* n (factorial (- n 1))))) (trace-function #'factorial (current-buffer)) (factorial 4) #+END_SRC * Result ====================================================================== 1 -> (factorial 4) | 2 -> (factorial 3) | | 3 -> (factorial 2) | | | 4 -> (factorial 1) | | | 4 <- factorial: 1 | | 3 <- factorial: 2 | 2 <- factorial: 6 1 <- factorial: 24