* Indirect trace-function results to org-babel current-buffer
@ 2020-03-28 3:09 abst.proc.do
0 siblings, 0 replies; only message in thread
From: abst.proc.do @ 2020-03-28 3:09 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-28 3:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-28 3:09 Indirect trace-function results to org-babel current-buffer abst.proc.do
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).