Create screencasts of Emacs sessions from coded scenarios. Write scenario in Emacs Lisp.
This animation:
Was generated by this code:
(require 'gifcast)
(gifcast-animation
hello-world
(set-frame-size (window-frame (get-buffer-window)) 40 10)
(progn
(when (get-buffer "file.txt")
(kill-buffer "file.txt"))
(switch-to-buffer (get-buffer-create "file.txt"))
(delete-other-windows)
(insert (concat
"The greeting is:\n"
"\n"
" Hello ")))
(gifcast-capture)
(gifcast-keys "W")
(gifcast-capture)
(gifcast-keys "o")
(gifcast-capture)
(gifcast-keys "r")
(gifcast-capture)
(gifcast-keys "l")
(gifcast-capture)
(gifcast-keys "d")
(gifcast-capture)
(gifcast-keys "!")
(gifcast-capture)
(gifcast-generate "hello-world.gif")
(kill-buffer "file.txt")
nil)
by running:
$EMACS -q -L . -l example.el -f gifcast-generate-batch-and-exit
-
gifcast-animation name body
A macro to declare animation named NAME. BODY is a list of form. Note that although body looks like a function definition in reality each of the top level forms will be executed asynchronously from a timer. This is done so that Emacs can react to user input and redraw the screen. Only top level forms are executed separately.
-
gifcast-animation-0
Delare animation as disabled so that neither
gifcast-generate-batch
norgifcast-generate-batch-and-exit
executes it. -
gifcast-keys
Add keys to processing queue to simulate user input events. For example
(gifcast-keys "Abc")
simulates a user entering A then b then c.(gifcast-keys (kbd "RET")
simulates a RET. -
gifcast-capture
Capture current Emacs window as next animation frame. Optional parameter DURATION says how much time should this frame last in milisecons, defaults to 100ms.
-
gifcast-generate
Generate final animated GIF and save it to the path given as parameter.
-
gifcast-generate-batch
Function to be called from command line to generate a set of animations. Usage:
$EMACS -q -L . -l example.el -f gifcast-generate-batch
Use full for debugging purposes because Emacs stays open after animations have run. For fully automated animation generation use
gifcast-generate-batch-and-exit
. -
gifcast-generate-batch-and-exit
Function to be called from command line to generate a set of animations. Usage:
$EMACS -q -L . -l example.el -f gifcast-generate-batch-and-exit
- Mac OS X
- Emacs that runs in GUI mode under Mac OS X (Aquamacs, Emacs)
/usr/sbin/screencapture
-- comes with Mac OS Xconvert
from ImageMagic or GraphicsMagick
I love receiving issue reports and pull requests! Use Github for that, official place to coordinate development is:
https://github.com/gracjan/gifcast.el
Have fun, Gracjan