From 8bb54a95f672591571d7e092cb75570466dbc943 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 1 May 2021 02:57:57 -0400 Subject: [PATCH] Add +org-present-hide-first-heading option Gives the user the option to hide the top-level heading when presenting, and defaults it to nil, since that is org-tree-slide-mode's default behavior. Also reduces the default text-scale for org-tree-slide-mode from 6 -> 5. Fixes #2182 Closes #4907 --- modules/lang/org/contrib/present.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/lang/org/contrib/present.el b/modules/lang/org/contrib/present.el index ef47ba1f6..987f9f6d1 100644 --- a/modules/lang/org/contrib/present.el +++ b/modules/lang/org/contrib/present.el @@ -1,9 +1,17 @@ ;;; lang/org/contrib/present.el -*- lexical-binding: t; -*- ;;;###if (featurep! +present) -(defvar +org-present-text-scale 6 +(defvar +org-present-text-scale 5 "The `text-scale-amount' for `org-tree-slide-mode'.") +(defvar +org-present-hide-first-heading nil + "If non-nil, hide the top-level heading for the current slide. + +Some presenters think the first level heading takes up too much space, or use +them as slide names, rather than titles. Instead, you can use second level +headings as titles, and you have more freedom to place them wherever you like.") + + (after! ox (add-to-list 'org-export-backends 'beamer)) @@ -39,8 +47,8 @@ :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." + (defadvice! +org-present--hide-first-heading-maybe-a (orig-fn &rest args) + "Omit the first heading if `+org-present-hide-first-heading' is non-nil." :around #'org-tree-slide--display-tree-with-narrow (letf! (defun org-narrow-to-subtree () (save-excursion @@ -51,7 +59,8 @@ (when (org-before-first-heading-p) (org-next-visible-heading 1)) (ignore-errors (org-up-heading-all 99)) - (forward-line 1) + (when +org-present-hide-first-heading + (forward-line 1)) (point)) (progn (org-end-of-subtree t t) (when (and (org-at-heading-p) (not (eobp)))