# HG changeset patch # User Gerd Moellmann # Date 995881599 0 # Node ID 1e1aaf2dadee949bbd2d40bfef80bbff7c9aecdb # Parent fc69b74fa9ad006859f94a73830c1a506888fa42 *** empty log message *** diff -r fc69b74fa9ad -r 1e1aaf2dadee lisp/ChangeLog --- a/lisp/ChangeLog Mon Jul 23 09:44:34 2001 +0000 +++ b/lisp/ChangeLog Mon Jul 23 09:46:39 2001 +0000 @@ -13,29 +13,29 @@ * ediff-util.el: Copyright years. (ediff-choose-syntax-table): New function. (ediff-setup): Use ediff-choose-syntax-table. - (ediff-file-checked-out-p,ediff-file-checked-in-p): check if + (ediff-file-checked-out-p,ediff-file-checked-in-p): Check if vc-state is available. - (ediff-make-temp-file): use ediff-coding-system-for-write. + (ediff-make-temp-file): Use ediff-coding-system-for-write. * ediff-init.el (ediff-with-syntax-table): New macro, uses with-syntax-table. - (ediff-coding-system-for-read): from ediff-diff.el - (ediff-coding-system-for-write): new variable. - (ediff-highest-priority): fixed the bug having to do with disappearing + (ediff-coding-system-for-read): From ediff-diff.el + (ediff-coding-system-for-write): New variable. + (ediff-highest-priority): Fixed the bug having to do with disappearing overlays. - (ediff-file-remote-p): use file-remote-p, if available. - (ediff-listable-file): new function. - (ediff-file-attributes): use ediff-listable-file. + (ediff-file-remote-p): Use file-remote-p, if available. + (ediff-listable-file): New function. + (ediff-file-attributes): Use ediff-listable-file. - * ediff-mult.el (ediff-meta-insert-file-info1): use + * ediff-mult.el (ediff-meta-insert-file-info1): Use ediff-listable-file. - * ediff-ptch.el (ediff-prompt-for-patch-file): use + * ediff-ptch.el (ediff-prompt-for-patch-file): Use ediff-coding-system-for-read. - (ediff-patch-file-internal): use ediff-coding-system-for-write. + (ediff-patch-file-internal): Use ediff-coding-system-for-write. - * ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el. - (ediff-match-diff3-line,ediff-get-diff3-group): improved pattern. + * ediff-diff.el (ediff-coding-system-for-read): Moved to ediff-init.el. + (ediff-match-diff3-line,ediff-get-diff3-group): Improved pattern. * ediff.el: Date of last update, copyright years. @@ -48,40 +48,40 @@ Deleted functions. (viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new ex-token-list. - (viper-get-ex-address-subr): convert registers to char data type. + (viper-get-ex-address-subr): Convert registers to char data type. - * viper-util.el (viper-int-to-char,viper-char-equal): new + * viper-util.el (viper-int-to-char,viper-char-equal): New functions. - (viper-memq-char): use viper-int-to-char. - (viper-file-checked-in-p): use vc-locking-user, if vc doesn't have + (viper-memq-char): Use viper-int-to-char. + (viper-file-checked-in-p): Use vc-locking-user, if vc doesn't have vc-locking-state. - (viper-read-key): use viper-read-key-sequence. + (viper-read-key): Use viper-read-key-sequence. - * viper.el (viper-major-mode-modifier-list): added + * viper.el (viper-major-mode-modifier-list): Added inferior-emacs-lisp-mode. - (this-major-mode-requires-vi-state): new function that uses simple + (this-major-mode-requires-vi-state): New function that uses simple heuristics to decide if vi state is appropriate. - (set-viper-state-in-major-mode): use this-major-mode-requires-vi-state. - (viper-non-hook-settings): don't advise read-key-sequence. - (viper-read-key-sequence): new function that replaces the + (set-viper-state-in-major-mode): Use this-major-mode-requires-vi-state. + (viper-non-hook-settings): Don't advise read-key-sequence. + (viper-read-key-sequence): New function that replaces the previously used advice to read-key-sequence. - * viper-cmd.el (viper-test-com-defun,viper-exec-change, - viper-exec-Change,viper-execute-com,viper-insert,viper-append, - viper-Append,viper-Insert,viper-open-line,viper-Open-line, - viper-open-line-at-point,viper-substitute,viper-overwrite, - viper-replace-char-subr,viper-forward-word,viper-forward-Word): - got rid of the negative character hack. + * viper-cmd.el (viper-test-com-defun,viper-exec-change) + (viper-exec-Change,viper-execute-com,viper-insert,viper-append) + (viper-Append,viper-Insert,viper-open-line,viper-Open-line) + (viper-open-line-at-point,viper-substitute,viper-overwrite) + (viper-replace-char-subr,viper-forward-word,viper-forward-Word): + Got rid of the negative character hack. (viper-escape-to-state,viper-replace-state-exit-cmd): - use viper-read-key-sequence. - (viper-envelop-ESC-key): no need for ad-get-orig-definition. + Use viper-read-key-sequence. + (viper-envelop-ESC-key): No need for ad-get-orig-definition. (viper-minibuffer-standard-hook,viper-read-string-with-history): - don't override existing minibuffer-setup-hook. + Don't override existing minibuffer-setup-hook. (viper-mark-point,viper-goto-mark-subr,viper-brac-function): - convert registers to char data type. - (viper-autoindent): use viper-indent-line. + Convert registers to char data type. + (viper-autoindent): Use viper-indent-line. - * viper-keym.el: use viper-exec-key-in-emacs. + * viper-keym.el: Use viper-exec-key-in-emacs. 2001-07-20 Stefan Monnier diff -r fc69b74fa9ad -r 1e1aaf2dadee lisp/play/animate.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/play/animate.el Mon Jul 23 09:46:39 2001 +0000 @@ -0,0 +1,167 @@ +;;; animate.el --- make text dance + +;; Copyright (C) 2001 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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 2, or (at your option) +;; any later version. + +;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; (animate-string STRING VPOS &optional HPOS) +;; makes the string STRING appear starting at VPOS, HPOS +;; by having each letter swoop into place from random starting position. + +;; animate-birthday-present was the first application of this program. + +;;; Code: + +;;; STRING is the string to be displayed, +;;; and DEST-X, DEST-Y say where on the screen +;;; it should end up. + +;;; This function returns a list describing +;;; all the characters and the paths they should take. +;;; Each element has the form +;;; (CHAR START-Y START-X DEST-Y DEST-X). + +;;; The start position of each character is chosen randomly. +;;; The destination is chosen to put it in the right place +;;; in the string when the whole string finally reaches its +;;; specified position. + +(defun animate-initialize (string vpos hpos) + (let ((characters nil)) + (dotimes (i (length string)) + (setq characters + (cons (list (aref string i) + ;; Random starting positions. + (random (window-height)) + (random (1- (window-width))) + ;; All the chars should end up + ;; on the specified line. + vpos + ;; The Ith character in the string + ;; needs to end up I positions later. + (+ hpos i)) + characters))) + characters)) + +;;; Display the characters in CHARACTERS, +;;; each one FRACTION of the way from its start to its destination. +;;; If FRACTION is 0, the characters appear in their starting positions. +;;; If FRACTION is 1, the characters appear in their destinations. + +(defun animate-step (characters fraction) + (let ((remains (- 1 fraction))) + (dolist (item characters) + (let ((vpos (+ (* remains (nth 1 item)) + (* fraction (nth 3 item)))) + (hpos (+ (* remains (nth 2 item)) + (* fraction (nth 4 item))))) + (animate-place-char (car item) vpos hpos))))) + +;;; Place the character CHAR at position VPOS, HPOS in the current buffer. +(defun animate-place-char (char vpos hpos) + (goto-char (window-start)) + (let ((next-line-add-newlines t)) + (dotimes (i vpos) + (next-line 1))) + (beginning-of-line) + (move-to-column (floor hpos) t) + (unless (eolp) (delete-char 1)) + (insert-char char 1)) + +(defvar animate-n-steps 10 + "Number of steps to use `animate-string'.") + +;;;###autoload +(defun animate-string (string vpos &optional hpos) + "Display STRING starting at position VPOS, HPOS, using animation. +The characters start at randomly chosen places, +and all slide in parallel to their final positions, +passing through `animate-n-steps' positions before the final ones. +If HPOS is nil (or omitted), center the string horizontally +in the current window." + (let ((characters + (animate-initialize string vpos + (or hpos + ;; HPOS unspecified, so compute + ;; it so as to center the string. + (/ (- (window-width) (length string)) 2))))) + (dotimes (i animate-n-steps) + ;; Bind buffer-undo-list so it will be unchanged when we are done. + ;; (We're going to undo all our changes anyway.) + (let (buffer-undo-list + list-to-undo) + ;; Display the characters at the Ith position. + ;; This inserts them in the buffer. + (animate-step characters (/ i 1.0 animate-n-steps)) + ;; Make sure buffer is displayed starting at the beginning. + (set-window-start nil 1) + ;; Display it, and wait just a little while. + (sit-for .05) + ;; Now undo the changes we made in the buffer. + (setq list-to-undo buffer-undo-list) + (while list-to-undo + (let ((undo-in-progress t)) + (setq list-to-undo (primitive-undo 1 list-to-undo)))))) + ;; Insert the characters in their final positions. + (animate-step characters 1) + ;; Put the cursor at the end of the text on the line. + (end-of-line) + ;; Redisplay so they appear on the screen there. + (sit-for 0) + ;; This is so that the undo command, used afterwards, + ;; will undo the "animate" calls one by one. + (undo-boundary))) + +;;;###autoload +(defun animate-birthday-present () + "Display Sarah's birthday present." + (interactive) + ;; Make a suitable buffer to display the birthday present in. + (switch-to-buffer (get-buffer-create "Sarah")) + (erase-buffer) + ;; Display the empty buffer. + (sit-for 0) + ;; Make sure indentation does not use tabs. + ;; They would confuse things. + (setq indent-tabs-mode nil) + + (animate-string "Happy Birthday," 6) + (animate-string "Sarah" 7) + + (sit-for 1) + + (animate-string "You are my sunshine," 10 30) + (sit-for .5) + (animate-string "My only sunshine." 11 30) + (sit-for .5) + (animate-string "I'm awful sad that" 12 30) + (sit-for .5) + (animate-string "You've moved away." 13 30) + (sit-for .5) + (animate-string "Let's talk together" 15 30) + (sit-for .5) + (animate-string "And love more deeply." 16 30) + (sit-for .5) + (animate-string "Please bring back" 17 30) + (animate-string "my sunshine" 18 34) + (animate-string "to stay!" 19 34)) + +;;; animate.el ends here +