Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (69 sloc) 2.58 KB
;;; org-presie.el --- simple presentation with an org file
;; Copyright (C) 2012 Nic Ferrier
;; Author: Nic Ferrier <>
;; Maintainer: Nic Ferrier <>
;; Created: 26th August 2012
;; Version: 0.0.5
;; Keywords: hypermedia, outlines
;; Package-Requires: ((framesize "0.0.1")(eimp "1.4.0")(org "7.8.09"))
;; 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
;; (at your option) 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
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <>.
;;; Commentary:
;; This is a very simple tool for running an org-file as a
;; presentation.
;;; Code:
(require 'org)
(require 'eimp)
(require 'cl)
(defun org-pres--eimp-fit ()
"Function used as a hook, fits the image found to the window."
(when (eq major-mode (quote image-mode))
(eimp-fit-image-to-window nil)))
(defun org-pres-next ()
"Next 'slide'."
(if (save-excursion
(let ((bol (beginning-of-line)))
(when bol
(goto-char bol))
(looking-at "^\\*+")))
(call-interactively 'org-cycle)
(let ((next-outline
(re-search-forward "^\\*[^*]" nil 't))))
(when (re-search-forward
"\\[\\[.*\\.\\(jpg\\|gif\\|png\\)" next-outline t)
(other-window -1)))))
(re-search-forward "^\\*+" nil nil)
(define-minor-mode org-pres-mode
"Turn on Org Presentation mode.
Treats a single org file as a list of top level 'slides',
'opening' each one in turn (and closing the previous one).
A postive prefix argument forces this mode on, a negative prefix
argument forces this mode off; otherwise the mode is toggled."
'(([?\x20] . org-pres-next))
(unless (eq major-mode 'org-mode)
(error "only works with org-mode!"))
(visual-line-mode t)
(add-hook 'find-file-hook 'org-pres--eimp-fit))
(provide 'org-presie)
;;; org-presie.el ends here