org-tree-slide
org-tree-slide copied to clipboard
Reducing the clutter
The variable org-tree-slide-skip-comments
only skips the content of the ** COMMENT
entry, but not the headline itself. I think it would make more sense to hide it completely. I was also expecting #
(comment-dwin
) and property drawers to hide, but they didn't.
Using org-babel with large fonts didn't work too well. The screen gets too cluttered. It would be nice to be able to toggle anything that begins with #+
, although maybe not #+caption
and #+tblname
.
Thank you for providing nice comments. I would like to understand your requests in detail.
Comment 1: Hiding tree contains COMMET
In my understanding, the heading with COMMENT will skip when you move slides. But the heading will appear in the children like:
* hoge // 1
** COMMENT hoge // 2
** hoge // 3
** hoge // 4
Your mean line 2
should not be shown. Is this correct?
Comment 2: lines starting with "#" should not be shown when org-tree-slide is active
You mean it should not be shown like HTML export, right?
Comment 3: drawers should not be shown when org-tree-slide is active
You mean it should not be shown like HTML export too, right?
Comment 4: related org-babel
Sorry, I cannot understand the situation. Could you provide some examples?
Best, Takaaki
Thanks for breaking down my requests.
Comment 1: Yes, that's correct. Comment 2: I'm not saying that comments shouldn't be shown, but that the user needs to have the option of whether to include comments. Comment 3: Correct. I don't think drawers add anything useful to the presentation. Comment 4: Consider the following example: Let's say I want to generate a graphic using org-babel and R. A minimum example would look something like this:
* My slide
#+begin_src R :exports results :results output graphics :file example.png
bla bla
#+end_src
#+caption: My example
#+results:
[[file:example.png]]
The problem with the example above is that the code is also shown when org-tree-slide
is active. What I'm proposing is to be able to toggle the code on and off, to produce something like this instead:
* My slide
[[file:example.png]]
Figure: My example
The example above is cleaner. Now, if one needs to edit or show the code during the presentation, s/he could either (1) toggle the code back on with some key-binding, or (2) set the option per entry, like:
* My slide
:PROPERTIES:
:OTS-SHOW-CODE: t
:END:
Or customize the variable: (setq org-tree-slide-show-code t).
Is there a variable that toggles visibility of source-blocks headings when in presentation mode?
I find the #+BEGIN_SRC ... and the #+END_SRC distracting.
Currently, not. You mean when you enter presentation mode, source codes should be displayed without any control commands like BEGIN_SRC?
Exactly,
for instance,
#+BEGIN_SRC ipython :session plt :exports both :file img/plt_2.png
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
[... rest of the code]
#+END_SRC
would be in presentation mode,
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
[... rest of the code]
Any plans on adding this functionality?
Dear nasseralkmim,
I find a simple solution to your request. Please introduce hide-lines
[*1] and add the following configuration. It will hide #+BEGIN_SRC
and #+END_SRC
lines when you enter into presentation mode. And if you quit your presentation, the hidden lines will be shown automatically.
(with-eval-after-load "org-tree-slide"
(when (require 'hide-lines nil t)
(defun my:hide-headers ()
(hide-lines-matching "#\\+BEGIN_SRC")
(hide-lines-matching "#\\+END_SRC"))
(add-hook 'org-tree-slide-play-hook 'my:hide-headers)
(add-hook 'org-tree-slide-stop-hook 'hide-lines-show-all)))
[*1] https://melpa.org/#/hide-lines
I updated the above code. If you use the latest org-mode, background color can be changed by org-src-block-faces
. I think it is more clear to identify the source blocks.
(with-eval-after-load "org-tree-slide"
(when (require 'hide-lines nil t)
(defvar my:org-src-block-faces nil)
(defun my:show-headers ()
(setq org-src-block-faces 'my:org-src-block-faces)
(hide-lines-show-all))
(defun my:hide-headers ()
(setq my:org-src-block-faces 'org-src-block-faces)
(setq org-src-block-faces
'(("emacs-lisp" (:background "cornsilk"))))
(hide-lines-matching "#\\+BEGIN_SRC")
(hide-lines-matching "#\\+END_SRC"))
(add-hook 'org-tree-slide-play-hook 'my:hide-headers)
(add-hook 'org-tree-slide-stop-hook 'my:show-headers)))
I updated it again because content of source block will gone when you edit it by org-edit-src-code (C-c ')
. Two advice functions are introduced to avoid the annoy behavior.
(with-eval-after-load "org-tree-slide"
(when (require 'hide-lines nil t)
(defvar my:org-src-block-faces nil)
(defun my:show-headers ()
(setq org-src-block-faces 'my:org-src-block-faces)
(hide-lines-show-all))
(defun my:hide-headers ()
(setq my:org-src-block-faces 'org-src-block-faces)
(setq org-src-block-faces
'(("emacs-lisp" (:background "cornsilk"))))
(hide-lines-matching "#\\+BEGIN_SRC")
(hide-lines-matching "#\\+END_SRC"))
(add-hook 'org-tree-slide-play-hook 'my:hide-headers)
(add-hook 'org-tree-slide-stop-hook 'my:show-headers)
(defun advice:org-edit-src-code (&optional code edit-buffer-name)
(interactive)
(my:show-headers))
(advice-add 'org-edit-src-code :before #'advice:org-edit-src-code)
(defun advice:org-edit-src-exit ()
(interactive)
(my:hide-headers))
(advice-add 'org-edit-src-exit :after #'advice:org-edit-src-exit)))
I was experiencing the exact behavior you described, now its gone.
Thank you for this package, it's great!
My pleasure. I'll update this package step by step but continuously :-)
A hint to hide :PROPERTIES: in a slide: https://www.reddit.com/r/emacs/comments/9htd0r/how_to_completely_hide_the_properties_drawer_in/
Gentle nudge that these would be great enhancments for this wonderful package.
Thanks so much for your work on this!
This version seems to be working for me, aside baking-in my favoritisim for use-package
this also hides quote, verse and example block wrapping lines.
(use-package hide-lines :ensure t)
(use-package org-tree-slide :ensure t
:config
(when (require 'hide-lines nil t)
(defvar my:org-src-block-faces nil)
(defun my:show-headers ()
(setq org-src-block-faces 'my:org-src-block-faces)
(hide-lines-show-all))
(defun my:hide-headers ()
(setq my:org-src-block-faces 'org-src-block-faces)
(setq org-src-block-faces
'(("emacs-lisp" (:background "cornsilk"))))
(hide-lines-matching "#\\+BEGIN_\\(SRC\\|EXAMPLE\\|VERSE\\|QUOTE\\)")
(hide-lines-matching "#\\+END_\\(SRC\\|EXAMPLE\\|VERSE\\|QUOTE\\)"))
(add-hook 'org-tree-slide-play-hook 'my:hide-headers)
(add-hook 'org-tree-slide-stop-hook 'my:show-headers)
(defun advice:org-edit-src-code (&optional code edit-buffer-name)
(interactive)
(my:show-headers))
(advice-add 'org-edit-src-code :before #'advice:org-edit-src-code)
(defun advice:org-edit-src-exit ()
(interactive)
(my:hide-headers))
(advice-add 'org-edit-src-exit :after #'advice:org-edit-src-exit)))
hide-lines
is a good example for me. Thank you for sharing the information. It basically use overlay
to hide some elements in org. Studying of overlay is my next task :)
Studying of overlay is my next task :)
Thank you so much! :)
As part of preparing for EmacsConf I rolled comments from this thread into an init-script. I'll eagerly be watching for your other ideas.
to #emacsconf
, I said:
I've added an init script to help setup for recording/presentation. This assumes MELPA+use-package and will then add if needed (org-tree-slider org-superstar hide-line) based on fix/work in from tree-slide issue #13:
https://gitlab.com/mplscorwin/dotfiles/-/blob/master/elisp/init-slideshow.el
EDIT to reformat above, and add:
I did a little more work on this. It may be a good source of inspiration or short term approach. It will:
- separate list for source block override face props during
- put the original ones back, still
- wipeout
:box
form slideshow header face (I think caused bydoom-one
) - use header-line to create a top-padding
- set left and right margin and header-line on start/stop show
- vars to control each of these
- still hides the wrapper lines for src, example, verse and quote
See you in EmacsConf :)