[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Indirect trace-function results to org-babel current-buffer
From: |
abst.proc.do |
Subject: |
Indirect trace-function results to org-babel current-buffer |
Date: |
Sat, 28 Mar 2020 11:09:13 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Indirect trace-function results to org-babel current-buffer,
abst.proc.do <=