Skip to content

Instantly share code, notes, and snippets.

@jplindstrom
Last active September 6, 2016 16:03
Show Gist options
  • Save jplindstrom/a8b61aa3f9cd1666baf2e80db553bad0 to your computer and use it in GitHub Desktop.
Save jplindstrom/a8b61aa3f9cd1666baf2e80db553bad0 to your computer and use it in GitHub Desktop.
Super simple org-mode slides
;;
;; Super simple org-mode slides
;;
;; Narrow the display to a subtree and navigate between them. Super
;; simple stuff.
;;
;;
;;; Usage:
;;
;; Go to an org file
;;
;; Probably enlarge things with "C-x C-+" a couple of times ("C-x C-0"
;; to reset)
;;
;; Ensure all levels are the way you want them to look when they're
;; displayed (expanded/contracted) during the presentation
;;
;; (The Super modifier "s" is typically the Win key on a PC)
;;
;; (To leave the widened presentation view at any time, press s-q to
;; quit)
;;
;; With point at the top of the presentation, start with s-x to dive
;; into the first sub-level
;;
;; Next slide with s-z
;; Previous slide with s-a
;;
;; If the slide has too many things, use a sub heading and dive into
;; it with s-x. Continue there with next slide s-z, and continue onto
;; the next higher-level slide with s-z
;;
;; Manually go back up to the parent: s-s
;;
;; Toggle between narrowed to the current subtree and widened with s-q
;;
;; That's it!
;;
(defun oss-forward-subtree ()
(interactive)
(widen)
(org-forward-heading-same-level 1)
(org-narrow-to-subtree)
)
(defun oss-backward-subtree ()
(interactive)
(widen)
(org-backward-heading-same-level 1)
(org-narrow-to-subtree)
)
(defun oss-dive-into-subtree ()
(interactive)
(widen)
(forward-line)
(org-narrow-to-subtree)
)
(defun oss-surface-from-subtree ()
(interactive)
(widen)
(outline-up-heading 1)
(org-narrow-to-subtree)
)
(defun oss-surface-from-subtree-forward ()
(interactive)
(widen)
(outline-up-heading 1)
(org-forward-heading-same-level 1)
(org-narrow-to-subtree)
)
(defun oss-mode ()
(interactive)
(if (buffer-narrowed-p)
(widen)
(org-narrow-to-subtree)
)
)
(global-set-key [(super ?z)] 'oss-forward-subtree)
(global-set-key [(super ?a)] 'oss-backward-subtree)
(global-set-key [(super ?x)] 'oss-dive-into-subtree)
(global-set-key [(super ?s)] 'oss-surface-from-subtree)
(global-set-key [(super ?d)] 'oss-surface-from-subtree-forward)
(global-set-key [(super ?q)] 'oss-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment