Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add org-tree-slide-exit-at-next-last-slide and -before-hook #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ If you feel the cursor moving is very slow, please change a value of =org-tree-s
| 15 | org-tree-slide-breadcrumbs | " > " | String |
| 16 | org-tree-slide-breadcrumbs-hide-todo-state | t | Boolean |
| 17 | org-tree-slide-indicator | plist | [*2] |
| 18 | org-tree-slide-exit-at-next-last-slide | nil | Boolean |

#+begin_quote
[*1] { nil| 'lighter | 'outside }
Expand Down Expand Up @@ -244,6 +245,7 @@ These functions will toggle =org-tree-slide-mode= ON, automatically.
- org-tree-slide-after-narrow-hook
- org-tree-slide-before-move-next-hook
- org-tree-slide-before-move-previous-hook
- org-tree-slide-before-exit-hook

NOTE: For senior user, some hook were renamed, please update your configurations

Expand Down
15 changes: 14 additions & 1 deletion org-tree-slide.el
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ If you want to show anything, just specify nil."
:type 'plist
:group 'org-tree-slide)

(defcustom org-tree-slide-exit-at-next-last-slide nil
"Exit at right next door to the last slide if this value is non-nil.
Otherwise stay in content."
:type 'boolean
:group 'org-tree-slide)

(defvar org-tree-slide-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-x s c") 'org-tree-slide-content)
Expand Down Expand Up @@ -250,6 +256,8 @@ If you want to show anything, just specify nil."
"A hook run before moving to the previous slide.")
(defvar org-tree-slide-before-content-view-hook nil
"A hook run before showing the content.")
(defvar org-tree-slide-before-exit-hook nil
"A hook run before exit from `org-tree-slide-mode'")

;;;###autoload
(define-minor-mode org-tree-slide-mode
Expand Down Expand Up @@ -367,7 +375,12 @@ Profiles:
;; displaying a slide, not the contents
((and (buffer-narrowed-p)
(org-tree-slide--last-tree-p (point)))
(org-tree-slide-content))
(if org-tree-slide-exit-at-next-last-slide
;; exit at right next door to the last slide
(progn
(run-hooks 'org-tree-slide-before-exit-hook)
(org-tree-slide-mode 0))
(org-tree-slide-content)))
((or
(or (and (org-tree-slide--before-first-heading-p)
(not (org-at-heading-p)))
Expand Down