Org Keynote -- Minimal org-mode presentation tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

87 lines
2.3 KiB

;;; org-keynote.el --- Minimal presentation minor mode for org-mode.
;; -*- lexical-binding: t; -*-
;;
;; Copyright (c) Yann Esposito
;;
;; Author: Yann Esposito
;; Package-Requires: ((org "9"))
;; URL: https://gitea.esy.fun/yogsototh/org-keynote
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3 of the
;; License, or any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;
;;; Commentary:
;;
;; This is meant to be an extremely minimalist presentation tool for
;; Emacs org-mode.
;;; Code:
(require 'org)
(defvar org-keynote-mode-map
(let ((mk (make-sparse-keymap)))
(define-key mk [right] 'org-keynote-next)
(define-key mk [left] 'org-keynote-prev)
(define-key mk (kbd "C-c C-q") 'org-keynote-quit)
mk)
"The keymap for `org-keynote'.")
(define-minor-mode org-keynote-mode
"Minimalist presentation minor mode for org-mode."
:init-value nil
:lighter " OK"
:require 'org
:keymap org-keynote-mode-map)
(make-variable-buffer-local 'org-keynote-mode)
(defun org-keynote-next ()
"Jump to next subtree."
(interactive)
(when (buffer-narrowed-p)
(goto-char (point-min))
(widen)
(org-forward-heading-same-level 1))
(org-narrow-to-subtree))
(defun org-keynote-prev ()
"Jump to previous subtree."
(interactive)
(when (buffer-narrowed-p)
(goto-char (point-min))
(widen)
(org-backward-heading-same-level 1))
(org-narrow-to-subtree))
(defun org-keynote ()
"Start the presentation."
(interactive)
(setq org-keynote-mode t)
(run-hooks 'org-keynote-mode-hook)
(org-narrow-to-subtree))
(defun org-keynote-quit ()
"Stop the presentation."
(interactive)
(run-hooks 'org-keynote-mode-quit-hook)
(widen)
(setq org-keynote-mode nil))
(provide 'org-keynote)
;;; org-keynote.el ends here