doomemacs/modules/lang/org/contrib/present.el
Henrik Lissner a0a7c34517
Revert to ox-reveal (remove org-re-reveal)
ox-reveal is maintained again, and org-re-reveal was
exhibiting (wrong-type-argument wholenump -1) errors in some corner
cases.
2020-02-21 14:58:14 -05:00

65 lines
2.3 KiB
EmacsLisp

;;; lang/org/contrib/present.el -*- lexical-binding: t; -*-
;;;###if (featurep! +present)
(defvar +org-present-text-scale 6
"The `text-scale-amount' for `org-tree-slide-mode'.")
(after! ox
(add-to-list 'org-export-backends 'beamer))
;;
;;; Packages
(use-package! ox-reveal
:after ox
:init
;; Fix #1127, where ox-reveal adds an errant entry to
;; `org-structure-template-alist'
(setq org-reveal-note-key-char nil)
:config
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js@3/"
org-reveal-mathjax t))
(use-package! org-tree-slide
:commands org-tree-slide-mode
:config
(org-tree-slide-simple-profile)
(setq org-tree-slide-skip-outline-level 2
org-tree-slide-activate-message " "
org-tree-slide-deactivate-message " "
org-tree-slide-modeline-display nil
org-tree-slide-heading-emphasis t)
(add-hook 'org-tree-slide-mode-after-narrow-hook #'org-display-inline-images)
(add-hook! 'org-tree-slide-mode-hook
#'+org-present-hide-blocks-h
#'+org-present-prettify-slide-h)
(when (featurep! :editor evil)
(map! :map org-tree-slide-mode-map
:n [C-right] #'org-tree-slide-move-next-tree
:n [C-left] #'org-tree-slide-move-previous-tree)
(add-hook 'org-tree-slide-mode-hook #'evil-normalize-keymaps))
(defadvice! +org-present--narrow-to-subtree-a (orig-fn &rest args)
"Narrow to the target subtree when you start the presentation."
:around #'org-tree-slide--display-tree-with-narrow
(cl-letf (((symbol-function #'org-narrow-to-subtree)
(lambda ()
(save-excursion
(save-match-data
(org-with-limited-levels
(narrow-to-region
(progn
(when (org-before-first-heading-p)
(org-next-visible-heading 1))
(ignore-errors (org-up-heading-all 99))
(forward-line 1)
(point))
(progn (org-end-of-subtree t t)
(when (and (org-at-heading-p) (not (eobp)))
(backward-char 1))
(point)))))))))
(apply orig-fn args))))