annotate lisp/play/animate.el @ 72692:0b31ecee2604

* international/latexenc.el (latex-inputenc-coding-alist): Add cp858. * international/code-pages.el: Add cp858.
author Reiner Steib <Reiner.Steib@gmx.de>
date Thu, 07 Sep 2006 12:50:41 +0000
parents 836785857446
children e3694f1cb928 c5406394f567
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; animate.el --- make text dance
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
68634
836785857446 Update copyright notices of all files in the lisp/play directory.
Romain Francoise <romain@orebokech.com>
parents: 65680
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005,
836785857446 Update copyright notices of all files in the lisp/play directory.
Romain Francoise <romain@orebokech.com>
parents: 65680
diff changeset
4 ;; 2006 Free Software Foundation, Inc.
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
38626
6b570d0e1cf3 Add Keywords and Maintainer. Remove a
Gerd Moellmann <gerd@gnu.org>
parents: 38621
diff changeset
6 ;; Maintainer: Richard Stallman <rms@gnu.org>
6b570d0e1cf3 Add Keywords and Maintainer. Remove a
Gerd Moellmann <gerd@gnu.org>
parents: 38621
diff changeset
7 ;; Keywords: games
6b570d0e1cf3 Add Keywords and Maintainer. Remove a
Gerd Moellmann <gerd@gnu.org>
parents: 38621
diff changeset
8
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; any later version.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62249
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62249
diff changeset
24 ;; Boston, MA 02110-1301, USA.
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 ;; (animate-string STRING VPOS &optional HPOS)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;; makes the string STRING appear starting at VPOS, HPOS
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 ;; by having each letter swoop into place from random starting position.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31
38708
456acc0ad1ee Re-insert a reference to re-inserted function animate-birthday-present.
Pavel Janík <Pavel@Janik.cz>
parents: 38702
diff changeset
32 ;; animate-birthday-present was the first application of this program.
456acc0ad1ee Re-insert a reference to re-inserted function animate-birthday-present.
Pavel Janík <Pavel@Janik.cz>
parents: 38702
diff changeset
33
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 ;;; Code:
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 ;;; STRING is the string to be displayed,
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 ;;; and DEST-X, DEST-Y say where on the screen
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 ;;; it should end up.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 ;;; This function returns a list describing
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 ;;; all the characters and the paths they should take.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 ;;; Each element has the form
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 ;;; (CHAR START-Y START-X DEST-Y DEST-X).
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 ;;; The start position of each character is chosen randomly.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 ;;; The destination is chosen to put it in the right place
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 ;;; in the string when the whole string finally reaches its
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 ;;; specified position.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (defun animate-initialize (string vpos hpos)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 (let ((characters nil))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (dotimes (i (length string))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (setq characters
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (cons (list (aref string i)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 ;; Random starting positions.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (random (window-height))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (random (1- (window-width)))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 ;; All the chars should end up
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 ;; on the specified line.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 vpos
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 ;; The Ith character in the string
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 ;; needs to end up I positions later.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (+ hpos i))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 characters)))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 characters))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 ;;; Display the characters in CHARACTERS,
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 ;;; each one FRACTION of the way from its start to its destination.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 ;;; If FRACTION is 0, the characters appear in their starting positions.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 ;;; If FRACTION is 1, the characters appear in their destinations.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (defun animate-step (characters fraction)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (let ((remains (- 1 fraction)))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 (dolist (item characters)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (let ((vpos (+ (* remains (nth 1 item))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (* fraction (nth 3 item))))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (hpos (+ (* remains (nth 2 item))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (* fraction (nth 4 item)))))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (animate-place-char (car item) vpos hpos)))))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 ;;; Place the character CHAR at position VPOS, HPOS in the current buffer.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (defun animate-place-char (char vpos hpos)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (goto-char (window-start))
60537
0e6e83809df8 (animate-place-char): Use forward-line instead
Kim F. Storm <storm@cua.dk>
parents: 54102
diff changeset
84 (let (abbrev-mode)
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (dotimes (i vpos)
60537
0e6e83809df8 (animate-place-char): Use forward-line instead
Kim F. Storm <storm@cua.dk>
parents: 54102
diff changeset
86 (end-of-line)
0e6e83809df8 (animate-place-char): Use forward-line instead
Kim F. Storm <storm@cua.dk>
parents: 54102
diff changeset
87 (if (= (forward-line 1) 1)
0e6e83809df8 (animate-place-char): Use forward-line instead
Kim F. Storm <storm@cua.dk>
parents: 54102
diff changeset
88 (insert "\n"))))
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (beginning-of-line)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (move-to-column (floor hpos) t)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (unless (eolp) (delete-char 1))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (insert-char char 1))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (defvar animate-n-steps 10
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 "Number of steps to use `animate-string'.")
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 ;;;###autoload
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (defun animate-string (string vpos &optional hpos)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 "Display STRING starting at position VPOS, HPOS, using animation.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 The characters start at randomly chosen places,
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 and all slide in parallel to their final positions,
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 passing through `animate-n-steps' positions before the final ones.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 If HPOS is nil (or omitted), center the string horizontally
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 in the current window."
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (let ((characters
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (animate-initialize string vpos
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (or hpos
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 ;; HPOS unspecified, so compute
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 ;; it so as to center the string.
38621
7f4573a73075 (animate-string): Handle case that the string is
Gerd Moellmann <gerd@gnu.org>
parents: 38522
diff changeset
110 (max 0 (/ (- (window-width) (length string)) 2))))))
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (dotimes (i animate-n-steps)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 ;; Bind buffer-undo-list so it will be unchanged when we are done.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 ;; (We're going to undo all our changes anyway.)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (let (buffer-undo-list
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 list-to-undo)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 ;; Display the characters at the Ith position.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 ;; This inserts them in the buffer.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (animate-step characters (/ i 1.0 animate-n-steps))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 ;; Make sure buffer is displayed starting at the beginning.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (set-window-start nil 1)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 ;; Display it, and wait just a little while.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (sit-for .05)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 ;; Now undo the changes we made in the buffer.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (setq list-to-undo buffer-undo-list)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (while list-to-undo
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (let ((undo-in-progress t))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (setq list-to-undo (primitive-undo 1 list-to-undo))))))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 ;; Insert the characters in their final positions.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (animate-step characters 1)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 ;; Put the cursor at the end of the text on the line.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (end-of-line)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 ;; Redisplay so they appear on the screen there.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (sit-for 0)
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 ;; This is so that the undo command, used afterwards,
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 ;; will undo the "animate" calls one by one.
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (undo-boundary)))
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137
38702
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
138 ;;;###autoload
38783
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
139 (defun animate-sequence (list-of-strings space)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
140 "Display strings from LIST-OF-STRING with animation in a new buffer.
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
141 Strings will be separated from each other by SPACE lines."
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
142 (let ((vpos (/ (- (window-height)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
143 1 ;; For the mode-line
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
144 (* (1- (length list-of-strings)) space)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
145 (length list-of-strings))
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
146 2)))
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
147 (switch-to-buffer (get-buffer-create "*Animation*"))
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
148 (erase-buffer)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
149 (sit-for 0)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
150 (setq indent-tabs-mode nil)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
151 (while list-of-strings
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
152 (animate-string (car list-of-strings) vpos)
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
153 (setq vpos (+ vpos space 1))
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
154 (setq list-of-strings (cdr list-of-strings)))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38783
diff changeset
155
38783
255503bac5c2 (animate-string): Doc fix. Use a buffer
Gerd Moellmann <gerd@gnu.org>
parents: 38708
diff changeset
156 ;;;###autoload
54102
d0b60a164264 (animate-birthday-present): Accept other than `Sarah', too.
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
157 (defun animate-birthday-present (&optional name)
d0b60a164264 (animate-birthday-present): Accept other than `Sarah', too.
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
158 "Display one's birthday present in a new buffer.
d0b60a164264 (animate-birthday-present): Accept other than `Sarah', too.
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
159 You can specify the one's name by NAME; the default value is \"Sarah\"."
65680
ed770a0a7846 2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents: 64701
diff changeset
160 (interactive (list (read-string "Name (default Sarah): "
54102
d0b60a164264 (animate-birthday-present): Accept other than `Sarah', too.
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
161 nil nil "Sarah")))
38702
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
162 ;; Make a suitable buffer to display the birthday present in.
54102
d0b60a164264 (animate-birthday-present): Accept other than `Sarah', too.
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
163 (switch-to-buffer (get-buffer-create (format "*%s*" name)))
38702
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
164 (erase-buffer)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
165 ;; Display the empty buffer.
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
166 (sit-for 0)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
167 ;; Make sure indentation does not use tabs.
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
168 ;; They would confuse things.
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
169 (setq indent-tabs-mode nil)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
170
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
171 (animate-string "Happy Birthday," 6)
54102
d0b60a164264 (animate-birthday-present): Accept other than `Sarah', too.
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
172 (animate-string (format "%s" name) 7)
38702
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
173
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
174 (sit-for 1)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
175
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
176 (animate-string "You are my sunshine," 10 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
177 (sit-for .5)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
178 (animate-string "My only sunshine." 11 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
179 (sit-for .5)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
180 (animate-string "I'm awful sad that" 12 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
181 (sit-for .5)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
182 (animate-string "You've moved away." 13 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
183 (sit-for .5)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
184 (animate-string "Let's talk together" 15 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
185 (sit-for .5)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
186 (animate-string "And love more deeply." 16 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
187 (sit-for .5)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
188 (animate-string "Please bring back" 17 30)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
189 (animate-string "my sunshine" 18 34)
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
190 (animate-string "to stay!" 19 34))
dc644b0090f2 (animate-birthday-present): Re-insert.
Gerd Moellmann <gerd@gnu.org>
parents: 38626
diff changeset
191
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
192 ;;; arch-tag: 275289a3-6ac4-41da-b527-a1147045392f
38521
1e1aaf2dadee *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193 ;;; animate.el ends here