85 lines
2.4 KiB
EmacsLisp
85 lines
2.4 KiB
EmacsLisp
|
;;; 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-keymap (make-keymap) "The keymap for org-keynote-mode.")
|
||
|
|
||
|
;; left and right page keys
|
||
|
(define-key org-keynote-mode-keymap [right] 'org-keynote-next)
|
||
|
(define-key org-keynote-mode-keymap [left] 'org-keynote-prev)
|
||
|
(define-key org-keynote-mode-keymap (kbd "C-c C-q") 'org-keynote-quit)
|
||
|
|
||
|
(define-minor-mode org-keynote-mode
|
||
|
"Minimalist presentation minor mode for org-mode."
|
||
|
:init-value nil
|
||
|
:lighter " OK"
|
||
|
:keymap org-keynote-mode-keymap)
|
||
|
|
||
|
(make-variable-buffer-local 'org-keynote-mode)
|
||
|
|
||
|
(defun org-keynote-next ()
|
||
|
"Show 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 ()
|
||
|
"Show 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
|