This commit is contained in:
Yann Esposito (Yogsototh) 2020-11-22 23:48:37 +01:00
parent aad630750b
commit ed214bd344
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
3 changed files with 116 additions and 3 deletions

View file

@ -1,3 +0,0 @@
# org-keynote
Org Keynote -- Minimal org-mode presentation tool

32
README.org Normal file
View file

@ -0,0 +1,32 @@
#+Title: org-keynote
#+Author: Yann Esposito
* =org-keynote=
This is the most minimal presentation mode I could write to simulate a
keynote from an org-mode document.
** Configuration
There are two hooks you could take advantage of.
Typical doom-emacs configuration:
#+BEGIN_SRC elisp
(use-package! org-keynote
:config
(add-hook 'org-keynote-mode-hook
(lambda ()
(org-sticky-header-mode -1)
(doom/increase-font-size 3)
(org-display-inline-images)))
(add-hook 'org-keynote-mode-quit-hook
(lambda ()
(org-sticky-header-mode -1)
(doom/reset-font-size)
(org-remove-inline-images)))
(map! :map org-keynote-mode-map
:ni "<right>" #'org-keynote-next
:ni "<left>" #'org-keynote-prev
:ni "q" #'org-keynote-quit'))
#+END_SRC

84
org-keynote.el Normal file
View file

@ -0,0 +1,84 @@
;;; 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