comparison lisp/play/cookie1.el @ 71413:e04e474d258e

lisp/play/cookie1.el (cookie): Work properly when there's only one entry Revision: emacs@sv.gnu.org/emacs--devo--0--patch-323
author Miles Bader <miles@gnu.org>
date Wed, 21 Jun 2006 05:09:32 +0000
parents 836785857446
children f7702c5f335d 138ce2701550
comparison
equal deleted inserted replaced
71412:57311883b6e5 71413:e04e474d258e
1 ;;; cookie1.el --- retrieve random phrases from fortune cookie files 1 ;;; cookie1.el --- retrieve random phrases from fortune cookie files
2 2
3 ;; Copyright (C) 1993, 2002, 2003, 2004, 2005, 3 ;; Copyright (C) 1993, 2002, 2003, 2004, 2005, 2006,
4 ;; 2006 Free Software Foundation, Inc. 4 ;; 2006 Free Software Foundation, Inc.
5 5
6 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 6 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
7 ;; Maintainer: FSF 7 ;; Maintainer: FSF
8 ;; Keywords: games, extensions 8 ;; Keywords: games, extensions
73 "Return a random phrase from PHRASE-FILE. 73 "Return a random phrase from PHRASE-FILE.
74 When the phrase file is read in, display STARTMSG at the beginning 74 When the phrase file is read in, display STARTMSG at the beginning
75 of load, ENDMSG at the end." 75 of load, ENDMSG at the end."
76 (let ((cookie-vector (cookie-snarf phrase-file startmsg endmsg))) 76 (let ((cookie-vector (cookie-snarf phrase-file startmsg endmsg)))
77 (shuffle-vector cookie-vector) 77 (shuffle-vector cookie-vector)
78 (aref cookie-vector 1))) 78 (aref cookie-vector 0)))
79 79
80 ;;;###autoload 80 ;;;###autoload
81 (defun cookie-insert (phrase-file &optional count startmsg endmsg) 81 (defun cookie-insert (phrase-file &optional count startmsg endmsg)
82 "Insert random phrases from PHRASE-FILE; COUNT of them. 82 "Insert random phrases from PHRASE-FILE; COUNT of them.
83 When the phrase file is read in, display STARTMSG at the beginning 83 When the phrase file is read in, display STARTMSG at the beginning