Skip to content

Commit

Permalink
Merge pull request #26 from Kazark/toggle-heading-stars
Browse files Browse the repository at this point in the history
Add a toggle for whether to hide stars in headings
  • Loading branch information
rlister authored Aug 6, 2022
2 parents ef1f1c5 + d506a63 commit dfcb71c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions org-present.el
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@
(regexp-opt '("title:" "author:" "date:" "email:"))
string)))

(defvar org-present-hide-stars-in-headings t
"Whether to hide the asterisk characters in headings while in presentation
mode. If you turn this off (by setting it to nil) make sure to set
`org-hide-emphasis-markers' non-nil, since currently `org-present''s algorithm
for hiding emphasis markers has a bad interaction with bullets. This combo also
makes tabs work in presentation mode as in the rest of Org mode.")

(defun org-present-add-overlays ()
"Add overlays for this mode."
(add-to-invisibility-spec '(org-present))
Expand All @@ -176,9 +183,10 @@
(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)
(org-present-add-overlay (match-beginning 1) (match-end 1)))
(if org-present-hide-stars-in-headings
(progn (goto-char (point-min))
(while (re-search-forward "^\\(*+\\)" nil t)
(org-present-add-overlay (match-beginning 1) (match-end 1)))))
;; hide emphasis/verbatim markers if not already hidden by org
(if org-hide-emphasis-markers nil
;; TODO https://github.com/rlister/org-present/issues/12
Expand All @@ -198,14 +206,16 @@

(defun org-present-rm-overlays ()
"Remove overlays for this mode."
(mapc 'delete-overlay org-present-overlays-list)
(mapc #'delete-overlay org-present-overlays-list)
(remove-from-invisibility-spec '(org-present)))

(defun org-present-read-only ()
"Make buffer read-only."
(interactive)
(setq buffer-read-only t)
(define-key org-present-mode-keymap (kbd "SPC") 'org-present-next))
(setq org-present-cursor-cache cursor-type
cursor-type nil)
(define-key org-present-mode-keymap (kbd "SPC") #'org-present-next))

(defun org-present-read-write ()
"Make buffer read-only."
Expand Down

0 comments on commit dfcb71c

Please sign in to comment.