[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-present 24591087a8 07/47: fix export options bug; show
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/org-present 24591087a8 07/47: fix export options bug; show title page instead of toc |
Date: |
Sat, 8 Jan 2022 13:58:27 -0500 (EST) |
branch: elpa/org-present
commit 24591087a8eff21263b8aac3c650a5d078d8aa20
Author: Richard Lister <rlister+gh@gmail.com>
Commit: Richard Lister <rlister+gh@gmail.com>
fix export options bug; show title page instead of toc
---
org-present.el | 46 ++++++++++++++++++++++++++++++++--------------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/org-present.el b/org-present.el
index a58f01cbbe..6b7d80c87c 100644
--- a/org-present.el
+++ b/org-present.el
@@ -59,6 +59,7 @@
;; how much to scale up font size
(defvar org-present-text-scale 5)
+(defvar org-present-overlays-list nil)
(define-minor-mode org-present-mode
"Minimalist presentation minor mode for org-mode."
@@ -70,7 +71,6 @@
(defun org-present-top ()
"Jump to current top-level heading, should be safe outside a heading."
- (interactive)
(unless (org-at-heading-p) (outline-previous-heading))
(let ((level (org-current-level)))
(when (and level (> level 1))
@@ -79,10 +79,10 @@
(defun org-present-next ()
"Jump to next top-level heading."
(interactive)
+ (widen)
(if (org-current-level)
(progn
(org-present-top)
- (widen)
(org-get-next-sibling))
(outline-next-heading))
(org-present-narrow))
@@ -98,41 +98,58 @@
(org-present-narrow))
(defun org-present-narrow ()
- "Show just current page; in a heading we narrow, else show all headings
folded (initial page)."
- (interactive)
+ "Show just current page; in a heading we narrow, else show title page
(before first heading)."
(if (org-current-level)
(progn
(org-narrow-to-subtree)
(show-all))
- (org-cycle `(4))))
+ ;; else narrow to area before first heading
+ (outline-next-heading)
+ (narrow-to-region (point-min) (point))
+ (goto-char (point-min))))
(defun org-present-big ()
"Make font size larger."
(interactive)
(text-scale-increase 0)
- (text-scale-increase org-present-text-scale))
+ (text-scale-increase org-present-text-scale)) ;MAKE THIS BUFFER-LOCAL
(defun org-present-small ()
"Change font size back to original."
(interactive)
(text-scale-increase 0))
+(defun org-present-add-overlay (beginning end)
+ "Create a single overlay over given region and remember it."
+ (let ((overlay (make-overlay beginning end)))
+ (push overlay org-present-overlays-list)
+ (overlay-put overlay 'invisible 'org-present)))
+
+(defun org-present-show-option (string)
+ "Returns non-nil if string is an org-mode exporter option whose value we
want to show."
+ (save-match-data
+ (string-match
+ (regexp-opt '("title:" "author:" "date:" "email:"))
+ string)))
+
(defun org-present-add-overlays ()
"Add overlays for this mode."
- (interactive)
- (add-to-invisibility-spec 'org-present)
+ (add-to-invisibility-spec '(org-present))
(save-excursion
+ ;; hide org-mode options starting with #+
(goto-char (point-min))
- (while (re-search-forward "^\\(#\\+\\w+:\\)" nil t) ;make org-mode pragmas
invisible
- (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'invisible
'org-present))
+ (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 stars in headings
(goto-char (point-min))
- (while (re-search-forward "^\\(*+\\)" nil t) ;make stars in headers
invisible
- (overlay-put (make-overlay (match-beginning 1) (match-end 1)) 'invisible
'org-present))))
+ (while (re-search-forward "^\\(*+\\)" nil t)
+ (org-present-add-overlay (match-beginning 1) (match-end 1)))))
(defun org-present-rm-overlays ()
"Remove overlays for this mode."
- (interactive)
- (remove-from-invisibility-spec 'org-present))
+ (mapc 'delete-overlay org-present-overlays-list)
+ (remove-from-invisibility-spec '(org-present)))
(defun org-present-read-only ()
"Make buffer read-only."
@@ -154,6 +171,7 @@
(interactive)
(setq org-present-mode t)
(org-present-add-overlays)
+ (org-present-narrow)
(run-hooks 'org-present-mode-hook))
(defun org-present-quit ()
- [nongnu] branch elpa/org-present created (now 7e56ab02b4), ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present aa3db6540a 02/47: readme and code, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 24591087a8 07/47: fix export options bug; show title page instead of toc,
ELPA Syncer <=
- [nongnu] elpa/org-present 69402c3b06 01/47: first commit, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 78d82edf35 05/47: add read-only and read-write modes, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 1f264070dc 03/47: overlays for stars in headers, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 1af324f54f 13/47: hide emphasis markers when presenting, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 8ee4008b83 19/47: detect last slide and go to top of slide before narrow, so we do not, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 1eafeaf19c 17/47: Merge pull request #6 from jaseemabid/master, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 8148e5245e 22/47: mention fullscreen now builtin, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 00679dc2b0 32/47: Merge pull request #19 from damil/master, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present b2e3b19cbc 35/47: Move org-present-narrow to be called after org-present-mode-hooks to make sure images are shown inline in all slides, ELPA Syncer, 2022/01/08
- [nongnu] elpa/org-present 6c57386522 36/47: Fixed that read-only function erase cursor, ELPA Syncer, 2022/01/08