annotate lisp/games/yow.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children b82b59fe008d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; yow.el --- quote random zippyisms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Author: Richard Mlynarik
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Keywords: games
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Synched up with: FSF 19.30.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; Important pinheadery for GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; See cookie1.el for implementation. Note --- the `n' argument of yow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; from the 18.xx implementation is no longer; we only support *random*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; random access now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (require 'cookie1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defvar yow-file (concat data-directory "yow.lines")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "File containing Pertinent Pinhead Phrases.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (defun yow (&optional insert)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 "Return or display a random Zippy quotation. With prefix arg, insert it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (let ((yow (cookie
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 yow-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "Am I CONSING yet?..." "I have SEEN the CONSING!!")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (cond (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (insert yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ((not (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 yow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ((not (string-match "\n" yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (delete-windows-on (get-buffer-create "*Help*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (message "%s" yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (message "Yow!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (with-output-to-temp-buffer "*Help*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (princ yow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (set-buffer standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (help-mode)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defun read-zippyism (prompt &optional require-match)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 If optional second arg is non-nil, require input to match a completion."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (read-cookie prompt yow-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 "Am I CONSING yet?..." "I have SEEN the CONSING!!"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 require-match))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defun insert-zippyism (&optional zippyism)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "Prompt with completion for a known Zippy quotation, and insert it at point."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (interactive (list (read-zippyism "Pinhead wisdom: " t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (insert zippyism))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ; Yowza!! Feed zippy quotes to the doctor. Watch results.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ; fun, fun, fun. Entertainment for hours...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ; written by Kayvan Aghaiepour
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (defun psychoanalyze-pinhead ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 "Zippy goes to the analyst."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (doctor) ; start the psychotherapy
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (message nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (switch-to-buffer "*doctor*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (sit-for 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (while (not (input-pending-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (insert (yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (sit-for 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (doctor-ret-or-read 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (doctor-ret-or-read 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (provide 'yow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;;; yow.el ends here