From: Andreas Gerler Date: Tue, 8 Nov 2016 14:36:42 +0000 (+0100) Subject: updated demo-it X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=5a3c295f9cf1ba5aaf85d87211bb6737e84adcfa;p=emacsconfig.git updated demo-it - update to demo-it-20161103.1337 Signed-off-by: Andreas Gerler --- diff --git a/elpa/demo-it-20160116.1941/demo-it-autoloads.el b/elpa/demo-it-20160116.1941/demo-it-autoloads.el deleted file mode 100644 index a2801db7..00000000 --- a/elpa/demo-it-20160116.1941/demo-it-autoloads.el +++ /dev/null @@ -1,25 +0,0 @@ -;;; demo-it-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) - -;;;### (autoloads nil "demo-it" "demo-it.el" (22173 59614 0 0)) -;;; Generated autoloads from demo-it.el - -(autoload 'demo-it-start "demo-it" "\ -Start the current demonstration and kick off the first step. -STEPS is a list of functions to execute. If non-nil, the -optional ADVANCED-MODE turns on keybindings where advances -the steps instead of space. This mode is better for more -interactive demonstrations. - -\(fn STEPS &optional ADVANCED-MODE)" nil nil) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; demo-it-autoloads.el ends here diff --git a/elpa/demo-it-20160116.1941/demo-it-pkg.el b/elpa/demo-it-20160116.1941/demo-it-pkg.el deleted file mode 100644 index 36ca5c8a..00000000 --- a/elpa/demo-it-20160116.1941/demo-it-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "demo-it" "20160116.1941" "Utility functions for creating demonstrations" 'nil :keywords '("demonstration" "presentation")) diff --git a/elpa/demo-it-20160116.1941/demo-it.el b/elpa/demo-it-20160116.1941/demo-it.el deleted file mode 100644 index ebadfe79..00000000 --- a/elpa/demo-it-20160116.1941/demo-it.el +++ /dev/null @@ -1,648 +0,0 @@ -;;; demo-it.el --- Utility functions for creating demonstrations - -;; Copyright (C) 2014 Howard Abrams - -;; Author: Howard Abrams -;; Keywords: demonstration presentation -;; Package-Version: 20160116.1941 - -;; 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 -;; 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 this program. If not, see . - -;;; Commentary: - -;; When making demonstrations of new products, technologies and other -;; geekery, I love the versatility of using Emacs to demonstrate the -;; trifecta of sprint reviews, including: -;; -;; - Presentations explaining the technologies -;; - Source code ... correctly highlighted -;; - Executing the code in Eshell ... or similar demonstration -;; -;; However, I don't want to fat-finger, mentally burp, or even delay -;; the gratification while I type, so I predefine each "step" as an -;; Elisp function, and then have =demo-it= execute each function when I -;; hit the F6 key. -;; -;; Using the library is a three step process: -;; -;; 1. Load the library in your own Elisp source code file -;; 2. Create a collection of functions that "do things". -;; 3. Call the =demo-it-start= function with the ordered list of -;; functions. -;; -;; For instance: -;; -;; (load-library "demo-it") ;; Load this library of functions -;; -;; (defun my-demo/step-1 () -;; (delete-other-windows) -;; (demo/org-presentation "~/presentations/my-demo/demo-start.org")) -;; -;; (defun my-demo/step-2 () -;; (demo-it-load-file "~/Work/my-proj/src/my-proj.py") -;; (demo-it-presentation-return)) -;; -;; (defun my-demo () -;; "My fabulous demonstration." -;; (interactive) -;; (demo-it-start (list -;; 'my-demo/step-1 -;; 'my-demo/step-2 -;; ;; ... -;; ))) -;; -;; (my-demo) ;; Optionally start the demo when file is loaded. -;; -;; Each "step" is a series of Elisp functions that "do things". -;; While this package has a collection of helping functions, the steps -;; can use any Elisp command to show off a feature. -;; -;; I recommend installing these other Emacs packages: -;; -;; - https://github.com/takaxp/org-tree-slide -;; - https://github.com/sabof/org-bullets -;; - https://github.com/magnars/expand-region.el -;; - https://github.com/Bruce-Connor/fancy-narrow -;; -;; See http://github.com/howardabrams/demo-it for more details and -;; better examples. You will want to walk through the source code -;; for all the utility functions. - -;;; Code: - -;; To begin, we need a "global" variable (shudder) that keeps track of -;; the current state of the demonstration. - -(defvar demo-it--step 0 "Stores the current demo 'step' function.") -(defvar demo-it--steps '() "List of functions to be executed in order.") - -;; The following functions come from other projects I like to use -(declare-function fancy-narrow-to-region "ext:fancy-narrow") -(declare-function fancy-narrow-to-defun "ext:fancy-narrow") -(declare-function eshell-send-input "ext:eshell") -(declare-function show-all "ext:eshell.c") -(defvar org-tree-slide-heading-emphasis) -(defvar org-hide-emphasis-markers) - -;; Starting a Demonstration -;; -;; When we start a demonstration, we would pass in a list of functions -;; to call for each step, and then call =demo-step= to execute the -;; first one on the list. -(defvar demo-it-start-winconf nil - "Window configuration when starting demo.") - -;;;###autoload -(defun demo-it-start (steps &optional advanced-mode) - "Start the current demonstration and kick off the first step. -STEPS is a list of functions to execute. If non-nil, the -optional ADVANCED-MODE turns on keybindings where advances -the steps instead of space. This mode is better for more -interactive demonstrations." - (setq demo-it-start-winconf (current-window-configuration)) - (setq demo-it--step 0) ;; Reset the step to the beginning - (setq demo-it--steps steps) ;; Store the steps. - (delete-other-windows) - (if (not advanced-mode) - (demo-it-mode t) ;; Turn on global keymapping mode - (demo-it-mode-adv t)) - (demo-it-step)) - -(defun demo-it-end () - "End the current demonstration by resetting the values inflicted on the presentation buffer as well as closing other windows." - (interactive) - (demo-it-disable-mode) - (demo-it-presentation-return-noadvance) ;; Close other windows - (demo-it-presentation-quit) - (set-window-configuration demo-it-start-winconf)) - -;; Next Step -;; -;; Hitting the key should be bound to triggering the next step in -;; the demonstration. - -(defun demo-it-step (&optional step) - "Execute the next step in the current demonstration. Just to a particular STEP if the optional parameter is given, i.e. C-6 to run the 6th step." - (interactive "P") - (if step - (setq demo-it--step step) ;; Changing Global state, yay! - (setq demo-it--step (1+ demo-it--step))) - (let - ;; At this point, step is 1-based, and I need it 0-based - ;; and f-step is the function to call for this step... - ((f-step (nth (1- demo-it--step) demo-it--steps))) - (if f-step - (funcall f-step) - (read-event "Finished the entire demonstration. Hit any key to return.") - (demo-it-end)))) - -(defun demo-it-restep () - "Execute the previous step in the current demonstration. - -Useful when the previous step failed, and you want to redo it." - (interactive) - (let - ;; At this point, step is 1-based, and I need it 0-based - ;; and f-step is the function to call for this step... - ((f-step (nth (1- demo-it--step) demo-it--steps))) - (if f-step - (funcall f-step) - (message "Finished the entire demonstration.")))) - -;; Position or advance the slide? Depends... - -(defun demo-it-set-mouse-or-advance (evt) - "Advances to the next step if clicked on the right side of any window, otherwise, it position the point as expected. With EVT, function can be bound to the mouse click." - (interactive "e") - (if (posn-area (event-start evt)) ;; Clicked in special area? - (demo-it-step) - (let ((col (car (posn-col-row (event-start evt)))) - (wid (window-width (posn-window (event-start evt))))) - (if (> col (- wid 4)) - (demo-it-step) - (mouse-set-point evt))))) - -(defun demo-it-show-step () - "Display the expected function to be run during the next step." - (interactive) - (let ((func (nth demo-it--step demo-it--steps))) - (message "Step: %d - Going to run: %s" demo-it--step func))) - -(defun demo-it-ignore-event (evt) - "Empty function that absorbs the EVT parameter to keep demonstration from flpping out." - (interactive "P") - (message "")) - - -;; Fancy Region Highlighting -;; -;; While sometimes I want highlight some code, it is usually a -;; function, so instead of remembering two key combinations, let's -;; just have the =C-+= narrow to the region if active, otherwise, -;; narrow to the function: - -(defun demo-it-highlight-section () - "If the region is active, call 'fancy-narrow-to-region on it, otherwise, call 'fancy-narrow-to-defun, and see what happens." - (interactive) - (when (fboundp 'fancy-narrow-to-region) - (if (region-active-p) - (fancy-narrow-to-region (region-beginning) (region-end)) - (fancy-narrow-to-defun)))) - -;; Hiding the Modeline -;; -;; Call the demo-it-hide-mode-line when displaying images and -;; org-mode files displayed as "presentations", so that we aren't -;; bothered by the sight of the mode. - -(defvar demo-it--old-mode-line nil) -(make-variable-buffer-local 'demo-it--old-mode-line) - -(defun demo-it-hide-mode-line () - "Hide mode line for a particular buffer." - (interactive) - (when mode-line-format - (setq demo-it--old-mode-line mode-line-format) - (setq mode-line-format nil))) - -(defun demo-it-show-mode-line () - "Show mode line for a particular buffer, if it was previously hidden with 'demo-it--hide-mode-line." - (interactive) - (if demo-it--old-mode-line - (setq mode-line-format demo-it--old-mode-line))) - -;; Making a Side Window -;; -;; Typically, we make a side window that is large enough to have some -;; fun in, as the main window would serve as little more than an -;; outline. - -(defun demo-it-make-side-window (&optional side) - "Splits the window horizontally and puts point on right side window. SIDE is either 'below or 'side (for the right side)." - (when side - (if (eq side 'below) - (split-window-vertically) - (split-window-horizontally))) - (other-window 1)) - -;; Load a File in the Side Window -;; -;; Splits the window and loads a file on the right side of the screen. - -(defun demo-it-load-file (file &optional side size) - "Splits window and load FILE on the right side of the screen. If SIDE is non-nil, the source code file is place in a window either 'below or to the 'side. The SIZE can be used to scale the text font, which defaults to 1 step larger. This function is called with source code since the mode line is still shown." - (if side - (demo-it-make-side-window side)) - (find-file file) - (if size (text-scale-set size) - (text-scale-set 1))) - -;; Load a File and Fancily Highlight Some Lines -;; -;; Would be nice to load up a file and automatically highlight some -;; lines. - -(defun demo-it-load-fancy-file (file type line1 line2 &optional side size) - "Load FILE and use fancy narrow to highlight part of the buffer. If TYPE is 'char, LINE1 and LINE2 are position in buffer, otherwise LINE1 and LINE2 are start and ending lines to highlight. If SIDE is non-nil, the buffer is placed in a new side window, either 'below or to the 'side, and SIZE is the text scale, which defaults to 1." - (demo-it-load-file file side size) - - ; If fancy-narrow hasn't been installed, this behaves - ; just like demo-it-load-file - (when (fboundp 'fancy-narrow-to-region) - (let ((start line1) - (end line2)) - (unless (eq type 'char) - (goto-char (point-min)) (forward-line (1- line1)) ;; Heh: (goto-line line1) - (setq start (point)) - (goto-char (point-min)) (forward-line line2) - (setq end (point))) - (fancy-narrow-to-region start end)))) - - -;; Display an Image (or other non-textual scaled file) on the Side - -(defun demo-it-show-image (file &optional side) - "Load FILE as image (or any other special file) replacing the current buffer. If SIDE is non-nil, the image is shown in another window, either 'below or to the 'side." - (demo-it-load-file file side) - (fringe-mode '(0 . 0)) - (demo-it-hide-mode-line)) - - -;; Compare and Contrast Files -;; -;; Places two files next to each other so that you can diff -;; or at least visually compare them. I suppose that after -;; they are loaded, you can switch to them with something like: -;; (pop-to-buffer "example.py") -;; To further manipulate them. - -(defun demo-it-compare-files (file1 file2 &optional side size) - "Load FILE1 and FILE2 as either two windows on top of each other on the right side of the screen, or two windows below (depending on the value of SIDE). The SIZE specifies the text scaling of both buffers." - (if (eq side 'below) - (progn - (demo-it-load-file file1 'below size) - (demo-it-load-file file2 'side size)) - (progn - (demo-it-load-file file1 'side size) - (demo-it-load-file file2 'below size)))) - - -;; Start an Eshell and Run Something -;; -;; This function assumes you want an Eshell instance running in the -;; lower half of the window. Changes to a particular directory, and -;; automatically runs something. - -(defun demo-it-start-eshell (&optional directory command name side size) - "Start Eshell instance, and change to DIRECTORY to execute COMMAND. NAME optionally labels the buffer. SIDE can be either 'below or to the 'side, and SIZE specifies the text scale, which defaults to 1 level larger." - (let ((title (if name (concat "Shell: " name) "Shell"))) - (demo-it-make-side-window side) - (eshell "new") - (rename-buffer title) - (if size (text-scale-set size) - (text-scale-set 1)) - - (when directory - (insert (concat "cd " directory)) - (eshell-send-input)) - (erase-buffer) - (eshell-send-input) - - (when command - (insert command) - (eshell-send-input)))) - -(defun demo-it-run-in-eshell (command &optional name) - "Run shell command COMMAND in a previously initialized Eshell. -If NAME is not specified, it defaults to `Shell'." - (let ((title (if name (concat "Shell: " name) "Shell"))) - (pop-to-buffer title) - (insert command) - (eshell-send-input))) - -(defun demo-it-type-in-eshell (command &optional name) - "Run shell command COMMAND in a previously initialized Eshell. -If NAME is not specified, it defaults to `Shell'." - (let ((title (if name (concat "Shell: " name) "Shell"))) - (pop-to-buffer title) - (demo-it-insert-typewriter command) - (eshell-send-input))) - -;; Title Display -;; -;; Create a file to serve as a "title" as it will be displayed with a -;; larger-than-life font. - -(defun demo-it-title-screen (file &optional size) - "Use FILE to serve as a presentation title, as it will be displayed with a larger-than-life font. SIZE specifies the text scale, which defaults to 5x." - (delete-other-windows) - (fringe-mode '(0 . 0)) - - (find-file file) - (show-all) - (demo-it-hide-mode-line) - (setq cursor-type nil) - (if (fboundp 'flyspell-mode) - (flyspell-mode -1)) - (variable-pitch-mode 1) - (if size (text-scale-set size) - (text-scale-set 5)) - - (message "%s" "† This presentation is running within Emacs.")) - -;; Starting an ORG Presentation -;; -;; Since I often have an org-mode file on the side of the screen to -;; demonstrate an outline of what I will be demoing, I made it a -;; function. - -;; Uses org-tree-slide if available. -;; See https://github.com/takaxp/org-tree-slide - -(defvar demo-it--presentation-file "") -(defvar demo-it--presentation-buffer nil) -(defvar demo-it--presentation-prev-settings (make-hash-table)) - -(defun demo-it-presentation (file &optional size) - "Load FILE (org-mode?) as presentation. Start org-tree-slide if available. SIZE specifies the text scale, and defaults to 2 steps larger." - (find-file file) - (setq demo-it--presentation-file file) - (setq demo-it--presentation-buffer (buffer-name)) - - (when (fboundp 'org-tree-slide-mode) - (setq org-tree-slide-heading-emphasis t) - (org-tree-slide-mode)) - - (when (fboundp 'flyspell-mode) - (flyspell-mode -1)) - (setq cursor-type nil) - (variable-pitch-mode 1) - - ;; Make the display of the org-mode file more presentable - (demo-it--presentation-display-set) - - (demo-it-hide-mode-line) - (if size (text-scale-set size) - (text-scale-set 2)) - - (when (fboundp 'org-bullets-mode) - (org-bullets-mode 1))) - - -(defun demo-it--presentation-display-set () - "Change some typical `org-mode' display values to make more presentation-friendly. Store the changed values in a hashtable. See `demo-it--presentation-display-restore'." - (puthash :emphais-markers org-hide-emphasis-markers demo-it--presentation-prev-settings) - (setq org-hide-emphasis-markers t) - - (puthash :table-inherit (face-attribute 'org-table :inherit) - demo-it--presentation-prev-settings) - (puthash :verbatim-inherit (face-attribute 'org-verbatim :inherit) - demo-it--presentation-prev-settings) - (puthash :block-inherit (face-attribute 'org-block-background :inherit) - demo-it--presentation-prev-settings) - (puthash :begin-block-height (face-attribute 'org-block-begin-line :height) - demo-it--presentation-prev-settings) - (puthash :begin-block-foregd (face-attribute 'org-block-begin-line :foreground) - demo-it--presentation-prev-settings) - (puthash :end-block-height (face-attribute 'org-block-end-line :height) - demo-it--presentation-prev-settings) - (puthash :end-block-foregd (face-attribute 'org-block-end-line :foreground) - demo-it--presentation-prev-settings) - - (let ((begin-backgd (face-attribute 'org-block-begin-line :background)) - (end-backgd (face-attribute 'org-block-end-line :background))) - (set-face-attribute 'org-table nil :inherit 'fixed-pitch) - (set-face-attribute 'org-verbatim nil :inherit 'fixed-pitch) - (set-face-attribute 'org-block-background nil :inherit 'fixed-pitch) - (set-face-attribute 'org-block-begin-line nil :height 1 :foreground begin-backgd) - (set-face-attribute 'org-block-end-line nil :height 1 :foreground end-backgd))) - -(defun demo-it--presentation-display-restore () - "After `demo-it--presentation-display-set', call to restore previous settings." - (setq org-hide-emphasis-markers - (gethash :emphais-markers demo-it--presentation-prev-settings)) - - (set-face-attribute 'org-table nil :inherit - (gethash :table-inherit demo-it--presentation-prev-settings)) - (set-face-attribute 'org-verbatim nil :inherit - (gethash :table-verbatim demo-it--presentation-prev-settings)) - (set-face-attribute 'org-block-background nil :inherit - (gethash :block-inherit demo-it--presentation-prev-settings)) - (set-face-attribute 'org-block-begin-line nil - :height (gethash :begin-block-height demo-it--presentation-prev-settings) - :foreground (gethash :begin-block-foregd demo-it--presentation-prev-settings)) - (set-face-attribute 'org-block-end-line nil - :height (gethash :end-block-height demo-it--presentation-prev-settings) - :foreground (gethash :end-block-foregd demo-it--presentation-prev-settings))) - -;; Jumping Back to the Presentation -;; -;; In this case, we've been doing some steps, and the screen is -;; "messed up", calling this function returns back to the -;; presentation. - -(defun demo-it-presentation-return-noadvance () - "Return to the presentation buffer and delete other windows." - (when demo-it--presentation-buffer - (switch-to-buffer demo-it--presentation-buffer)) - (delete-other-windows)) - -(defun demo-it-presentation-return () - "Return to the presentation buffer, delete other windows, and advance to the next 'org-mode' section." - (when demo-it--presentation-buffer - (demo-it-presentation-return-noadvance) - (when (fboundp 'org-tree-slide-move-next-tree) - (org-tree-slide-move-next-tree)))) - -(defun demo-it-single-presentation (file) - "Demonstration that presents on `org-mode' FILE as a full-screen presentation." - (interactive "fPresentation File: ") - (cl-flet ((present-it () - (demo-it-frame-fullscreen) - (delete-other-windows) - (demo-it-presentation file))) - (demo-it-start (list #'present-it) t))) - -;; Advance Presentation without Changing Focus -;; -;; Advances the org-mode presentation, but after popping into that -;; presentation buffer, returns to the window where our focus was -;; initially. - -(defun demo-it-presentation-advance () - "Advance the presentation to the next frame (if the buffer is an 'org-mode' and 'org-tree-slide' is available), but doesn't change focus or other windows. Only useful if using the org-tree-slide mode for the presentation buffer." - (interactive) - (when demo-it--presentation-buffer - (let ((orig-window (current-buffer))) - (switch-to-buffer demo-it--presentation-buffer) - (when (fboundp 'org-tree-slide-move-next-tree) - (org-tree-slide-move-next-tree)) - (switch-to-buffer orig-window)))) - -;; Clean up the Presentation -;; -;; The org-presentation-start function alters the way an org-mode file -;; is displayed. This function returns it back to a normal, editable -;; state. - -(defun demo-it-presentation-quit () - "Undo display settings made to the presentation buffer." - (when demo-it--presentation-buffer - (switch-to-buffer demo-it--presentation-buffer) - (when (fboundp 'org-tree-slide-mode) - (org-tree-slide-mode -1)) - (when (fboundp 'flyspell-mode) - (flyspell-mode t)) - (setq cursor-type t) - (demo-it--presentation-display-restore) ; Restore previous changes - (variable-pitch-mode nil) - (demo-it-show-mode-line) - (text-scale-set 0))) - -;; Switch Framesize -;; -;; During a demonstration, it might be nice to toggle between -;; full screen and "regular window" in a programmatic way: - -(defun demo-it-toggle-fullscreen () - "Toggle the frame between full screen and normal size." - (interactive) - (set-frame-parameter - nil 'fullscreen - (when (not (frame-parameter nil 'fullscreen)) 'fullboth))) - -;; We can force the window to be full screen: - -(defun demo-it-frame-fullscreen () - "Set the frame window to cover the full screen." - (interactive) - (set-frame-parameter nil 'fullscreen 'fullboth)) - -;; Let's make a right-side frame window: - -(defun demo-it-frame-leftside () - "Set the window frame to be exactly half the physical display screen, and place it on the left side of the screen. This can be helpful when showing off some other application." - (interactive) - (let* ((full-pixels (- (x-display-pixel-width) 16)) - (full-width (/ full-pixels (frame-char-width))) - (dest-width (/ full-width 2))) - (set-frame-parameter nil 'fullscreen nil) - (set-frame-parameter nil 'width dest-width) - (set-frame-parameter nil 'left 0))) - -;; Helper Functions - -(defvar demo-it-text-entries (make-hash-table) - "Collection of insertable text and keys for `demo-it-insert-text'. -Strings to insert Assign a collection of characters as keys and -strings, and call the `C-c i` to insert the text string as if you -were typing it. - -For instance: - (setq demo-it-text-entries #s(hash-table data - (?1 \"How about that?\" - ?2 \"Nah, this really ain't it.\")))") - -(defun demo-it-insert-text (key) - "Insert text into the current buffer based on a single character KEY. - -The text is inserted as if you were typing it. Make sure the -`demo-it-text-entries' hash-table has been initialized with a -character to be used as a key, and the text to insert." - (interactive "cInsert text from which key?") - (demo-it-insert-typewriter (gethash key demo-it-text-entries))) - -(defun demo-it-insert-typewriter (str) - "Insert STR into the current buffer as if you were typing it by hand." - (interactive "s") - (dolist (ch (string-to-list str)) - (insert ch) - (sit-for (/ 1.0 (+ 10 (random 100))) nil))) - - -(defun demo-it-message-keybinding (key command) - "Display message showing the KEY keybinding and its COMMAND." - (interactive) - (message "Typed: '%s' Command: '%s'" key command)) - -;; Demo Mode -;; -;; Allows us to advance to the next step by pressing the -;; space bar or return. Press the 'q' key to stop the mode. - -(defun demo-it-disable-mode () - "Called when 'q' pressed to disable the 'demo-it-mode'." - (interactive) - (demo-it-mode -1) - (demo-it-mode-adv -1)) - -(define-minor-mode demo-it-mode "Pressing 'space' advances demo." - :lighter " demo" - :require 'demo-it - :global t - :keymap '((" " . demo-it-step) - (" " . demo-it-step) - ("[down]" . demo-it-step) - ("[mouse-1]" . demo-it-set-mouse-or-advance) - ([nil mouse-1] . demo-it-step) - ([nil wheel-up] . demo-it-ignore-event) - ([nil wheel-down] . demo-it-ignore-event) - ([nil wheel-left] . demo-it-ignore-event) - ([nil wheel-right] . demo-it-ignore-event) - ("q" . demo-it-disable-mode) - ("Q" . demo-it-end))) - -(define-minor-mode demo-it-mode-adv "Pressing '' advances demo." - :lighter " demo-adv" - :require 'demo-it - :global t - :keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "") 'demo-it-step) - (define-key map (kbd "s-") 'demo-it-insert-text) - (define-key map (kbd "A-") 'demo-it-insert-text) - (define-key map (kbd "M-") 'demo-it-end) - map)) - -;; New Keybindings -;; -;; I have found the following keybindings quite useful, but your mileage may vary. - -(defun demo-it-keybindings () - "Add a few global keybindings if some other packages are installed. -You probably want to look at the source, and create -your own version of this, but it does the following: - -- C-= Selects or increases the region using expand-region -- M-C-= Highlights the region (dimming the rest) using fancy-narrow -- M-C-+ Unhighlights buffer (by colorizing entire buffer) using fancy-narrow - -This function should never had been written, as it is better to -just add your own keybindings to the demo-it-mode instead, as in: - - (define-key demo-it-mode-map (kbd \"C-\") 'demo-it-presentation-advance)" - (declare (obsolete "Add keybinds to demo-it-mode directly." "Dec 2015")) - (interactive) - - (when (fboundp 'er/expand-region) - (global-set-key (kbd "C-=") 'er/expand-region)) - (when (fboundp 'fancy-widen) - (global-set-key (kbd "M-C-=") 'highlight-section) - (global-set-key (kbd "M-C-+") 'fancy-widen))) - -;; As a final harrah, we need to let other files know how to include -;; this bad child. - -(provide 'demo-it) - -;;; demo-it.el ends here diff --git a/elpa/demo-it-20161103.1337/demo-it-autoloads.el b/elpa/demo-it-20161103.1337/demo-it-autoloads.el new file mode 100644 index 00000000..d192a655 --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it-autoloads.el @@ -0,0 +1,51 @@ +;;; demo-it-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +;;;### (autoloads nil "demo-it" "demo-it.el" (22560 30366 0 0)) +;;; Generated autoloads from demo-it.el + +(autoload 'demo-it-start "demo-it" "\ +Start the current demonstration and kick off the first step. +STEPS is a list of functions or keystrokes to execute. +If nil, the STEPS must be specified by a call to `demo-it-create'. + +The optional ADVANCED-MODE turns on keybindings where +advances the steps instead of Space. This mode is better for +more interactive demonstrations. + +\(fn &optional STEPS ADVANCED-MODE)" t nil) + +(autoload 'demo-it-create "demo-it" "\ +Create and store an ordered list of steps and configuration +values. The FORMS can be either function names, expressions or +keywords, like `:advanced-mode' and `:variable-width'. + +\(fn &rest FORMS)" nil t) + +;;;*** + +;;;### (autoloads nil "demo-it-present" "demo-it-present.el" (22560 +;;;;;; 30366 0 0)) +;;; Generated autoloads from demo-it-present.el + +(autoload 'demo-it-single-presentation "demo-it-present" "\ +Demonstration that presents an `org-mode' FILE as a +full-screen presentation. SIZE is the text scaling size, and STYLE is the presentation + +\(fn FILE &optional SIZE STYLE SECTION)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("demo-it-custom.el" "demo-it-extras.el" +;;;;;; "demo-it-pkg.el") (22560 30366 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; demo-it-autoloads.el ends here diff --git a/elpa/demo-it-20161103.1337/demo-it-custom.el b/elpa/demo-it-20161103.1337/demo-it-custom.el new file mode 100644 index 00000000..3acc7bbb --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it-custom.el @@ -0,0 +1,224 @@ +;;; DEMO-IT-CUSTOM --- The project's custom variables +;; +;; Author: Howard Abrams +;; Copyright © 2016, Howard Abrams, all rights reserved. +;; Created: 19 September 2016 +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Two ways to set default properties and demonstration settings. +;; First, by setting the value on customized values, and +;; Second, by passing in a mnemonic value with `demo-it-create', +;; See the `demo-it--set-property' for the mapping. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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 +;; 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 this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(defgroup demo-it nil + "Customizations and behaviors for demonstrations." + :prefix "demo-it-" + :group 'applications + :link '(url-link :tag "Github" "https://github.com/howardabrams/demo-it")) + +(defcustom demo-it--keymap-mode-style :simple-mode + "The keymap-specific minor mode to use when a demonstration +starts. Should either be :simple-mode for using the space to +advance to next step and `q' to exit the demonstration, +or :advanced-mode, where advances." + :type '(choice (const :tag "simple" :simple-mode) + (const :tag "advanced" :advanced-mode)) + :group 'demo-it) + +(defcustom demo-it--shell-or-eshell :eshell + "When opening up a shell, should this run the `shell' or `eshell' command." + :type '(choice (const :tag "shell" :shell) + (const :tag "eshell" :eshell)) + :group 'demo-it) + +(defcustom demo-it--open-windows :right + "When opening side windows, split the frame on a particular +side, like `:below' or on the `:right'." + :type '(choice (const :tag "above" :above) + (const :tag "below" :below) + (const :tag "left" :left) + (const :tag "right" :right)) + :group 'demo-it) + +(defcustom demo-it--open-windows-size 80 + "The size of the window to open. This is the width if the + window is opened on one of the sides (:left or :right), or the + height if the window is opened :above or :below." + :type '(integer)) + +(defcustom demo-it--text-scale 2 + "Sets the default text scale when opening files." + :type '(choice integer + (const :tag "small" -1) + (const :tag "normal" 0) + (const :tag "medium" 1) + (const :tag "large" 2) + (const :tag "x-large" 3) + (const :tag "xx-large" 4) + (const :tag "huge" 5)) + :group 'demo-it) + +(defcustom demo-it--start-fullscreen nil + "If non-nil, start the demonstration with the frame in fullscreen mode." + :type '(boolean) + :group 'demo-it) + +(defcustom demo-it--start-single-window t + "If non-nil, delete other windows to start the demonstration with a single buffer window." + :type '(boolean) + :group 'demo-it) + +(defcustom demo-it--presentation-hide-mode-line t + "If non-nil, shows the mode-line during a presentation, +otherwise the mode-line is hidden from view." + :type '(boolean)) + +(defcustom demo-it--presentation-hide-org-markers t + "If non-nil, shows the surrounding asterisks, underlines and +slashes that define an `org-mode' textual formats, otherwise +these characters hidden, even though the effects of bolding and +italics are shown." + :type '(boolean)) + +(defcustom demo-it--presentation-variable-width nil + "If non-nil, uses a variable-width font for `org-mode' presentation files, +otherwise the continues to use the standard fixed-width font." + :type '(boolean)) + +(defcustom demo-it--presentation-hide-org-blocks t + "If non-nil, shows the `#+BEGIN_SRC' and `#+END_SRC' code +blocks in an `org-mode' presentation file, otherwise these lines +are hidden, but the contents within the blocks are still shown." + :type '(boolean)) + +(defun demo-it--presentation-variable-width-p (&optional style) + "Predicate return `t' if STYLE is either `:variable' or `:both' +or the customization setting, +`demo-it--presentation-variable-width' is true. Otherwise, STYLE +can be `:fixed'." + (if (eq style :fixed) + nil + (when (or (eq style :variable) + (eq style :both) + demo-it--presentation-variable-width) + t))) + +(defun demo-it--presentation-hide-blocks-p (&optional style) + "Predicate return `t' if STYLE is either `:block' or `:both' +or the customization setting, `demo-it--presentation-hide-org-blocks' +is non-nil." + (when (or (eq style :block) (eq style :blocks) + (eq style :both) + demo-it--presentation-hide-org-blocks) + t)) + +(defcustom demo-it--insert-text-speed :medium + "The speed at which some functions insert text into the shell +and other place. This can be :instant for instantaneous, +or :slow, :medium or :fast. + +This can also be a tuple of two integer values for the random +number of milliseconds between inserting each character." + :type '(choice (const :tag "fast" :fast) + (const :tag "medium" :medium) + (const :tag "slow" :slow) + (const :tag "instant" :instant)) + :group 'demo-it) + +(defun demo-it--get-insert-text-speed (&optional speed) + "The tuple of the lower and upper limits for the insert speed +based on the symbol stored in `demo-it--insert-text-speed'. +The optional value for SPEED override the default value." + (let ((requested-speed (or speed demo-it--insert-text-speed))) + (pcase requested-speed + ((or :fast :insert-fast) '(10 . 100)) + ((or :medium :insert-medium) '(30 . 500)) + ((or :slow :insert-slow) '(200 . 1000)) + (_ requested-speed)))) + +(defun demo-it--get-text-scale (&optional size) + "Returns SIZE if SIZE is an integer, otherwise, returns an +integer matching the symbol specified by SIZE, e.g. `:large'." + (let ((requested-size (or size demo-it--text-scale))) + (pcase requested-size + ((or :small :text-small) -1) + ((or :normal :text-normal) 0) + ((or :medium :text-medium) 1) + ((or :large :text-large) 2) + ((or :x-large :text-x-large) 3) + ((or :xx-large :text-xx-large) 4) + ((or :huge :text-huge) 5) + (_ requested-size)))) + +(defun demo-it--set-property (prop) + "Sets a particular property, specified by keyword, PROP to t." + (pcase prop + (:simple-mode (setq demo-it--keymap-mode-style :simple-mode)) + (:advance-mode (setq demo-it--keymap-mode-style :advanced-mode)) + (:advanced-mode (setq demo-it--keymap-mode-style :advanced-mode)) + + (:use-eshell (setq demo-it--shell-or-eshell :eshell)) + (:use-shell (setq demo-it--shell-or-eshell :shell)) + (:eshell (setq demo-it--shell-or-eshell :eshell)) + (:shell (setq demo-it--shell-or-eshell :shell)) + + (:windows-on-side (setq demo-it--open-windows :right)) + (:windows-on-right (setq demo-it--open-windows :right)) + (:windows-on-left (setq demo-it--open-windows :left)) + (:windows-below (setq demo-it--open-windows :below)) + (:windows-above (setq demo-it--open-windows :above)) + + (:fullscreen (setq demo-it--start-fullscreen t)) + (:full-screen (setq demo-it--start-fullscreen t)) + (:single-window (setq demo-it--start-single-window t)) + + (:text-small (setq demo-it--text-scale -1)) + (:text-normal (setq demo-it--text-scale 0)) + (:text-medium (setq demo-it--text-scale 1)) + (:text-large (setq demo-it--text-scale 2)) + (:text-x-large (setq demo-it--text-scale 3)) + (:text-xx-large (setq demo-it--text-scale 4)) + (:text-huge (setq demo-it--text-scale 5)) + + (:insert-quickly (setq demo-it--insert-text-speed :instant)) + (:insert-fast (setq demo-it--insert-text-speed :fast)) + (:insert-medium (setq demo-it--insert-text-speed :medium)) + (:insert-slow (setq demo-it--insert-text-speed :slow)) + + (:show-mode-line (setq demo-it--presentation-hide-mode-line nil)) + (:hide-mode-line (setq demo-it--presentation-hide-mode-line t)) + (:show-org-markers (setq demo-it--presentation-hide-org-markers nil)) + (:hide-org-markers (setq demo-it--presentation-hide-org-markers t)) + (:variable-width (setq demo-it--presentation-variable-width t)) + (:fixed-width (setq demo-it--presentation-variable-width nil)) + (:show-block-headers (setq demo-it--presentation-hide-org-blocks nil)) + (:hide-block-headers (setq demo-it--presentation-hide-org-blocks t)))) + +(provide 'demo-it-custom) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; demo-it-custom.el ends here diff --git a/elpa/demo-it-20161103.1337/demo-it-extras.el b/elpa/demo-it-20161103.1337/demo-it-extras.el new file mode 100644 index 00000000..9034ca3d --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it-extras.el @@ -0,0 +1,115 @@ +;;; DEMO-IT-EXTRAS --- Demo Functions that depend on other packages +;; +;; Author: Howard Abrams +;; Copyright © 2016, Howard Abrams, all rights reserved. +;; Created: 23 September 2016 +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; A collection of functions that depend on other packages available +;; from MELPA. While the functions check to see if the package is +;; available and loaded, it does not actually do the loading (or the +;; installing of the package). +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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 +;; 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 this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(require 'cl) + +(declare-function demo-it--get-section "demo-it") +(declare-function demo-it-load-file "demo-it") + +(declare-function fancy-narrow-to-region "ext:fancy-narrow") +(declare-function fancy-narrow-to-defun "ext:fancy-narrow") + +;; ---------------------------------------------------------------------- +;; FANCY HIGHLIGHTING +;; +;; A function useful for interactive work or as part of a +;; demonstration script, can use the tres cool highlighting feature +;; of `fancy-narrow' (see https://github.com/Malabarba/fancy-narrow) + +(defun demo-it-highlight-dwim (&optional type-or-fn start end) + "Highlights or narrows to a particular 'section'. + +If TYPE-OR-FN is a string, it specifies the name of a function to +highlight. If it is a :line, then START and END specifies the +beginning or ending lines. If TYPE-OR-FN is :char, then START and +END are buffer positions. + +If TYPE-OR-FN is `nil' and region is active, use, the region, +otherwise, select the function the point is currently in. + +If the `fancy-narrow' package is installed, we'll call +`fancy-narrow-to-region' or `fancy-narrow-to-defun', otherwise, +we narrow to it." + (interactive) + + (cl-flet ((hi-defun () ;; Highlight the current function + (if (fboundp 'fancy-narrow-to-defun) + (fancy-narrow-to-defun) + (narrow-to-defun))) + + (hi-region (start end) + (if (fboundp 'fancy-narrow-to-region) + (fancy-narrow-to-region start end) + (narrow-to-region start end)) + (if (region-active-p) + (deactivate-mark)))) + (cond + ;; Type is null, we assume we are interactive: + ((null type-or-fn) (if (region-active-p) + (hi-region (region-beginning) (region-end)) + (hi-defun))) + + ;; With a specified type, we aren't interactive, and if we got a + ;; symbol, then we can use `demo-it--get-section' for our bounds. + ((symbolp type-or-fn) + (let ((positions (demo-it--get-section type-or-fn start end))) + (hi-region (car positions) (cdr positions)))) + + ;; With string, use `imenu' for matching: + ((stringp type-or-fn) (imenu type-or-fn) + (hi-defun))))) + + +(defun demo-it-load-fancy-file (file type &optional start end side size) + "Splits window and loads FILE in another window, and use fancy +narrow to highlight part of the buffer. + +If TYPE is a string that specifies a function name (available via +the `imenu' call), then it highlights that function. + +If TYPE is :char or 'char, START and END refers to specific +character positions, but if TYPE is :line or 'line, this selects +the point positions as if START and END are line numbers. + +If `fancy-narrow' is not installed, then simply narrows to the area." + (demo-it-load-file file side size) + (demo-it-highlight-dwim type start end)) + + +(provide 'demo-it-extras) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; demo-it-extras.el ends here diff --git a/elpa/demo-it-20161103.1337/demo-it-pkg.el b/elpa/demo-it-20161103.1337/demo-it-pkg.el new file mode 100644 index 00000000..0f50b055 --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it-pkg.el @@ -0,0 +1,4 @@ +(define-package "demo-it" "20161103.1337" "No description available." 'nil) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/demo-it-20161103.1337/demo-it-present.el b/elpa/demo-it-20161103.1337/demo-it-present.el new file mode 100644 index 00000000..79e2a95c --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it-present.el @@ -0,0 +1,288 @@ +;;; DEMO-IT-PRESENT --- Summary +;; +;; Author: Howard Abrams +;; Copyright © 2016, Howard Abrams, all rights reserved. +;; Created: 23 September 2016 +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; Since I often have an org-mode file on the side of the screen to +;; demonstrate an outline of what I will be demoing, I made it a +;; function. +;; +;; The file contains functions for displaying an org-mode file as a +;; presentation using the `org-tree-slide' project (see +;; https://github.com/takaxp/org-tree-slide). +;; +;; If `org-tree-slide' is not available, it simply shows the +;; org-mode file. We really need to look at a way to make the +;; display configurable. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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 +;; 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 this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Code: + +(require 'cl) + +(declare-function org-tree-slide-content "ext:org-tree-slide") +(declare-function org-tree-slide-move-next-tree "ext:org-tree-slide") +(declare-function face-remap-add-relative "face-remap.el") +(declare-function face-remap-remove-relative "face-remap.el") + +(defvar org-image-actual-width) +(defvar org-tree-slide-heading-emphasis) +(defvar org-hide-emphasis-markers) + +(defvar demo-it--text-scale) +(defvar demo-it--presentation-hide-mode-line) +(defvar demo-it--presentation-hide-org-markers) +(defvar demo-it--presentation-variable-width) +(defvar demo-it--presentation-hide-org-blocks) + +(declare-function demo-it--get-text-scale "demo-it-custom.el") +(declare-function demo-it--presentation-variable-width-p "demo-it-custom.el") +(declare-function demo-it--presentation-hide-blocks-p "demo-it-custom.el") +(declare-function demo-it-hide-mode-line "demo-it.el") +(declare-function demo-it-show-mode-line "demo-it.el") +(declare-function demo-it-disable-mode "demo-it.el") + +(declare-function demo-it-create "demo-it.el") +(declare-function demo-it-start "demo-it.el") +(declare-function demo-it--setq-restore "demo-it.el") + +;; ---------------------------------------------------------------------- + +(defvar demo-it--presentation-file "") +(defvar demo-it--presentation-buffer nil) +(defvar demo-it--presentation-prev-settings (make-hash-table)) + + +(defun demo-it-presentation (file &optional size style section) + "Load FILE (org-mode?) as presentation. Start `org-tree-slide' +if available. SIZE specifies the text scale, and defaults to the +value set in `demo-it--text-scale'. + + STYLE can either be `:variable' for variable font pitch, +`:blocks' for diminished headers on org-blocks, or `:both' for +both features. If nil, defaults to the customize variables, +`demo-it--presentation-variable-width' and +`demo-it--presentation-hide-org-blocks'. + +The SECTION is the name of an org-mode header to specify as the +first section to display." + (find-file file) + (setq demo-it--presentation-file file) + (setq demo-it--presentation-buffer (buffer-name)) + + (when (fboundp 'org-tree-slide-mode) + (setq org-tree-slide-heading-emphasis t) + (org-tree-slide-mode)) + + (when section + (demo-it--presentation-section section)) + + ;; Style things up correctly... + (make-local-variable 'demo-it--presentation-prev-settings) + (puthash :emphasis-markers org-hide-emphasis-markers demo-it--presentation-prev-settings) + (setq org-hide-emphasis-markers demo-it--presentation-hide-org-markers) + + ;; Make the display of the org-mode file more presentable + (when (demo-it--presentation-hide-blocks-p style) + (demo-it--presentation-display-set)) + (when (demo-it--presentation-variable-width-p style) + (variable-pitch-mode 1)) + (when demo-it--presentation-hide-mode-line + (demo-it-hide-mode-line)) + (text-scale-set (demo-it--get-text-scale size)) + + (when (fboundp 'org-bullets-mode) + (org-bullets-mode 1)) + (when (fboundp 'flyspell-mode) + (flyspell-mode -1)) + (setq cursor-type nil)) + +(defun demo-it--presentation-display-set () + "Change some typical `org-mode' display values to make more +presentation-friendly. Store the changed values in a hashtable. +See `demo-it--presentation-display-restore'." + ;; Save everything that is interesting into a hash table: + (puthash :restore t demo-it--presentation-prev-settings) + ;; Allow us to resize our images: + (setq org-image-actual-width nil) + (let* ((backgd (face-attribute 'default :background)) + (border (list (list :foreground backgd :background backgd :height 1)))) + (cl-flet ((set-attr (attr values) + (puthash attr + (face-remap-add-relative attr values) + demo-it--presentation-prev-settings))) + (set-attr 'org-block-begin-line border) + (set-attr 'org-block-end-line border) + (set-attr 'org-meta-line border) + (set-attr 'org-special-keyword border) + (set-attr 'org-block '((:family "monospace"))) + (set-attr 'org-verbatim '((:family "monospace"))) + (set-attr 'org-code '((:family "monospace"))) + (set-attr 'org-table '((:family "monospace"))) + (set-attr 'org-special-keyword '((:family "monospace")))))) + +(defun demo-it--presentation-display-restore () + "After `demo-it--presentation-display-set', call to restore previous settings." + (setq org-hide-emphasis-markers + (gethash :emphasis-markers demo-it--presentation-prev-settings)) + (when (gethash :restore demo-it--presentation-prev-settings) + (remhash :restore demo-it--presentation-prev-settings) + (cl-flet ((rest-attr (attr) (face-remap-remove-relative + (gethash attr demo-it--presentation-prev-settings)))) + (mapcar #'rest-attr (list 'org-block-begin-line 'org-block-end-line 'org-block 'org-meta-line + 'org-verbatim 'org-code 'org-table 'org-special-keyword))))) + +;; Specify a section in the presentation + +(defun demo-it--presentation-section (section) + "Moves the displayed presentation to a SECTION header." + (interactive "s") + (when demo-it--presentation-buffer + (switch-to-buffer demo-it--presentation-buffer) + + (when (fboundp 'org-tree-slide-mode) + (org-tree-slide-content)) + + (goto-char (point-min)) + (re-search-forward (format "^\*+ +%s" section)) + + (when (fboundp 'org-tree-slide-mode) + (org-tree-slide-move-next-tree)))) + +;; Jumping Back to the Presentation +;; +;; In this case, we've been doing some steps, and the screen is +;; "messed up", calling this function returns back to the +;; presentation. + +(defun demo-it-presentation-return-noadvance () + "Return to the presentation buffer and delete other windows." + (when demo-it--presentation-buffer + (switch-to-buffer demo-it--presentation-buffer)) + (delete-other-windows)) + +(defun demo-it-presentation-return () + "Return to the presentation buffer, delete other windows, and +advance to the next 'org-mode' section." + (when demo-it--presentation-buffer + (demo-it-presentation-return-noadvance) + (when (fboundp 'org-tree-slide-move-next-tree) + (org-tree-slide-move-next-tree)))) + +;; Advance Presentation without Changing Focus +;; +;; Advances the org-mode presentation, but after popping into that +;; presentation buffer, returns to the window where our focus was +;; initially. + +(defun demo-it-presentation-advance () + "Advance the presentation to the next frame (if the buffer is +an `org-mode' and `org-tree-slide' is available), but doesn't +change focus to the window." + (interactive) + (when demo-it--presentation-buffer + (let ((orig-window (current-buffer))) + (switch-to-buffer demo-it--presentation-buffer) + (when (fboundp 'org-tree-slide-move-next-tree) + (org-tree-slide-move-next-tree)) + (switch-to-buffer orig-window)))) + +(defun demo-it-presentation-highlight-phrase (phrase &optional color) + "Highlight a PHRASE (based on a regular expression) in the +presentation buffer. This is useful to highlight bullet point +items while executing appropriate code." + (when demo-it--presentation-buffer + (let ((orig-window (current-buffer)) + (hilite-color (if (null color) 'hi-green-b color))) + (switch-to-buffer demo-it--presentation-buffer) + (hi-lock-unface-buffer t) + (hi-lock-face-phrase-buffer phrase hilite-color) + (switch-to-buffer orig-window)))) + +(define-obsolete-function-alias 'demo-it--presentation-highlight-phrase + 'demo-it-presentation-highlight-phrase "2016-Oct") + +(defun demo-it-presentation-unhighlight-all () + "Remove all highlighted values in a presentation previously set +by a call to `demo-it-presentation-highlight-phrase'." + (when demo-it--presentation-buffer + (let ((orig-window (current-buffer))) + (switch-to-buffer demo-it--presentation-buffer) + (hi-lock-unface-buffer t) + (switch-to-buffer orig-window)))) + +(define-obsolete-function-alias 'demo-it--presentation-unhighlight-all + 'demo-it-presentation-unhighlight-all "2016-Oct") + +;; Clean up the Presentation +;; +;; The org-presentation-start function alters the way an org-mode file +;; is displayed. This function returns it back to a normal, editable +;; state. + +(defun demo-it-presentation-quit () + "Undo display settings made to the presentation buffer." + (interactive) + (demo-it--setq-restore) + (when demo-it--presentation-buffer + (switch-to-buffer demo-it--presentation-buffer) + (when (fboundp 'org-tree-slide-mode) + (org-tree-slide-mode -1)) + (when (fboundp 'flyspell-mode) + (flyspell-mode t)) + (setq cursor-type t) + (demo-it--presentation-display-restore) ; Restore previous changes + (variable-pitch-mode 0) + (demo-it-show-mode-line) + (text-scale-set 0))) + +;; ---------------------------------------------------------------------- + +;;;###autoload +(defun demo-it-single-presentation (file &optional size style section) + "Demonstration that presents an `org-mode' FILE as a +full-screen presentation. SIZE is the text scaling size, and STYLE is the presentation " + (interactive "fPresentation File: ") + (demo-it-create (demo-it-presentation file size style section)) + (demo-it-start) + + ;; Now that the presentation is going, let's change the mode: + (demo-it-disable-mode) + (demo-it-mode-pres t)) + +(define-minor-mode demo-it-mode-pres "Pressing 'space' advances demo." + :lighter " demo-p" + :require 'demo-it + :global t + :keymap '((" " . demo-it-presentation-advance) + (" " . demo-it-presentation-advance) + ("q" . demo-it-disable-mode) + ("Q" . demo-it-end))) + +(provide 'demo-it-present) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; demo-it-present.el ends here diff --git a/elpa/demo-it-20161103.1337/demo-it.el b/elpa/demo-it-20161103.1337/demo-it.el new file mode 100644 index 00000000..c2461961 --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it.el @@ -0,0 +1,727 @@ +;;; DEMO-IT --- Create demonstrations +;; +;; Author: Howard Abrams +;; Copyright (C) 2014 Howard Abrams +;; Keywords: demonstration presentation test +;; Version: 2.0.0 +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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 +;; 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 this program. If not, see . +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: +;; +;; When making demonstrations of new products, technologies and other +;; geekery, I love the versatility of using Emacs to demonstrate the +;; trifecta of sprint reviews, including: +;; +;; - Presentations explaining the technologies +;; - Source code ... correctly highlighted +;; - Executing the code in Eshell ... or similar demonstration +;; - Test a new feature +;; +;; However, I don't want to fat-finger, mentally burp, or even delay +;; the gratification while I type, so I predefine each "step" as an +;; Elisp function or keyboard macro, and then have =demo-it= execute +;; each function when I hit either the SPACE key or the F12 key +;; (advanced minor mode). +;; +;; Using the library is a four step process: +;; +;; 1. Load the library in your own Elisp source code file +;; 2. Create a collection of functions that "do things". +;; 3. Create the ordered list of functions/steps with `demo-it-create' +;; 4. Start the demonstration with `demo-it-start' +;; +;; For instance: +;; +;; (require 'demo-it) ;; Load this library of functions +;; +;; (defun dit-load-source-code () +;; "Load some source code in a side window." +;; (demo-it-presentation-advance) +;; (demo-it-load-fancy-file "example.py" :line 5 12 :side)) +;; +;; (defun dit-run-code () +;; "Execute our source code in an Eshell buffer." +;; ;; Close other windows and advance the presentation: +;; (demo-it-presentation-return) +;; (demo-it-start-shell) +;; (demo-it-run-in-shell "python example.py Snoopy")) +;; +;; (demo-it-create :single-window :insert-slow :full-screen +;; (demo-it-title-screen "example-title.org") +;; (demo-it-presentation "example.org") +;; dit-load-source-code +;; dit-run-code +;; (demo-it-run-in-shell "exit" nil :instant)) +;; +;; (demo-it-start) +;; +;; Each "step" is a series of Elisp functions that "do things". +;; While this package has a collection of helping functions, the steps +;; can use any Elisp command to show off a feature. +;; +;; I recommend installing these other Emacs packages: +;; +;; - https://github.com/takaxp/org-tree-slide +;; - https://github.com/sabof/org-bullets +;; - https://github.com/magnars/expand-region.el +;; - https://github.com/Bruce-Connor/fancy-narrow +;; +;; See http://github.com/howardabrams/demo-it for more details and +;; better examples. You will want to walk through the source code +;; for all the utility functions. +;; +;;; Code: + +(require 'cl-lib) + +;; Predefined necessary external functions: +(defvar org-image-actual-width) + +;; And functions from other projects I like to use... +(declare-function eshell-send-input "ext:eshell") +(declare-function show-all "ext:eshell.c") + +;; Load our 'modules' from other files: +(require 'demo-it-custom) + +;; And specify the customization variables set in that module: +(defvar demo-it--shell-or-eshell) +(defvar demo-it--keymap-mode-style) +(defvar demo-it--insert-text-speed) +(defvar demo-it--open-windows) +(defvar demo-it--open-windows-size) +(defvar demo-it--text-scale) +(defvar demo-it--start-fullscreen) +(defvar demo-it--start-single-window) +(declare-function demo-it--get-insert-text-speed "demo-it-custom.el") +(declare-function demo-it--get-text-scale "demo-it-custom.el") +(declare-function demo-it--set-property "demo-it-custom.el") + + +;; ---------------------------------------------------------------------- +;; MINOR MODES +;; +;; We define two styles of minor modes for dealing with special keys +;; to advance the demonstration along ... a simple uses space and +;; return, and an 'advanced' mode that requires a special function +;; key... + +(define-minor-mode demo-it-mode "Pressing 'space' advances demo." + :lighter " demo" + :require 'demo-it + :global t + :keymap '((" " . demo-it-step) + (" " . demo-it-step) + ("[down]" . demo-it-step) + ("[mouse-1]" . demo-it-set-mouse-or-advance) + ([nil mouse-1] . demo-it-step) + ([nil wheel-up] . demo-it-ignore-event) + ([nil wheel-down] . demo-it-ignore-event) + ([nil wheel-left] . demo-it-ignore-event) + ([nil wheel-right] . demo-it-ignore-event) + ("q" . demo-it-disable-mode) + ("Q" . demo-it-end))) + +(define-minor-mode demo-it-mode-adv "Pressing '' advances demo." + :lighter " demo-adv" + :require 'demo-it + :global t + :keymap (let ((map (make-sparse-keymap))) + (define-key map (kbd "") 'demo-it-step) + (define-key map (kbd "s-") 'demo-it-insert-text) + (define-key map (kbd "A-") 'demo-it-insert-text) + (define-key map (kbd "M-") 'demo-it-end) + map)) + +;; Demo Mode +;; +;; Allows us to advance to the next step by pressing the +;; space bar or return. Press the 'q' key to stop the mode. + +(defun demo-it-disable-mode () + "Called when 'q' (or similar key) pressed to disable either the +simple or advanced version of `demo-it-mode'." + (interactive) + (demo-it-mode -1) + (demo-it-mode-adv -1)) + +;; ---------------------------------------------------------------------- +;; DEMONSTRATION MAKER +;; +;; When we start a demonstration, we would pass in a list of functions +;; to call for each step, and then call =demo-step= to execute the +;; first one on the list. + +;; A "global" variable (shudder) to track state of the demonstration: +(defvar demo-it--step 0 "Stores the current demo 'step' function.") +(defvar demo-it--steps '() "List of functions to be executed in order.") +(defvar demo-it-start-winconf nil + "Window configuration when starting demo. Used to restore + buffer positions after demonstration is complete.") + +;;;###autoload +(defun demo-it-start (&optional steps advanced-mode) + "Start the current demonstration and kick off the first step. +STEPS is a list of functions or keystrokes to execute. +If nil, the STEPS must be specified by a call to `demo-it-create'. + +The optional ADVANCED-MODE turns on keybindings where +advances the steps instead of Space. This mode is better for +more interactive demonstrations." + (interactive) + (when (or demo-it-mode demo-it-mode-adv) + (error "Do not start new demonstrations DURING demonstration")) + + (setq demo-it-start-winconf (current-window-configuration)) + (setq demo-it--step 0) ;; Reset the step to the beginning + (when steps + (setq demo-it--steps steps)) ;; Store the steps. + + (if (or advanced-mode (eq demo-it--keymap-mode-style :advanced-mode)) + (demo-it-mode-adv t) + (demo-it-mode t)) + + (if demo-it--start-fullscreen + (demo-it-frame-fullscreen)) + (if demo-it--start-single-window + (delete-other-windows)) + + (demo-it-step)) + +;;;###autoload +(defmacro demo-it-create (&rest forms) + "Create and store an ordered list of steps and configuration +values. The FORMS can be either function names, expressions or +keywords, like `:advanced-mode' and `:variable-width'." + `(progn + (demo-it--set-properties (cl-remove-if-not 'keywordp '(,@forms))) + (setq demo-it--steps (cl-remove-if 'keywordp '(,@forms))))) + +(defun demo-it--set-properties (l) + "Sets a series of single property values from list, L." + ;; First, save all the customization properties... + (demo-it-setq-save demo-it--keymap-mode-style + demo-it--shell-or-eshell + demo-it--open-windows + demo-it--text-scale + demo-it--start-fullscreen + demo-it--start-single-window + demo-it--insert-text-speed) + ;; Second, set all the new customization properties: + (mapc 'demo-it--set-property l)) + +(defun demo-it-end () + "End the current demonstration by resetting the values +inflicted on the presentation buffer as well as closing other +windows." + (interactive) + (demo-it-disable-mode) + (demo-it-presentation-quit) + (set-window-configuration demo-it-start-winconf)) + +;; Next Step +;; +;; Hitting the key should be bound to triggering the next step in +;; the demonstration. + +(defun demo-it-step (&optional step) + "Execute the next step in the current demonstration. Jump to a +particular STEP if the optional parameter is given, i.e. C-6 +to run the 6th step." + (interactive "P") + (if step + (setq demo-it--step step) ;; Changing Global state, yay! + (setq demo-it--step (1+ demo-it--step))) + (let + ;; At this point, step is 1-based, and I need it 0-based + ;; and f-step is the function to call for this step... + ((f-step (nth (1- demo-it--step) demo-it--steps))) + (if f-step + (demo-it--execute-step f-step) + (read-event "Demonstration finished. Hit any key to return.") + (demo-it-end)))) + +(defun demo-it-restep () + "Execute the previous step in the current demonstration. + +Useful when the previous step failed, and you want to redo it." + (interactive) + (let + ;; At this point, step is 1-based, and I need it 0-based + ;; and f-step is the function to call for this step... + ((f-step (nth (1- demo-it--step) demo-it--steps))) + (if f-step + (demo-it--execute-step f-step) + (message "Finished the entire demonstration.")))) + +(defun demo-it--execute-step (f-step) + "Executes F-STEP depending on its type, e.g. expression, function, etc." + (condition-case err + (cond ((functionp f-step) (funcall f-step)) + ((listp f-step) (eval f-step)) ; An expression + ((stringp f-step) (execute-kbd-macro (kbd f-step))) + ((keywordp f-step) (demo-it--set-property f-step)) + (t (error "invaid step: %s" f-step))) + (error (read-event (format "Abort the demonstration because of error. Hit any key to return.\n%S" err)) + (demo-it-end)))) + +;; Position or advance the slide? Depends... + +(defun demo-it-set-mouse-or-advance (evt) + "Advances to the next step if clicked on the right side of any +window, otherwise, it position the point as expected. With EVT, +function can be bound to the mouse click." + (interactive "e") + (if (posn-area (event-start evt)) ;; Clicked in special area? + (demo-it-step) + (let ((col (car (posn-col-row (event-start evt)))) + (wid (window-width (posn-window (event-start evt))))) + (if (> col (- wid 4)) + (demo-it-step) + (mouse-set-point evt))))) + +(defun demo-it-show-step () + "Display the expected function to be run during the next step." + (interactive) + (let ((func (nth demo-it--step demo-it--steps))) + (message "Step: %d - Going to run: %s" demo-it--step func))) + +(defun demo-it-ignore-event (evt) + "Empty function that absorbs the EVT parameter to keep +demonstration from flipping out." + (interactive "P") + (message "")) + + +;; ---------------------------------------------------------------------- +;; HIDE MODELINE +;; +;; Call the `demo-it-hide-mode-line' when displaying images and +;; org-mode files displayed as "presentations", so that we aren't +;; bothered by the sight of the mode. + +(defvar demo-it--old-mode-line nil) +(make-variable-buffer-local 'demo-it--old-mode-line) + +(defun demo-it-hide-mode-line () + "Hide mode line for a particular buffer." + (interactive) + (when mode-line-format + (setq demo-it--old-mode-line mode-line-format) + (setq mode-line-format nil))) + +(defun demo-it-show-mode-line () + "Show mode line for a particular buffer, if it was previously hidden with 'demo-it--hide-mode-line." + (interactive) + (if demo-it--old-mode-line + (setq mode-line-format demo-it--old-mode-line))) + + +;; ---------------------------------------------------------------------- +;; SIDE WINDOWS and HELPER FILES +;; +;; Typically, we make a side window that is large enough to have some +;; fun in, as the main window would serve as little more than an +;; outline or displaying a presentation. +;; +;; The `demo-it--make-side-window' function is a helper and +;; probably won't be called directly, but instead is called by +;; functions that load a file, image or start a shell... + +(defun demo-it--make-side-window (&optional side size) + "Opens window on the side of the current frame and selects that window. + +SIDE is either `:above', `:below', `:left', `:right' or `:side' +and defaults to the value of `demo-it--open-windows' (A value of +`:none' acts as a no-op and doesn't open a window). + +SIZE specifies the width of the window if new window is on the +side, or the height if the window is either `:above' or +`:below'." + ;; Since many functions call this, we need a way to actually /not/ + ;; split the screen, so passing in a `:none' overrides the default. + (when (not (or (eq side 'none) (eq side :none))) + + (select-window (demo-it--new-root-window + (or side demo-it--open-windows) + (or size demo-it--open-windows-size))))) + +;; Since the `make-side-window' shouldn't be called, it has two +;; dashes, but to maintain backward compatibility, we make an alias: +(define-obsolete-function-alias 'demo-it-make-side-window + 'demo-it--make-side-window "2016-Oct") + +(defun demo-it--new-root-window (direction size) + "Split the main window in the DIRECTION where DIRECTION is a +symbol with possible values of 'right, 'left, 'above or 'below +and SIZE is the final size of the windows, if the window is split +horizontally (i.e. DIRECTION 'below or 'above) SIZE is assumed to +be the target height otherwise SIZE is assumed to be target +width." + (let* ((dir (pcase direction ;; Create synonyms!? + (:left 'left) + (:right 'right) + (:side 'right) + (:below 'below) + (:above 'above) + (_ direction))) + (new-window (split-window (frame-root-window) nil dir)) + (horizontal (member dir '(right left)))) + (save-excursion + (select-window new-window) + (enlarge-window (- size (if horizontal + (window-width) + (window-height))) + horizontal)) + new-window)) + +(defun demo-it-load-file (file &optional side size width) + "Splits root frame into a window and load FILE into it. + +SIDE can be `:above' or `:below' (for vertical split) or `:left' +or `:right' (`:side' is a synomym for `:right'), or `:none' for +load the file in the current buffer. This defaults to the +customized value of `demo-it--open-windows'. + +SIZE can specify the text font scale, and if `nil', it uses the +value of `demo-it--text-scale'. The WIDTH specifies the size of +this new window, which is either the width of a side window, or +the height if the window is `:above' or `:below'." + (demo-it--make-side-window side width) + (find-file file) + (text-scale-set (demo-it--get-text-scale size))) + +(defun demo-it--get-section (type &optional start end) + "Return tuple of beginning and end of a section of buffer. + +If TYPE is :char or 'char, START and END refers to specific +character positions, but if TYPE is :line or 'line, this returns +the point positions as if START and END are line numbers." + + ;; Due to the way we call this function, we need to allow start and + ;; end to be null, and if so, we select the entire buffer. + (when (or (null start) (null end)) + (setq type :char) + (setq start (point-min)) + (setq end (point-max))) + + (when (or (eq type :line) (eq type 'line)) + (save-excursion + ;; Re-implementing `goto-line' for the win! + (goto-char (point-min)) (forward-line (1- start)) + (setq start (point)) + (goto-char (point-min)) (forward-line end) + (setq end (point)))) + (cons start end)) + +(defun demo-it-load-part-file (file type start end &optional side size width) + "Splits window and loads FILE, but narrow to particular region. + +If TYPE is set to :line, then START and END refers to the first +and last lines to narrow. If TYPE is set to :char, then START and +END refer to specific character positions. + +See `demo-it-load-file' for an explanation of SIDE and SIZE. +Also see `demo-it-load-fancy-file' for an alternative version." + (demo-it-load-file file side size width) + (let ((positions (demo-it--get-section type start end))) + (narrow-to-region (car positions) (cdr positions)))) + +(defun demo-it-show-image (file &optional side size width) + "Load FILE as image (or any other special file) in another +window without a mode line or fringe. SIDE can be either :side +or :below, and if `nil', the default is to use the value of +`demo-it--open-windows'." + (demo-it-load-file file side size width) + (fringe-mode '(0 . 0)) + (demo-it-hide-mode-line)) + +;; Compare and Contrast Files +;; +;; Places two files next to each other so that you can diff +;; or at least visually compare them. I suppose that after +;; they are loaded, you can switch to them with something like: +;; (pop-to-buffer "example.py") +;; To further manipulate them. + +(defun demo-it-compare-files (file1 file2 &optional side size) + "Load FILE1 and FILE2 as either two windows on top of each +other on the side of the screen, or two windows below (depending +on the value of SIDE). The SIZE specifies the text scaling of +both buffers." + (if (null side) + (setq side demo-it--open-windows)) + (if (null size) + (setq size demo-it--text-scale)) + + (cl-flet ((open-other-window (file side size) + (if (or (eq side 'below) (eq side :below)) + (split-window-horizontally) + (split-window-below)) + (find-file file) + (text-scale-set (demo-it--get-text-scale size)))) + (demo-it-load-file file2 side size) + (open-other-window file1 side size))) + +;; ---------------------------------------------------------------------- +;; SHELL WORK +;; +;; Kick off a shell in another window, change to a particular +;; directory, and automatically run something. + +(defun demo-it-start-shell (&optional directory command name + side size width) + "Start a shell or eshell instance, and change to DIRECTORY to +execute COMMAND. NAME optionally labels the buffer, and defaults +to `Shell'. + +SIDE can be `:above' or `:below' (for vertical split) or `:left' +or `:right' (`:side' is a synomym for `:right'), or `:none' for +load the file in the current buffer. This defaults to the +customized value of `demo-it--open-windows'. + +SIZE can specify the text font scale, and if `nil', it uses the +value of `demo-it--text-scale'. The WIDTH specifies the size of +this new window, which is either the width of a side window, or +the height if the window is `:above' or `:below'." + (let* ((title (demo-it--shell-buffer-name name)) + (des-buf (get-buffer title))) + + (demo-it--make-side-window side width) + (if des-buf + (demo-it--start-shell-reuse title directory) + + ;; Otherwise, create a new shell buffer... + (demo-it--start-shell-new title directory size)) + + (when command + (demo-it-insert-shell command)))) + +(define-obsolete-function-alias 'demo-it-start-eshell 'demo-it-start-shell "2016-Oct") + +(defun demo-it--start-shell-new (title directory size) + "Attempt to create a new shell/eshell with a buffer named TITLE +in a particular DIRECTORY." + (let ((default-directory (or directory + (file-name-directory (buffer-file-name))))) + (if (eq demo-it--shell-or-eshell :shell) + (shell title) + + (eshell "new-shell") + (rename-buffer title)) + + (text-scale-set (demo-it--get-text-scale size)) + + (erase-buffer) + (demo-it-insert-shell "" :instant))) + +(defun demo-it--start-shell-reuse (title directory) + "Attempt to re-use existing shell/eshell with a buffer named +TITLE in a particular DIRECTORY." + (switch-to-buffer title) + (when directory + (goto-char (point-max)) + (demo-it-insert-shell (format "cd %s" directory) :instant) + (erase-buffer) + (demo-it-insert-shell "" :instant))) + +(defun demo-it--shell-buffer-name (&optional name) + "Return the buffer NAME for the shell or eshell window." + (if name + (concat "Shell: " name) + "Shell")) + +(defun demo-it-insert-shell (command &optional speed) + "Inserts some text in the given shell or eshell. The optional +SPEED overrides the custom, `demo-it--insert-text-speed'." + (demo-it-insert command speed) + (if (eq demo-it--shell-or-eshell :shell) + (comint-send-input) + (eshell-send-input))) + +(defun demo-it-insert (str &optional speed) + "Insert STR into the current buffer as if you were typing it by hand. +The SPEED (if non-nil) overrides the default value settings of the +`demo-it--insert-text-speed' custom variable." + (let ((timings (demo-it--get-insert-text-speed speed))) + + (if (eq timings :instant) + (insert str) + (let ((bottom-limit (car timings)) + (top-limit (cdr timings))) + + ;; If we are not inserting instantaneously, then loop over each + ;; character in the string with a random delay based on this range: + (dolist (ch (string-to-list str)) + (insert ch) + (let ((tm (+ (/ bottom-limit 1000.0) + (/ (random top-limit) 1000.0)))) + (sit-for tm))))))) + +(defun demo-it-run-in-shell (command &optional name speed) + "Run shell command COMMAND in a previously initialized Eshell. +If NAME is not specified, it defaults to `Shell'." + (pop-to-buffer (demo-it--shell-buffer-name name)) + (goto-char (point-max)) + (demo-it-insert-shell command speed)) + +(define-obsolete-function-alias 'demo-it-run-in-eshell 'demo-it-run-in-shell "2016-Oct") +(define-obsolete-function-alias 'demo-it-type-in-eshell 'demo-it-run-in-shell "2016-Oct") + +(defun demo-it-show-shell (&optional name side width) + "Show the shell buffer of a given NAME whose buffer may have +been buried and not in visible. Optionally specify the +SIDE (either 'below or 'side) of the screen where the shell +should be shown." + (demo-it--make-side-window side width) + (switch-to-buffer (demo-it--shell-buffer-name name))) + +(define-obsolete-function-alias 'demo-it-show-eshell 'demo-it-show-shell "2016-Oct") + + +;; TITLE DISPLAY +;; +;; Create a file to serve as a "title" as it will be displayed with a +;; larger-than-life font and make Emacs not look like Emacs. + +(defun demo-it-title-screen (file &optional size) + "Display FILE to serve as the demonstration's title, as it will +be displayed with a larger-than-life font without a mode line, +etc. SIZE specifies the text scale, which ignores the +`demo-it--text-scale' customization setting and defaults to 5x." + (fringe-mode '(0 . 0)) + + (find-file file) + (show-all) + (demo-it-hide-mode-line) + (setq cursor-type nil) + (if (fboundp 'flyspell-mode) + (flyspell-mode -1)) + (variable-pitch-mode 1) + (text-scale-set (or size (demo-it--get-text-scale :huge))) + + ;; Time to brag a wee bit... + (message "† This presentation is running within Emacs.")) + + +;; ---------------------------------------------------------------------- +;; DEALING WITH FRAME +;; +;; During a demonstration, it might be nice to toggle between +;; full screen and "regular window" in a programmatic way: + +(defun demo-it-toggle-fullscreen () + "Toggle the frame between full screen and normal size. Only +useful for old versions of Emacs, but this code probably won't +work on them anyway." + (declare (obsolete toggle-frame-fullscreen "2016-Oct")) + (interactive) + (set-frame-parameter + nil 'fullscreen + (when (not (frame-parameter nil 'fullscreen)) 'fullboth))) + +;; We can force the window to be full screen: + +(defun demo-it-frame-fullscreen () + "Set the frame window to cover the full screen." + (interactive) + (set-frame-parameter nil 'fullscreen 'fullboth)) + +;; Let's make a right-side frame window: + +(defun demo-it-frame-leftside () + "Set the window frame to be exactly half the physical display +screen, and place it on the left side of the screen. This can be +helpful when showing off some other application." + (declare (obsolete "Really!? You think this is useful?" "2016-Oct")) + (interactive) + (let* ((full-pixels (- (x-display-pixel-width) 16)) + (full-width (/ full-pixels (frame-char-width))) + (dest-width (/ full-width 2))) + (set-frame-parameter nil 'fullscreen nil) + (set-frame-parameter nil 'width dest-width) + (set-frame-parameter nil 'left 0))) + +;; Temporary variables +;; +;; Set variables during a demonstration. +;; They are restored after the demonstration. + +(defvar demo-it--setq-tempvars (make-hash-table)) +(defvar demo-it--setq-voidvars nil) +(defvar demo-it--setq-nilvars nil) + +(defun demo-it--setq (l) + (cl-case (length l) + (0) + (1 + (error "Argument length is odd")) + (t + (let ((name (car l)) + (var (eval (cadr l)))) + (cond ((and (boundp name) (symbol-value name)) + (puthash name (symbol-value name) demo-it--setq-tempvars)) + ((boundp name) + (push name demo-it--setq-nilvars)) + (t + (push name demo-it--setq-voidvars))) + (set name var) + (demo-it--setq (nthcdr 2 l)))))) + +(defmacro demo-it-setq (&rest list) + "Like `setq', but the values are restored to original after the demo. +Actually restored by `demo-it--setq-restore'." + `(demo-it--setq '(,@list))) + +(defmacro demo-it-setq-save (&rest list) + "Saves the original value of a LIST of variables. + +Call `demo-it--setq-restore' to restore the original values of +the variables." + `(mapcar ,(lambda (v) (puthash v (eval v) demo-it--setq-tempvars)) + '(,@list))) + +(defun demo-it--setq-restore () + "Restore values of setting by `demo-it-setq'." + (cl-loop for name being the hash-keys in demo-it--setq-tempvars using (hash-values value) + do (set name value)) + (dolist (name demo-it--setq-nilvars) (set name nil)) + (mapc 'makunbound demo-it--setq-voidvars) + (clrhash demo-it--setq-tempvars) + (setq demo-it--setq-nilvars nil + demo-it--setq-voidvars nil)) + +;; Helper Functions + +(defun demo-it-message-keybinding (key command) + "Display message showing the KEY keybinding and its COMMAND." + (interactive) + (message "Typed: '%s' Command: '%s'" key command)) + +;; ---------------------------------------------------------------------- + +(require 'demo-it-present) +(require 'demo-it-extras) + +;; As a final harrah, we need to let other files know how to include +;; this bad child. + +(provide 'demo-it) + +;;; demo-it.el ends here diff --git a/elpa/demo-it-20161103.1337/demo-it.info b/elpa/demo-it-20161103.1337/demo-it.info new file mode 100644 index 00000000..93b0d0cd --- /dev/null +++ b/elpa/demo-it-20161103.1337/demo-it.info @@ -0,0 +1,1409 @@ +This is demo-it.info, produced by makeinfo version 5.2 from +demo-it.texi. + +This manual is for demo-it (version 2.0, last updated 24 October 2016), +a project for running demonstrations within Emacs. + + Copyright © 2016, Howard Abrams + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included in + the section entitled “GNU Free Documentation License”. +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* Demo It: (demo-it). Demonstrations made and shown in Emacs. +END-INFO-DIR-ENTRY + + +File: demo-it.info, Node: Top, Next: Basics, Up: (dir) + +Demo It +******* + +This manual is for demo-it (version 2.0, last updated 24 October 2016), +a project for running demonstrations within Emacs. + + Copyright © 2016, Howard Abrams + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included in + the section entitled “GNU Free Documentation License”. + +* Menu: + +* Basics:: +* Showing Presentations:: +* Showing Files:: +* Running Commands:: +* Inserting Text:: +* Extra Functions:: +* Customization:: +* Index:: + +— The Detailed Node Listing — + +Basics + +* Simple Example:: +* Step Types:: +* Demonstration Options:: +* Running the Demo:: +* Demo Modes:: + + + + + +Demo Modes + +* demo-it-mode:: +* demo-it-mode-adv:: + +Showing Presentations + +* demo-it-presentation:: +* demo-it-presentation-quit:: +* demo-it-presentation-return:: +* demo-it-presentation-return-noadvance:: +* demo-it-presentation-advance:: +* demo-it-presentation-highlight-phrase:: +* demo-it-single-presentation:: + + + +Showing Files + +* demo-it-load-file:: +* demo-it-load-part-file:: +* demo-it-load-fancy-file:: +* demo-it-show-image:: +* demo-it-compare-files:: + + + +Running Commands + +* demo-it-start-shell:: +* demo-it-run-in-shell:: +* demo-it-show-shell:: + + + + +Extra Functions + +* demo-it-end:: +* demo-it-step:: +* demo-it-restep:: +* demo-it-show-step:: +* demo-it-hide-mode-line:: +* demo-it-show-mode-line:: +* demo-it-title-screen:: +* demo-it-message-keybinding:: +* demo-it-highlight-dwim:: + + + +Customization + +* demo-it--keymap-mode-style:: +* demo-it--shell-or-eshell:: +* demo-it--open-windows:: +* demo-it--open-windows-size:: +* demo-it--text-scale:: +* demo-it--start-fullscreen:: +* demo-it--start-single-window:: +* demo-it--presentation-hide-mode-line:: +* demo-it--presentation-hide-org-markers:: +* demo-it--presentation-variable-width:: +* demo-it--presentation-hide-org-blocks:: +* demo-it--insert-text-speed:: + + +File: demo-it.info, Node: Basics, Next: Showing Presentations, Prev: Top, Up: Top + +Basics +****** + +At the end of each sprint, each of us demonstrate our accomplishments. +These reviews often incorporate the following trifecta: + + • Presentations explaining the technology and whatnot + • Source code reviews…correctly highlighted and interactive + • Executing the code in a shell + + During my sprint reviews, I noticed I used my org-mode-formatted +files, eshell and source code buffers… In other words, I was always in +Emacs. However, fat-fingering or mentally burping delayed the +gratification for my audience while I laboriously typed. I originally +solved this problem by predefining each “step” as an Emacs Lisp +function, and then had another function execute each function when I hit +an _advance_ key (F12). + + After I had amassed a small army of _helper functions_, I packaged it +as demo-it, because I lack the imagination to come up with anything more +clever. + + See the following videos as examples of what can be done: + + • Emacs: An Introduction for the Curious + (http://www.youtube.com/watch?v=B6jfrrwR10k) + • Literate DevOps Programming + (https://www.youtube.com/watch?v=dljNabciEGg) + • Learn You Some Lisp for Great Good + (http://www.youtube.com/watch?v=3T00X_sNg4Q) + +* Menu: + +* Simple Example:: +* Step Types:: +* Demonstration Options:: +* Running the Demo:: +* Demo Modes:: + + +File: demo-it.info, Node: Simple Example, Next: Step Types, Up: Basics + +Simple Example +============== + +Using this project is a four step process: + + 1. Load the library in your own Elisp source code file + 2. Create zero or more helper functions that “do things”, or use the + functions provided by this project. + 3. Order the functions by calling (demo-it-create) + 4. Call demo-it-start to begin the fun. + + Press the space for each step, or call demo-it-end to end early. + + For instance: + + (require 'demo-it) + + (defun my-demo-step/show-code () + "Helper demo function that displays some source code and + advances the presentation at the same time." + (demo-it-load-side-window "example/example.py") + (demo-it-presentation-advance)) + + ;; Order the functions and forms for this presentation: + (demo-it-create (demo-it-presentation "example/example.org") + my-demo-step/show-code + demo-it-presentation-return ; close file and advance + (demo-it-run-in-eshell "python example/example.py")) + + (demo-it-start) + + +File: demo-it.info, Node: Step Types, Next: Demonstration Options, Prev: Simple Example, Up: Basics + +Step Types +========== + +The ‘demo-it-create’ is a macro that stores a single demonstration. +Calling it a second time replaces any previously created demonstrations. + + Each “step” given to the demo-it-create macro can be one of the +following: + + • Expression typically calling a helper function, for instance: + (demo-it-presentation "example/example.org") + + • Name of a function to call that does multiple actions, for + instance: + demo-it-presentation-return + + • a string referring to a key-binding to run, for instance: + "C-x C-f example.el " + + • a property that affects demonstration behavior, see the *note + Demonstration Options: Demonstration Options. or *note + Customization: Customization. + + Note: Any Emacs function can be called, either by name or as part of +an expression. These functions can be standard functions, supplied by +this demo-it package, or even ones you write. ;-) + + +File: demo-it.info, Node: Demonstration Options, Next: Running the Demo, Prev: Step Types, Up: Basics + +Demonstration Options +===================== + +The following list of keywords can be passed to demo-it-create to +override various *note Customization: Customization. settings: + + • :simple-mode uses mode where space advances demonstration. + • :advance-mode uses mode where ‘F12’ advances demonstration. + • :use-shell chooses a standard shell command line interface when + running the *note demo-it-start-shell: demo-it-start-shell. + command. + • :use-shell chooses to use the built-in Emacs shell, which Emacs + uses find more comfortable when subjected to Windows systems. + • :eshell is an alias for :use-eshell. + • :shell is an alias for :user-shell. + • :windows-on-right defaults to opening auxiliary windows on the + right side of the frame (see *note demo-it-load-file: Showing + Files. and other helper functions for examples). + • :windows-on-side is an alias for :windows-on-right. + • :windows-on-left like the above, but defaults to the _left_ side of + the frame. + • :windows-below opens other windows at the bottom of the current + frame. + • :windows-above opens other windows at the top of the current frame. + • :fullscreen starts the demonstration with the current frame in + fullscreen mode. + • :single-window deletes other windows when started, and restores + those windows when the demonstration completes. + • :text-small starts presentations and other files in a slightly + smaller font that the current default. Yeah, it seems like a nice + idea to offer it, but I wonder if that is really helpful as a + default for a demonstration. + • :text-normal starts presentations and other loaded files in the + default font and size. + • :text-medium starts presentations and other loaded files in a + slight larger font size (technically scaled at 1). + • :text-large scales presentations and other loaded files at 2. + • :text-x-large scales loaded files at 3. + • :text-xx-large scales loaded files at 4 … go figure. + • :text-huge scales newly loaded files at 5. Got a big monitor or + very few words, I see. + • :insert-slow shell commands (and other calls to *note + demo-it-insert: Inserting Text. function) are inserted character by + character as if a hacker who never took a typing class in middle + school was typing the text. + • :insert-medium shell commands and other text are inserted as if a + medium-grade nerd with sufficient typing skills entered them. + • :insert-fast shell commands are entered like a typist, but to an + audience with the attention span of a gerbil. + • :insert-quickly shell commands are instantly entered, and the + audience is spared the gimmickry of yet-another Emacs feature. + • :show-mode-line leaves the mode-line alone for presentations and + files loaded by the demonstration package. + • :hide-mode-line hides the mode line so neckbeards pay attention to + your demonstration and quit straining to see what minor modes you + prefer. Still using paredit, I see. + • :hide-org-markers hides the asterisks, slashes, and other markup + characters that format text, but still shows the text in bold and + italics. + • :show-org-markers displays org-mode presentations as you wrote it. + • :variable-width uses a variable width font for presentations + because we want to make the vi users cry. + • :fixed-width displays org-mode presentations with your default + monospaced font for ultra nerd cred. You may need this feature if + source code in your presentation. + • :show-block-headers Should the #+begin and #+end markers be shown? + If you are trying to talk about _literate devops_ then, the answer + is yes, show them the way you see them. + • :hide-block-headers Hides the #+begin and #+end markers, but shows + the glorious source code inside. Currently, also shows the + surrounding #+HEADER entries, so beware. + + +File: demo-it.info, Node: Running the Demo, Next: Demo Modes, Prev: Demonstration Options, Up: Basics + +Running the Demo +================ + +Once the demonstration has been created using ‘demo-it-create’, start it +by calling demo-it-start, as this will invoke the first step. + + Typically, pressing the SPACE or RETURN key will advance to the next +step, but this depends on which of the *note Demo Modes: Demo Modes. was +chosen. + + A deprecated version of demo-it-start allows you to pass in a list of +the steps, but creating this list can be problematic, so you’ll get more +mileage from the demo-it-create macro. + + +File: demo-it.info, Node: Demo Modes, Prev: Running the Demo, Up: Basics + +Demo Modes +========== + +Some demonstrations are so complete that pressing the space bar to +advance to each step is sufficient. However, this project can be used +as a _helper_ where each step merely sets up an environment where some +Emacs feature or source code can be elaborated with personal +prestidigitation. In this case, using the space and return to advance +the demonstration would limit what can be demonstrated manually. + + So demo-it contains two minor modes, and starting a demonstration, +one of the following minor mode is chosen. + + The choice is either made by setting the global customization value, +, or by passing the following keyword to demo-it-create. + • :simple-mode + • :advance-mode + +* Menu: + +* demo-it-mode:: +* demo-it-mode-adv:: + + +File: demo-it.info, Node: demo-it-mode, Next: demo-it-mode-adv, Up: Demo Modes + +demo-it-mode +------------ + +The standard minor mode for demonstrations, has the following key +features: + • ‘Space’ or ‘Return’ advances to the next demonstration step + • ‘q’ turns off this mode, allowing you to type normally. Call + demo-it-mode to resume this mode + • ‘Q’ ends the demonstration + + Note: In this mode, clicking the mouse on the right-side of the +screen will advance the demonstration, while clicking elsewhere, +repositions the cursor. + + +File: demo-it.info, Node: demo-it-mode-adv, Prev: demo-it-mode, Up: Demo Modes + +demo-it-mode-adv +---------------- + +The advanced mode is used when the demo-it project simply sets up an +environment, where you want most keys available to enter commands +manually. This mode has the following key features: + + • ‘F12’ advances to the next step in the demonstration + • ‘M-F12’ ends the demonstration + + Why yes, while called _advanced_ is certainly has limited features. + + +File: demo-it.info, Node: Showing Presentations, Next: Showing Files, Prev: Basics, Up: Top + +Showing Presentations +********************* + +This project relies on other projects to do most of the heavy lifting +for using ‘org-mode’ files as the basis of a presentation, especially +the org-tree-slide (https://github.com/takaxp/org-tree-slide) project, +which displays each section under a header as the sole contents of a +buffer. + + The following functions can be added to your demonstration to control +the display of the presentation. + +* Menu: + +* demo-it-presentation:: +* demo-it-presentation-quit:: +* demo-it-presentation-return:: +* demo-it-presentation-return-noadvance:: +* demo-it-presentation-advance:: +* demo-it-presentation-highlight-phrase:: +* demo-it-single-presentation:: + + +File: demo-it.info, Node: demo-it-presentation, Next: demo-it-presentation-quit, Up: Showing Presentations + +demo-it-presentation +==================== + +(file &optional size style section) + + Loads the given ‘org-mode’ file as a presentation. This +automatically calls org-tree-slide +(https://github.com/takaxp/org-tree-slide) if available. + + This function takes an optional ‘size’ parameter to specifies the +text scale. If ‘nil’, this defaults to the value set in *note +demo-it–text-scale: demo-it--text-scale. customization variable. + + The optional ‘style’ parameter can be set to either :variable for +variable font pitch, :blocks for diminished headers on org-blocks, or +:both to enable both features. This is a deprecated, legacy feature, +since it is easier and clearer to either use the customization +variables: + • *note demo-it–presentation-variable-width: + demo-it--presentation-variable-width. + • *note demo-it–presentation-hide-org-blocks: + demo-it--presentation-hide-org-blocks. + + The final parameter, ‘section’, is a string containing the name of an +‘org-mode’ header to specify as the first section to display. + + +File: demo-it.info, Node: demo-it-presentation-quit, Next: demo-it-presentation-return, Prev: demo-it-presentation, Up: Showing Presentations + +demo-it-presentation-quit +========================= + +Undoes the display settings made to the presentation buffer. + + +File: demo-it.info, Node: demo-it-presentation-return, Next: demo-it-presentation-return-noadvance, Prev: demo-it-presentation-quit, Up: Showing Presentations + +demo-it-presentation-return +=========================== + +Makes the last running presentation the current buffer, deletes other +windows, and advances to the next ‘org-mode’ section. + + +File: demo-it.info, Node: demo-it-presentation-return-noadvance, Next: demo-it-presentation-advance, Prev: demo-it-presentation-return, Up: Showing Presentations + +demo-it-presentation-return-noadvance +===================================== + +Similar to calling *note demo-it-presentation-return: +demo-it-presentation-return. in that the latest specified presentation +becomes the current buffer and all other windows are deleted. + + However, the presentation is not advanced to the next section. + + +File: demo-it.info, Node: demo-it-presentation-advance, Next: demo-it-presentation-highlight-phrase, Prev: demo-it-presentation-return-noadvance, Up: Showing Presentations + +demo-it-presentation-advance +============================ + +Advances the currently running presentation to the next section, but +doesn’t change focus to the window. Any further commands happen in the +current window. + + This function is useful if a presentation discusses multiple +commands, then you can advance through them while other commands +actually perform the action (like executing commands in a shell). + + As an example, the following demonstration will _live-code_ while the +presentation discusses each part: + + (demo-it-create (demo-it-presentation "elisp-cookbook.org") + (demo-it-load-file "elisp-example.el") + + ; Advance to next section that talks about defun: + demo-it-presentation-advance + + ; Start coding an Emacs Lisp function: + (demo-it-insert "def") ; Begin yasnippet template + "TAB" ; Trigger yasnippet + (demo-it-insert "some-func") ; The function name + "TAB" ; Advance to parameters + (demo-it-insert "x y") ; parameters + "TAB" ; Advance to parameters + (demo-it-insert "Example function.") + "TAB" ; Advance to interactive + (demo-it-insert " ") ; No need for this section + "TAB" ; Advance to function body + + ; Advance to next section to talk about if statements + demo-it-presentation-advance + + (demo-it-insert "if") ; Begin next template + "TAB" ; Trigger yasnippet + (demo-it-insert "(eq x y)") ; predicate expression + "TAB" ; Advance to if body + + ) ;; etc. + + +File: demo-it.info, Node: demo-it-presentation-highlight-phrase, Next: demo-it-single-presentation, Prev: demo-it-presentation-advance, Up: Showing Presentations + +demo-it-presentation-highlight-phrase +===================================== + +Given a string parameter, ‘phrase’, as a regular expression, this +function highlights a _phrase_ in the presentation buffer without +changing the current buffer. This is useful to highlight bullet point +items while executing appropriate code. + + The ‘color’ parameter is a face from the ‘hi-lock’ project, e.g. +:hi-yellow. + + Note: This unhighlights previous highlighted phrases. Call +‘demo-it-presentation-unhighlight-all’ if you just want to remove the +highlighting. + + +File: demo-it.info, Node: demo-it-single-presentation, Prev: demo-it-presentation-highlight-phrase, Up: Showing Presentations + +demo-it-single-presentation +=========================== + +Demonstration similar to calling *note demo-it-presentation: +demo-it-presentation, in that it presents an ‘org-mode’ file as a +full-screen presentation. In this form, the demonstration doesn’t do +anything more than advance through the presentation, and calling either +‘demo-it-create’ or ‘demo-it-start’ is not needed. + + This function begins a minor-mode where the space or return key +advances the presentation to the next section. In this mode, the ‘q’ +disables this mode, and ‘Q’ quits the demonstration and presentation. + + While the standard customization variables configure the presentation +display style, this function accepts a ‘size’ parameter to set the text +scaling size. + + The optional ‘style’ parameter can be set to either :variable for +variable font pitch, :blocks for diminished headers on org-blocks, or +:both to enable both features. + + +File: demo-it.info, Node: Showing Files, Next: Running Commands, Prev: Showing Presentations, Up: Top + +Showing Files +************* + +While a simple call to find-file is often sufficient to display a file +in Emacs, the following functions can be helpful for showing files and +source code during a demonstration. + + These functions often take the following optional parameters, and in +the spirit of DRY, we will specify them here: + + The optional ‘side’ parameter specifies the side of the frame to +display the new window. Acceptable values can one of the following +keywords: + • :above + • :below + • :left + • :right + • :side is a synomym for :right + • :none loads the file in the current buffer. + + If ‘nil’, defaults is to use the customized value of *note +demo-it–open-windows: demo-it--open-windows. + + The optional ‘size’ parameter takes an integer and specifies the text +scale. If ‘nil’, this defaults to the value set in *note +demo-it–text-scale: demo-it--text-scale. customization variable. + + The ‘width’ parameter specifies the size of the new window, which is +either the width of a side window, or the height if the window is :above +or :below. + +* Menu: + +* demo-it-load-file:: +* demo-it-load-part-file:: +* demo-it-load-fancy-file:: +* demo-it-show-image:: +* demo-it-compare-files:: + + +File: demo-it.info, Node: demo-it-load-file, Next: demo-it-load-part-file, Up: Showing Files + +demo-it-load-file +================= + +Calling this function with a file, first splits the root frame into a +side window and loads the file into that window. + + Keep in mind, that calling it a second time will result in further +splitting of the root window. Call delete-window or *note +demo-it-presentation-return-noadvance: +demo-it-presentation-return-noadvance, or close the window while also +updating the presentation with *note demo-it-presentation-return: +demo-it-presentation-return. + + The optional parameters this function takes are *note described +above: Showing Files. + + +File: demo-it.info, Node: demo-it-load-part-file, Next: demo-it-load-fancy-file, Prev: demo-it-load-file, Up: Showing Files + +demo-it-load-part-file +====================== + +Splits window and loads a file, but also narrows to particular region. + + If the ‘type’ parameter is set to :line, then the ‘start’ and ‘end’ +parameters specify the first and last lines of the region to narrow. If +‘type’ is set to :char, then ‘start’ and ‘end’ refer to specific +character positions. + + The other optional parameters this function takes are *note described +above: Showing Files. + + See *note demo-it-load-fancy-file: demo-it-load-fancy-file. for an +alternative version. + + +File: demo-it.info, Node: demo-it-load-fancy-file, Next: demo-it-show-image, Prev: demo-it-load-part-file, Up: Showing Files + +demo-it-load-fancy-file +======================= + +Splits the root frame and loads a ‘file’ specified by the first +parameter in that window (see *note demo-it-load-file: +demo-it-load-file.), however, this function can use the fancy narrow +(https://github.com/Malabarba/fancy-narrow) to highlight part of the +buffer (if it has been loaded), otherwise, it behaves like *note +demo-it-load-part-file: demo-it-load-part-file. and narrows to the area +specified. + + If the second parameter, ‘type’ is a string that specifies a function +name (available via ‘imenu’), then it highlights that function. + + If ‘type’ is a :line, then the next two parameters, ‘start’ and ‘end’ +specifies the beginning or ending lines. + + If ‘type’ is :char, then ‘start’ and ‘end’ are exact buffer +positions, which you can determine by evaluating (‘M-;’) the following +expression: + (kill-new (int-to-string (point))) + + The optional parameters ‘side’ and ‘size’ are *note described above: +Showing Files. + + Note: This function simply detects if the ‘fancy-narrow’ package has +been loaded. The demonstration will need to issue a ‘require’. + + +File: demo-it.info, Node: demo-it-show-image, Next: demo-it-compare-files, Prev: demo-it-load-fancy-file, Up: Showing Files + +demo-it-show-image +================== + +Loads a file as an image (or any other special file) in another window +without a mode line or fringe. + + The optional parameters this function takes are *note described +above: Showing Files. + + +File: demo-it.info, Node: demo-it-compare-files, Prev: demo-it-show-image, Up: Showing Files + +demo-it-compare-files +===================== + +Loads two files in either two windows on top of each other on the right +side of the screen, or two windows below (depending on the value of the +‘side’, which should either be :below or :side. + + The other optional parameter, ‘size’ is *note described above: +Showing Files. + + +File: demo-it.info, Node: Running Commands, Next: Inserting Text, Prev: Showing Files, Up: Top + +Running Commands +**************** + +What Emacs-sponsored demonstration would be complete without being able +to run the application you created. While your demonstration could +easily call ‘shell-command’, starting a shell, and having Emacs _type_ +the commands makes a demonstration appear more real and interactive. + + The _typing_ abilities when inserting text are not very realistic, as +it simply picks a random delay between each letter. What is lacking, +however, it clacking should of the switches going off while the letter +appears (PRs are acceptable). + + The following functions can be added to your demonstration to enter +commands in a shell (both your default shell, as well as the Eshell is +supported by setting the *note demo-it–shell-or-eshell: +demo-it--shell-or-eshell. variable or giving demo-it-create one of the +following keyword configurations: + + • :use-shell + • :use-eshell + +* Menu: + +* demo-it-start-shell:: +* demo-it-run-in-shell:: +* demo-it-show-shell:: + + +File: demo-it.info, Node: demo-it-start-shell, Next: demo-it-run-in-shell, Up: Running Commands + +demo-it-start-shell +=================== + +Starts a shell or eshell instance, in a particular directory and +executes the given command. The command can be entered into the shell +with a slight random delay intended to mimic a person typing. This +speed of this is specified by *note demo-it–insert-text-speed: +demo-it--insert-text-speed. + + The optional ‘name’ parameter labels the buffer, and defaults to +‘Shell’. + + The other optional parameters this function takes are *note described +above: Showing Files. + + +File: demo-it.info, Node: demo-it-run-in-shell, Next: demo-it-show-shell, Prev: demo-it-start-shell, Up: Running Commands + +demo-it-run-in-shell +==================== + +Run shell command in a shell previously started with *note +demo-it-start-shell: demo-it-start-shell. If a ‘name’ is not specified, +it defaults to name, ‘Shell’. + + The optional ‘speed’ parameter overrides the customization value set +by *note demo-it–insert-text-speed: demo-it--insert-text-speed, or the +text-speed related keyword given to demo-it-create. + + +File: demo-it.info, Node: demo-it-show-shell, Prev: demo-it-run-in-shell, Up: Running Commands + +demo-it-show-shell +================== + +Call to display the shell buffer if the shell window of a given ‘name’ +has been hidden. If ‘name’ is not specified, it defaults to ‘Shell’. + + The other optional parameters this function takes are *note described +above: Showing Files. + + +File: demo-it.info, Node: Inserting Text, Next: Extra Functions, Prev: Running Commands, Up: Top + +Inserting Text +************** + +Perhaps you want to regale your audience with your programmatic prowess, +but don’t dare attempt to do live-coding in front of live individuals? +Yes, even creating a series of yasnippets can result in some serious +embarrassment (and compiler errors) if you fat-finger any of the fields. + + Have no fear, just create a series of entries that contains calls to +‘demo-it-insert’, as this function inserts a string into the current +buffer as if you were typing it by hand (this is called by *note +demo-it-run-in-shell: demo-it-run-in-shell.). + + The following demo-it example uses this function as well as the def +yasnippet for Ruby and particular keystrokes to move from field to +field: + + (demo-it-create (find-file "foobar.rb") + (demo-it-insert "def") + (yas-expand) + (demo-it-insert "hello") + "TAB TAB" + (demo-it-insert "name") + "TAB" + (demo-it-insert "\"Hello, #{name}\"" :fast)) + + The optional ‘speed’ parameter is *note described above: Showing +Files. + + Note: The previous version of demo-it offered specialized feature for +inserting text where each string to entered was put in a hashmap, +‘demo-it-text-entries’, and the entries were inserted with calls to a +dedicated function, ‘demo-it-insert-text’. However, the above seems to +work just as well without a special function, so it has been deprecated +and removed. + + +File: demo-it.info, Node: Extra Functions, Next: Customization, Prev: Inserting Text, Up: Top + +Extra Functions +*************** + +The following are useful functions that don’t fit in the previous +sections, so consider this the _miscellaeous_ section. + +* Menu: + +* demo-it-end:: +* demo-it-step:: +* demo-it-restep:: +* demo-it-show-step:: +* demo-it-hide-mode-line:: +* demo-it-show-mode-line:: +* demo-it-title-screen:: +* demo-it-message-keybinding:: +* demo-it-highlight-dwim:: + + +File: demo-it.info, Node: demo-it-end, Next: demo-it-step, Up: Extra Functions + +demo-it-end +=========== + +Calling this command ends the current demonstration by disabling the +mode (see *note Demo Modes: Demo Modes.), resetting the values inflicted +on the presentation buffer as well as restoring the window arrangement +to their original glory before demo-it-start was called. + + +File: demo-it.info, Node: demo-it-step, Next: demo-it-restep, Prev: demo-it-end, Up: Extra Functions + +demo-it-step +============ + +This function is typically called by one of the *note Demo Modes: Demo +Modes. to execute the next step in the current demonstration. + + However, this function can be called to jump to a particular STEP by +specifying a step number to the optional parameter, ‘step’. This can +also be done with a prefix, e.g. C-6 to run the 6th step. + + Keep in mind that normally step functions expect a particular state +to be established, so calling this function to jump to a particular step +may not work as intended. + + Why yes, we do want to figure out a good mechanism for establishing a +state for each called step, but that be a wee-bit challenging. + + +File: demo-it.info, Node: demo-it-restep, Next: demo-it-show-step, Prev: demo-it-step, Up: Extra Functions + +demo-it-restep +============== + +Re-executes the previous step in the current demonstration. + + Note, this doesn’t handle the concept of the state of the Emacs +system, so calling this function interactively does not rewind and +re-executes, it just re-executes given the current Emacs state. + + +File: demo-it.info, Node: demo-it-show-step, Next: demo-it-hide-mode-line, Prev: demo-it-restep, Up: Extra Functions + +demo-it-show-step +================= + +Displays a message about the expected function (that is, the function +that _will be run_) during the next step. This can be useful when +you’ve lost your way, and ask yourself, How did I get here? + + Of course, you may ask yourself, How do I work this? +And you may ask yourself, Where is that large automobile? +And you may tell yourself, This is not my beautiful house! +And you may tell yourself, This is not my beautiful wife! + + +File: demo-it.info, Node: demo-it-hide-mode-line, Next: demo-it-show-mode-line, Prev: demo-it-show-step, Up: Extra Functions + +demo-it-hide-mode-line +====================== + +Hides the mode line for a current buffer. This is done by setting the +‘mode-line-format’ to ‘nil’, but also saves off the value so that it can +be restored by calling *note demo-it-show-mode-line: +demo-it-show-mode-line. + + +File: demo-it.info, Node: demo-it-show-mode-line, Next: demo-it-title-screen, Prev: demo-it-hide-mode-line, Up: Extra Functions + +demo-it-show-mode-line +====================== + +Shows the mode line of the current buffer, if it was previously hidden +with a call to *note demo-it-hide-mode-line: demo-it-hide-mode-line. + + +File: demo-it.info, Node: demo-it-title-screen, Next: demo-it-message-keybinding, Prev: demo-it-show-mode-line, Up: Extra Functions + +demo-it-title-screen +==================== + +Displays a file as the demonstration’s title, e.g. displayed with a +larger-than-life font without a mode line, etc. Typically, a +specially-formatted org-mode file would do the job, but any file, +including an image will work. + + The ‘size’ parameter specifies the text scale, which ignores the +*note demo-it–text-scale: demo-it--text-scale. customization setting and +defaults to :huge (or 5x your normal text font size). + + +File: demo-it.info, Node: demo-it-message-keybinding, Next: demo-it-highlight-dwim, Prev: demo-it-title-screen, Up: Extra Functions + +demo-it-message-keybinding +========================== + +When demonstrating Emacs features, you may want to display the keystroke +you type. Yes, you could (and probably should) use a package like +mwe-log-commands +(http://www.foldr.org/~michaelw/emacs/mwe-log-commands.el) by Michael +Weber, but you can’t really use that sort of feature with demo-it, as +you’d just log a bunch of spacebars bound to *note demo-it-step: +demo-it-step. + + What you really want is to display the key you _wanted_ to type. For +that, you’ll want to end your _step function_ with a call to +‘demo-it-message-keybinding’, as it will take two strings, where the +first one is the “key” and the other is a function or command that it +normally calls. + + For instance: + (defun my-demo/dired-a-directory () + "Opens a `dired' buffer on a particular directory. + This is a step function that I add to demo-it-create." + (dired (expand-file-name "~/work")) + (demo-it-message-keybinding "C-x d" "dired")) + + This sort of _step function_ would be added to demo-it-create as a +simple symbol, like: + (demo-it-create ;; :keybindings + ;; other functions and expressions + my-demo/dired-a-directory + ;; other functions and expressions + ) + + +File: demo-it.info, Node: demo-it-highlight-dwim, Prev: demo-it-message-keybinding, Up: Extra Functions + +demo-it-highlight-dwim +====================== + +Can use the fancy-narrow (https://github.com/Malabarba/fancy-narrow) +package to highlight a particular _section_. If the package is not +available, it simply _narrows_ to that area. If called interactively, +this highlights the region (if active) or the current function. + + If the first parameter, ‘type-or-fn’ is a string, this specifies the +name of a function to highlight. + + If it is a :line, then the next two parameters, ‘start’ and ‘end’ +specifies the beginning or ending lines. + + If it is :char, then ‘start’ and ‘end’ are exact buffer positions, +which you can determine by evaluating (‘M-;’) the following expression: + (kill-new (int-to-string (point))) + + If ‘type-or-fn’ is ‘nil’ and the region is active, highlight the +region. + + If none of the following match, simply select the function the point +is currently in. + + Note: While this function checks to see if the package is available +and loaded, it does not actually do the loading (or the installing of +the package), for that, you will need to do something like: + + (require 'fancy-narrow) + + +File: demo-it.info, Node: Customization, Next: Index, Prev: Extra Functions, Up: Top + +Appendix A Customization +************************ + +The following is a list of custom variables that can be set through the +standard Emacs customization feature (under the demo-it group). Note, +each custom value may be overridden with a magic symbol to the *note +demo-it-create: Step Types. macro or with a parameter to many functions. + +* Menu: + +* demo-it--keymap-mode-style:: +* demo-it--shell-or-eshell:: +* demo-it--open-windows:: +* demo-it--open-windows-size:: +* demo-it--text-scale:: +* demo-it--start-fullscreen:: +* demo-it--start-single-window:: +* demo-it--presentation-hide-mode-line:: +* demo-it--presentation-hide-org-markers:: +* demo-it--presentation-variable-width:: +* demo-it--presentation-hide-org-blocks:: +* demo-it--insert-text-speed:: + + +File: demo-it.info, Node: demo-it--keymap-mode-style, Next: demo-it--shell-or-eshell, Up: Customization + +demo-it–keymap-mode-style +========================= + +The keymap-specific minor mode to use when a demonstration starts. +Should either be set to the symbol, :simple-mode for using the space to +advance to next step and ‘q’ to exit the demonstration, or +:advanced-mode, where ‘F12’ advances. + + Defaults to :simple-mode + + This setting can be overridden by a keyword to demo-it-create: + • :simple-mode + • :advanced-mode + + +File: demo-it.info, Node: demo-it--shell-or-eshell, Next: demo-it--open-windows, Prev: demo-it--keymap-mode-style, Up: Customization + +demo-it–shell-or-eshell +======================= + +When opening up a shell, this customization value specifies whether it +should run the shell or eshell command. + + Should be set to one of the following keywords: + • :shell + • :eshell + + Defaults to :eshell + + This setting can be overridden by the following keywords to +demo-it-create macro: + • :use-eshell + • :use-shell + + +File: demo-it.info, Node: demo-it--open-windows, Next: demo-it--open-windows-size, Prev: demo-it--shell-or-eshell, Up: Customization + +demo-it–open-windows +==================== + +When opening side windows, split the frame on a particular side. Should +be set to one of the following keywords: + + • :above + • :below + • :left + • :right + + The keyword, :side is a synonym for :right. + + Defaults to :right + + This setting can be overridden by one of the following keywords +passed to demo-it-create: + • :windows-on-side + • :windows-on-right + • :windows-on-left + • :windows-below + • :windows-above + + +File: demo-it.info, Node: demo-it--open-windows-size, Next: demo-it--text-scale, Prev: demo-it--open-windows, Up: Customization + +demo-it–open-windows-size +========================= + +The size of side windows to open. This is the width if the window is +opened on one of the sides (:left or :right), or the height if the +window is opened :above or :below. + + Defaults to 80 + + +File: demo-it.info, Node: demo-it--text-scale, Next: demo-it--start-fullscreen, Prev: demo-it--open-windows-size, Up: Customization + +demo-it–text-scale +================== + +Sets the default text scale when opening files in side windows (see +*note demo-it–open-windows: demo-it--open-windows.). While this can be +set to an integer, it can also be set to one of the following keywords: + • :small, set to a text scale of -1 + • :normal, set to a text scale of 0 + • :medium, set to a text scale of 1 + • :large, set to a text scale of 2 + • :x-large, set to a text scale of 3 + • :xx-large, set to a text scale of 4 + • :huge, set to a text scale of 5 + + It defaults to :large (a text-scale-set value of 2). + + This customization value can be overridden with one of the following +keywords passed to demo-it-create: + • :text-small + • :text-normal + • :text-medium + • :text-large + • :text-x-large + • :text-xx-large + • :text-huge + + +File: demo-it.info, Node: demo-it--start-fullscreen, Next: demo-it--start-single-window, Prev: demo-it--text-scale, Up: Customization + +demo-it–start-fullscreen +======================== + +A boolean setting that if set to a non-nil value, demonstrations start +with the current frame in fullscreen mode. Defaults to false. + + This customization value can be overridden with :fullscreen keyword +passed to demo-it-create. + + +File: demo-it.info, Node: demo-it--start-single-window, Next: demo-it--presentation-hide-mode-line, Prev: demo-it--start-fullscreen, Up: Customization + +demo-it–start-single-window +=========================== + +A boolean setting that if non-nil, deletes other windows to start the +demonstration with a current buffer window being the only displayed +window. Defaults to t. + + This customization value can be overridden with :single-window +keyword passed to demo-it-create. + + +File: demo-it.info, Node: demo-it--presentation-hide-mode-line, Next: demo-it--presentation-hide-org-markers, Prev: demo-it--start-single-window, Up: Customization + +demo-it–presentation-hide-mode-line +=================================== + +If set to a nil value (_false_), the mode-line is hidden for any +presentation files (this doesn’t affect other files opened with the +*note demo-it-load-file: demo-it-load-file.). Defaults to t. + + This customization value can be overridden with either of the +following keywords passed to demo-it-create: + • :show-mode-line + • :hide-mode-line + + +File: demo-it.info, Node: demo-it--presentation-hide-org-markers, Next: demo-it--presentation-variable-width, Prev: demo-it--presentation-hide-mode-line, Up: Customization + +demo-it–presentation-hide-org-markers +===================================== + +If set to a non-nil value, surrounding asterisks, underlines and slashes +that define an ‘org-mode’ textual formats in a presentation are +displayed. Otherwise those characters hidden, even though the effects +of bolding and italics are still shown. Defaults to t. + + This customization value can be overridden with either of the +following keywords passed to demo-it-create: + • :show-org-markers + • :hide-org-markers + + +File: demo-it.info, Node: demo-it--presentation-variable-width, Next: demo-it--presentation-hide-org-blocks, Prev: demo-it--presentation-hide-org-markers, Up: Customization + +demo-it–presentation-variable-width +=================================== + +If set to a non-nil value, a _variable-width_ font is used when +displaying ‘org-mode’ presentation files, otherwise the standard +fixed-width font is used. Defaults to nil. + + This customization value can be overridden with either of the +following keywords passed to demo-it-create: + • :variable-width + • :fixed-width + + +File: demo-it.info, Node: demo-it--presentation-hide-org-blocks, Next: demo-it--insert-text-speed, Prev: demo-it--presentation-variable-width, Up: Customization + +demo-it–presentation-hide-org-blocks +==================================== + +If set to a non-nil value, the start and ending lines of ‘org-mode’ +blocks are shown during a presentation, otherwise these lines are +hidden, but the contents within the blocks are still shown. + + This currently only hides these lines: +#+BEGIN_SRC + ... +#+END_SRC + + Other surrounding header values, like #+HEADERS: may still be seen. + + This defaults to t, however, this customization value can be +overridden with either of the following keywords passed to +demo-it-create: + • :show-block-headers + • :hide-block-headers + + +File: demo-it.info, Node: demo-it--insert-text-speed, Prev: demo-it--presentation-hide-org-blocks, Up: Customization + +demo-it–insert-text-speed +========================= + +The functions, *note demo-it-run-in-shell: demo-it-run-in-shell, *note +demo-it-start-shell: demo-it-start-shell, and *note demo-it-insert: +Inserting Text, enters the text into the shell as if a human were typing +it. This value specifies the speed at which that text is inserted into +the shell. + + This can set to one of the following keywords: + • :instant to insert text with no delay + • :slow + • :medium + • :fast + + Defaults to :medium. + + This can also specify a tuple of two integer values for the random +number of milliseconds between those two values to delay before +inserting each character, for instance, the :medium delay has a lower +value of 30 milliseconds, and an upper delay of 500. + + +File: demo-it.info, Node: Index, Prev: Customization, Up: Top + +Index +***** + +For those of you trying to read this online, this index is generated and +only available within Emacs. If you are reading this from within Emacs, +well-done. + +[index] +* Menu: + +* Basic exmaple: Simple Example. (line 6) +* Defaults for advancing demo: demo-it--keymap-mode-style. + (line 6) +* demo-it--insert-text-speed: demo-it--insert-text-speed. + (line 6) +* demo-it--keymap-mode-style: demo-it--keymap-mode-style. + (line 6) +* demo-it--open-windows: demo-it--open-windows. (line 6) +* demo-it--open-windows-size: demo-it--open-windows-size. + (line 6) +* demo-it--presentation-hide-mode-line: demo-it--presentation-hide-mode-line. + (line 6) +* demo-it--presentation-hide-org-blocks: demo-it--presentation-hide-org-blocks. + (line 6) +* demo-it--presentation-hide-org-markers: demo-it--presentation-hide-org-markers. + (line 6) +* demo-it--presentation-variable-width: demo-it--presentation-variable-width. + (line 6) +* demo-it--shell-or-eshell: demo-it--shell-or-eshell. + (line 6) +* demo-it--start-fullscreen: demo-it--start-fullscreen. + (line 6) +* demo-it--start-single-window: demo-it--start-single-window. + (line 6) +* demo-it--text-scale: demo-it--text-scale. (line 6) +* demo-it-compare-files: demo-it-compare-files. (line 6) +* demo-it-create: Step Types. (line 6) +* demo-it-end: demo-it-end. (line 6) +* demo-it-hide-mode-line: demo-it-hide-mode-line. + (line 6) +* demo-it-highlight-dwim: demo-it-highlight-dwim. + (line 6) +* demo-it-how-mode-line: demo-it-show-mode-line. + (line 6) +* demo-it-insert: Inserting Text. (line 6) +* demo-it-load-fancy-file: demo-it-load-fancy-file. + (line 6) +* demo-it-load-file: demo-it-load-file. (line 6) +* demo-it-load-part-file: demo-it-load-part-file. + (line 6) +* demo-it-message-keybinding: demo-it-message-keybinding. + (line 6) +* demo-it-mode: demo-it-mode. (line 6) +* demo-it-mode-adv: demo-it-mode-adv. (line 6) +* demo-it-presentation: demo-it-presentation. (line 6) +* demo-it-presentation-advance: demo-it-presentation-advance. + (line 6) +* demo-it-presentation-highlight-phrase: demo-it-presentation-highlight-phrase. + (line 6) +* demo-it-presentation-quit: demo-it-presentation-quit. + (line 6) +* demo-it-presentation-return: demo-it-presentation-return. + (line 6) +* demo-it-presentation-return-noadvance: demo-it-presentation-return-noadvance. + (line 6) +* demo-it-restep: demo-it-restep. (line 6) +* demo-it-run-in-shell: demo-it-run-in-shell. (line 6) +* demo-it-show-image: demo-it-show-image. (line 6) +* demo-it-show-shell: demo-it-show-shell. (line 6) +* demo-it-show-step: demo-it-show-step. (line 6) +* demo-it-single-presentation: demo-it-single-presentation. + (line 6) +* demo-it-start: Running the Demo. (line 6) +* demo-it-start-shell: demo-it-start-shell. (line 6) +* demo-it-step: demo-it-step. (line 6) +* demo-it-title-screen: demo-it-title-screen. (line 6) +* Demonstration Begins: demo-it-title-screen. (line 6) +* Demonstration Behavior options: Demonstration Options. (line 6) +* Demonstration Customizations: Customization. (line 6) +* Demonstration with Only Presentation: demo-it-single-presentation. + (line 6) +* Ending Demonstration: demo-it-end. (line 6) +* Highlighting while showing side file: demo-it-load-fancy-file. + (line 6) +* Loading side files: demo-it-load-file. (line 6) +* Minor modes: Demo Modes. (line 6) +* Open Source License: Top. (line 6) +* Options for side files: Showing Files. (line 6) +* org-mode Presentations: Showing Presentations. (line 6) +* Parameters for demo-it-create: Step Types. (line 6) +* Presentations: demo-it-presentation. (line 6) +* Redoing Demo Step: demo-it-restep. (line 6) +* Shell Commands: Running Commands. (line 6) +* Show part of a file: demo-it-load-part-file. + (line 6) +* Showing Side Files: Showing Files. (line 6) +* Showing Two Files: demo-it-compare-files. (line 6) +* Showing what you type: demo-it-message-keybinding. + (line 6) +* Side Windows: demo-it--open-windows. (line 6) +* Side Windows Font Size: demo-it--text-scale. (line 6) +* Side Windows Size: demo-it--open-windows-size. + (line 6) +* Starting Demonstration: Running the Demo. (line 6) +* Text highlighting: demo-it-highlight-dwim. + (line 6) +* Typing in Shell: demo-it-run-in-shell. (line 6) +* Typing Text into Buffer: Inserting Text. (line 6) +* What step am I on?: demo-it-show-step. (line 6) + + + +Tag Table: +Node: Top777 +Node: Basics2927 +Node: Simple Example4362 +Node: Step Types5486 +Node: Demonstration Options6548 +Node: Running the Demo10652 +Node: Demo Modes11278 +Node: demo-it-mode12120 +Node: demo-it-mode-adv12690 +Node: Showing Presentations13178 +Node: demo-it-presentation13968 +Node: demo-it-presentation-quit15150 +Node: demo-it-presentation-return15414 +Node: demo-it-presentation-return-noadvance15766 +Node: demo-it-presentation-advance16267 +Node: demo-it-presentation-highlight-phrase18441 +Node: demo-it-single-presentation19176 +Node: Showing Files20255 +Node: demo-it-load-file21603 +Node: demo-it-load-part-file22283 +Node: demo-it-load-fancy-file22976 +Node: demo-it-show-image24284 +Node: demo-it-compare-files24647 +Node: Running Commands25074 +Node: demo-it-start-shell26167 +Node: demo-it-run-in-shell26790 +Node: demo-it-show-shell27335 +Node: Inserting Text27725 +Node: Extra Functions29346 +Node: demo-it-end29825 +Node: demo-it-step30206 +Node: demo-it-restep30995 +Node: demo-it-show-step31402 +Node: demo-it-hide-mode-line31995 +Node: demo-it-show-mode-line32404 +Node: demo-it-title-screen32727 +Node: demo-it-message-keybinding33341 +Node: demo-it-highlight-dwim34800 +Node: Customization36061 +Node: demo-it--keymap-mode-style36902 +Node: demo-it--shell-or-eshell37450 +Node: demo-it--open-windows37981 +Node: demo-it--open-windows-size38619 +Node: demo-it--text-scale39001 +Node: demo-it--start-fullscreen39987 +Node: demo-it--start-single-window40414 +Node: demo-it--presentation-hide-mode-line40895 +Node: demo-it--presentation-hide-org-markers41496 +Node: demo-it--presentation-variable-width42184 +Node: demo-it--presentation-hide-org-blocks42771 +Node: demo-it--insert-text-speed43553 +Node: Index44447 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/elpa/demo-it-20161103.1337/dir b/elpa/demo-it-20161103.1337/dir new file mode 100644 index 00000000..f3b3386f --- /dev/null +++ b/elpa/demo-it-20161103.1337/dir @@ -0,0 +1,18 @@ +This is the file .../info/dir, which contains the +topmost node of the Info hierarchy, called (dir)Top. +The first time you invoke Info you start off looking at this node. + +File: dir, Node: Top This is the top of the INFO tree + + This (the Directory node) gives a menu of major topics. + Typing "q" exits, "?" lists all Info commands, "d" returns here, + "h" gives a primer for first-timers, + "mEmacs" visits the Emacs manual, etc. + + In Emacs, you can click mouse button 2 on a menu item or cross reference + to select it. + +* Menu: + +Emacs +* Demo It: (demo-it). Demonstrations made and shown in Emacs. diff --git a/elpa/demo-it-readme.txt b/elpa/demo-it-readme.txt index 5e7ca920..3d6fcb70 100644 --- a/elpa/demo-it-readme.txt +++ b/elpa/demo-it-readme.txt @@ -5,41 +5,45 @@ - Presentations explaining the technologies - Source code ... correctly highlighted - Executing the code in Eshell ... or similar demonstration + - Test a new feature However, I don't want to fat-finger, mentally burp, or even delay the gratification while I type, so I predefine each "step" as an - Elisp function, and then have =demo-it= execute each function when I - hit the F6 key. + Elisp function or keyboard macro, and then have =demo-it= execute + each function when I hit either the SPACE key or the F12 key + (advanced minor mode). - Using the library is a three step process: + Using the library is a four step process: 1. Load the library in your own Elisp source code file 2. Create a collection of functions that "do things". - 3. Call the =demo-it-start= function with the ordered list of - functions. + 3. Create the ordered list of functions/steps with `demo-it-create' + 4. Start the demonstration with `demo-it-start' For instance: - (load-library "demo-it") ;; Load this library of functions + (require 'demo-it) ;; Load this library of functions - (defun my-demo/step-1 () - (delete-other-windows) - (demo/org-presentation "~/presentations/my-demo/demo-start.org")) + (defun dit-load-source-code () + "Load some source code in a side window." + (demo-it-presentation-advance) + (demo-it-load-fancy-file "example.py" :line 5 12 :side)) - (defun my-demo/step-2 () - (demo-it-load-file "~/Work/my-proj/src/my-proj.py") - (demo-it-presentation-return)) + (defun dit-run-code () + "Execute our source code in an Eshell buffer." + ;; Close other windows and advance the presentation: + (demo-it-presentation-return) + (demo-it-start-shell) + (demo-it-run-in-shell "python example.py Snoopy")) - (defun my-demo () - "My fabulous demonstration." - (interactive) - (demo-it-start (list - 'my-demo/step-1 - 'my-demo/step-2 - ;; ... - ))) + (demo-it-create :single-window :insert-slow :full-screen + (demo-it-title-screen "example-title.org") + (demo-it-presentation "example.org") + dit-load-source-code + dit-run-code + (demo-it-run-in-shell "exit" nil :instant)) - (my-demo) ;; Optionally start the demo when file is loaded. + (demo-it-start) Each "step" is a series of Elisp functions that "do things". While this package has a collection of helping functions, the steps