Using Emacs as Presentation tool

Jacob su
Jacob su
May 7, 2016 · 3 min read

Emacs is not just an editor, I found some hackers even use it to do presentations. So I collected some ways that emacs can become a presentation tool.

This article is not about…

First, I must make a clearly announcement about what this article is not about. This article is not about how to make a pdf file style presentation using emacs as an editor, and using anther tools like a pdf viewer to play this slides.

This article is about how to using emacs as a presentation style slides player.

epresent.el

Epresent is a simple presentation mode for org-mode.
How to use it?

  • load eprsent.el into emacs
  • open a org file (present.org).
  • M-x epresent-run
  • press “t” to view the top level of presentation
  • navigate the presentation with ’n’, ‘p’, ‘t’ and quit with ‘q’.

Sacha Chua’s source code

Sacha Chua made a presentation for emacs conference 2013. You can get her source code from this org style presentation file. And I extract the mainly part as follows.

;;;;;;;;;;;;;; sacha's code
(defvar sacha/org-show-presentation-file "~/Dropbox/Emacs Conference/public.org" "File containing the presentation.")
(defvar sacha/org-show-slide-tag "slide" "Tag that marks slides.")
(defvar sacha/org-show-slide-tag-regexp (concat ":" (regexp-quote sacha/org-show-slide-tag) ":"))
(require 'eimp)
;; From org-pres--eimp-fit
(defun sacha/org-show-eimp-fit ()
"Function used as a hook, fits the image found to the window."
(when (eq major-mode 'image-mode)
(eimp-fit-image-to-window nil)))
(add-hook 'find-file-hook 'sacha/org-show-eimp-fit)
(defun sacha/org-show-execute-slide ()
"Process slide at point.
If it contains an Emacs Lisp source block, evaluate it.
If it contains an image, view it and switch to that buffer.
Else, focus on that buffer.
Hide all drawers."
(interactive)
(find-file sacha/org-show-presentation-file)
(org-narrow-to-subtree)
(visual-line-mode)
(let ((heading-text (nth 4 (org-heading-components))))
(cond
;; view images
((and (goto-char (point-min))
(re-search-forward "\\[\\[.*\\.\\(jpg\\|gif\\|png\\)" nil t))
(delete-other-windows)
(let ((org-link-frame-setup '((file . find-file))))
(org-open-at-point))
(delete-other-windows)
(goto-char (point-min)))
;; find and execute source code blocks
((and (goto-char (point-min))
(re-search-forward "#\\+begin_src" nil t))
(let ((info (org-babel-get-src-block-info)))
(unwind-protect
(eval (read (concat "(progn " (nth 1 info) ")"))))))
(t
(switch-to-buffer (current-buffer))
(text-scale-set 4)
(org-show-subtree)
(org-cycle-hide-drawers t)
(org-display-inline-images)
(delete-other-windows)))
(set-frame-name heading-text)))
(defun sacha/org-show-next-slide ()
"Show the next slide."
(interactive)
(find-file sacha/org-show-presentation-file)
(widen)
(goto-char (line-end-position))
(when (re-search-forward sacha/org-show-slide-tag-regexp nil t)
(sacha/org-show-execute-slide)))
(defun sacha/org-show-previous-slide ()
"Show the next slide."
(interactive)
(find-file sacha/org-show-presentation-file)
(widen)
(goto-char (line-beginning-position))
(when (re-search-backward sacha/org-show-slide-tag-regexp nil t)
(sacha/org-show-execute-slide)))
(global-set-key '[f5] 'sacha/org-show-previous-slide)
(global-set-key '[f6] 'sacha/org-show-execute-slide)
(global-set-key '[f7] 'sacha/org-show-next-slide)

Improved epresent.el

I studied both epresent.el and Sacha Chua’s presentation for emacsconf-2013. And I made some improvement to epresent.el according to Sacha’s source code. So I fork epresent.el to my github repository and here is the web link:https://github.com/suzp1984/epresent

It make epresent to execute elisp source code according to the property name “EXECUTE”.

Jacob su

Written by

Jacob su

Live Free, Die Well

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade