0

My org-mode TODO list looks like this in Emacs:

*Angular
**Two way binding
***{{modelName}}
**Controller
***Do crud operations
***Different scopes across the application

I wanted to present it using org-present, which I enabled by doing M-x org-present. This removed all hierarchy-related asterisks and turned the visible text into a plain list:

Angular
Two way binding
{{modelName}}
Controller
Do crud operations
Different scopes across the application

I am interested in preserving the hierarchy levels for display. How can I do that in org-present-mode (or any other presentation mode for Emacs)?

Additionally, I noticed that org-present-mode doesn't get toggled when I do M-x org-present twice.

  • Is this the package you mean? github.com/rlister/org-present. What do you want to happen when you start org-present mode? – Nathanael Farley Feb 27 '15 at 11:39
  • yes, tat's it. Now, all contents go into 1 slide. org-present can split them into different slides, 1 slide for main line, 1 slide each for sub-topics from level 2. once i enable this mode, key presses are behaving strangely and i couldn't figure out how to even add an extra slide... – Madhavan Feb 27 '15 at 11:57
  • 1
    In the README it says that slides are divided at each level 1 header. So if you want a new slide, you just put a new level 1 header. – Nathanael Farley Feb 27 '15 at 12:01
  • 1
    This is unrelated to your problem, but you should get in the habit of adding a space between the last leading asterisk and the contents of a headline. That way, org-mode will be able to recognize and fontify your headlines properly. – itsjeyd Feb 27 '15 at 12:15
1

You're raising two separate issues.

Keeping asterisks visible

org-present calls org-present-add-overlays, which is responsible for making the leading asterisks invisible. Here is a modified version of org-present-add-overlays that you can add to your init-file to make sure asterisks stay visible:

(defun org-present-add-overlays ()
  "Add overlays for this mode."
  (add-to-invisibility-spec '(org-present))
  (save-excursion
    ;; hide org-mode options starting with #+
    (goto-char (point-min))
    (while (re-search-forward "^[[:space:]]*\\(#\\+\\)\\([^[:space:]]+\\).*" nil t)
      (let ((end (if (org-present-show-option (match-string 2)) 2 0)))
        (org-present-add-overlay (match-beginning 1) (match-end end))))
    ;; hide emphasis markers
    (let ((org-emph-re "\\([ \t('\"{]\\|^\\)\\(\\([/_=~+]\\)\\([^ \t\r\n,\"']\\|[^ \t\r\n,\"'].*?\\(?:\n.*?\\)\\{0,1\\}[^ \t\r\n,\"']\\)\\3\\)\\([- \t.,:!?;'\")}\\]\\|$\\)"))
      (while (re-search-forward org-emph-re nil t)
        (org-present-add-overlay (match-beginning 2) (1+ (match-beginning 2)))
        (org-present-add-overlay (1- (match-end 2)) (match-end 2))))))

org-present won't toggle org-present-mode

As described here, there is a separate command for ending a presentation and going back to "vanilla" org-mode. It is called org-present-quit; the default binding for it is C-c C-q, so just hit that if you want to get out of org-present-mode.

Alternatively, if you want to be able to use the org-present command as a toggle, you can advise it as follows:

(defun org-present-toggle (orig)
  (if (not org-present-mode)
      (funcall orig)
    (org-present-quit)))

(advice-add 'org-present :around #'org-present-toggle)
  • hi itsjeyd, it works well... the regex for org-emph-re is a bit stretchy, which raises the question.. what is considered as the boundaries of an overlay? is this regex org-emph-re meant to split first level headings into different overlays/slides? – Madhavan Feb 27 '15 at 14:25
  • 1
    @MadhavanKumar No, it's not. org-emph-re is used to locate and hide emphasis markup in the buffer: As you probably know, asterisks can be used to make text bold in org-mode. When using an unchanged version of org-emph-re in org-present-add-overlays, it will match asterisks that are actually part of your headlines. So in order to make sure you wouldn't lose any asterisks I modified the original value of org-emph-re to not match asterisks. – itsjeyd Feb 27 '15 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.