[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiding results using :post

From: Roger Mason
Subject: Re: Hiding results using :post
Date: Tue, 08 Jun 2021 08:08:03 -0230
User-agent: mu4e 1.5.6; emacs 27.2


John Kitchin writes:

> This is doable with a hook and advice I think. The hook will hide the
> results if you use :results hide in the header.
> I had to use the advice to remove the results before hand, so that you
> toggle the visibility off. This is pretty lightly tested. you could
> eliminate
> (defun hide-results (&optional &rest args)
>   (let ((results (cdr (assoc :results (third (org-babel-get-src-block-info
> 'light))))))
>     (when (string-match "hide" results)
>       (org-babel-hide-result-toggle t))))
> (add-hook 'org-babel-after-execute-hook 'hide-results)
> (advice-add 'org-babel-execute-src-block :before (lambda (&rest args)
> (org-babel-remove-result)))
> I guess there are other ways that might work too.
> #+BEGIN_SRC jupyter-python :results hide
> print(5)
> : 5

That works very well.

Many thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]