A presentation mode for emacs. Because emacs.
You know how it is. You're going to give a talk and you want to do some live coding. So of course you want to use your favourite editor1. But you want to have some slides too, and you don't want that awkward moment in the talk where you switch from your presentation software to your editor and lose the flow of your talk. Wouldn't it be great if you could embed your favourite editor2 right into your presentation software? Well that's not going to happen, so you might as well just turn your editor into a presentation program.
[enter stage left el-presenti]
-
Load
el-presenti.el
andel-presenti-edit-mode.el
(load "path/to/el-presenti.el") (load "path/to/el-presenti-edit-mode.el")
-
Optionally associate el-presenti-edit-mode with filenames ending
.presenti
(add-to-list 'auto-mode-alist '("\\.presenti\\'" . el-presenti-edit-mode))
-
Create a presentation file (see example.presenti)
-
Prepare the presentation with 'C-c e p'
-
Once el-presenti has created the slides it will put 'Ready ?' into the minibuffer. Hit return to start the presentation. (This opens a new frame.)
-
Use page-up and page-down (fn + up arrow on a mac) to move through the slides.
-
Stop the presentation with 'C-c C-p'
Most slides in a presentation are just text or images. It turns out that emacs is pretty good at showing both of those. You probably want to style the text by setting fonts and sizes and colours. Again, emacs is pretty good at this.
el-presenti works by letting you specify the content that you want to appear on each slide, rendering that content into a list of buffers, and then providing a binding to advance through the buffers.
A presentation is defined in a single file with a special markup to create each slide. This is the markup to create two simple text slides:
----- slide -----
-- title This is a slide
----- slide -----
-- title This is another slide
-- subtitle With multiple faces
Slides are started with ----- slide -----
and the slide content is
built from everything that follows up to the next slide definition or
the end of the file. The add content to a slide you have to tell
el-presenti what kind of content it is by writing two dashes followed
by the type: for example -- title
. By default el-presenti supports
three types of content -- title
, subtitle
and code
-- but you can
add more if you want. Anything that doesn't start with a double dash
is ignored. So, perhaps confusingly, this will result in a blank screen.
----- slide -----
This slide will be completely blank.
Create the image you want to show in your favourite pretty picture making program, save it in a file and then you can get el-presenti to show it by writing something like:
----- slide:file:my_image_file.png -----
This creates a slide whose sole content is that image, positioned top left on the slide. el-presenti doesn't scale the content so you need to create your image file to exactly match the projector or display you are going to use for the presentation. You also need to leave space for margins which by default are 60px.
There is nothing particularly special about image support. el-presenti just loads the specified file into a buffer and lets emacs display it as normal. This means that you can load any type of content that emacs supports. For example, if you want to show a file containing some code you can write:
----- slide:file:some_code.c -----
When you load a file in this way it will be displayed without a cursor
or modeline. This is great if you just want to display the content,
but the motivation for writing el-presenti was to be able to switch
between static slides and live coding. So if you want load a file and
then edit it as part of the presentation you need to replace file
with edit
so that el-presenti knows to restore the cursor and
modeline. For example, if you decide that you want to edit the file
above you would write:
----- slide:edit:some_code.c -----
You can create empty buffers that show the cursor and modeline. You
specify this by following slide
with blank
and then the mode you
want to use in that buffer. For example, to create an empty buffer for
editing markdown you would type:
----- slide:blank:markdown-mode -----
Just because you are using emacs it doesn't mean your slides should look bad. el-presenti tries to help you create good looking slides by hiding emacs as much as possible, and by giving you control over the faces used to display text content.
The directives like -- title
and -- subtitle
used to create slide
content are really just a wrapper around saying 'add this text using
el-presenti-title-face' and 'el-presenti-subtitle-face'. You can
change the appearance of your slides by changing properties of these
faces. For example, you can use something like:
(set-face-attribute 'el-presenti-title-face nil
:family "Helvetica"
:height 1200
:foreground "#FF0000")
You can also define new kinds of text content by simply defining the
corresponding face. For example, if you want to use -- quote
then
you can use something like:
(defface el-presenti-quote-face
'((t :family "Helvetica" :height 640 :foreground "#0000FF"))
"The face to show quotations"
:group :el-presenti)
Positioning text is more difficult. Text is inserted at point so if you want to change where you position it you need to move the point. You move the point by inserting whitespace. It's awkward and error prone. Sorry.
1: or, failing that, emacs.
2: see above