org-tree-slide icon indicating copy to clipboard operation
org-tree-slide copied to clipboard

Reducing the clutter

Open jagrg opened this issue 10 years ago • 16 comments

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.

jagrg avatar Feb 26 '15 22:02 jagrg

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

takaxp avatar Feb 27 '15 14:02 takaxp

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).

jagrg avatar Feb 27 '15 18:02 jagrg

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.

nasseralkmim avatar Oct 03 '16 01:10 nasseralkmim

Currently, not. You mean when you enter presentation mode, source codes should be displayed without any control commands like BEGIN_SRC?

takaxp avatar Oct 03 '16 01:10 takaxp

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?

nasseralkmim avatar Oct 03 '16 02:10 nasseralkmim

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

takaxp avatar Oct 03 '16 02:10 takaxp

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)))

takaxp avatar Oct 03 '16 03:10 takaxp

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)))

takaxp avatar Oct 03 '16 15:10 takaxp

I was experiencing the exact behavior you described, now its gone.

Thank you for this package, it's great!

nasseralkmim avatar Oct 03 '16 16:10 nasseralkmim

My pleasure. I'll update this package step by step but continuously :-)

takaxp avatar Oct 03 '16 16:10 takaxp

A hint to hide :PROPERTIES: in a slide: https://www.reddit.com/r/emacs/comments/9htd0r/how_to_completely_hide_the_properties_drawer_in/

takaxp avatar Sep 25 '18 14:09 takaxp

Gentle nudge that these would be great enhancments for this wonderful package.

Thanks so much for your work on this!

mplscorwin avatar Nov 14 '20 19:11 mplscorwin

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)))

mplscorwin avatar Nov 14 '20 21:11 mplscorwin

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 :)

takaxp avatar Nov 14 '20 21:11 takaxp

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 by doom-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

mplscorwin avatar Nov 14 '20 23:11 mplscorwin

See you in EmacsConf :)

takaxp avatar Nov 15 '20 02:11 takaxp