annotate lisp/games/yow.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 0293115a14e9
children b9518feda344
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
3 ;; Copyright (C) 1985, 1993, 1994 Free Software Foundation, Inc.
0
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
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 4
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 4
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 4
diff changeset
24 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
26 ;;; Synched up with: FSF 19.30.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; Important pinheadery for GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; See cookie1.el for implementation. Note --- the `n' argument of yow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; from the 18.xx implementation is no longer; we only support *random*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; random access now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (require 'cookie1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvar yow-file (concat data-directory "yow.lines")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
41 "File containing Pertinent Pinhead Phrases.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defun yow (&optional insert)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "Return or display a random Zippy quotation. With prefix arg, insert it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 (interactive "P")
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
47 (let ((yow (cookie
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
48 yow-file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
49 "Am I CONSING yet?..." "I have SEEN the CONSING!!")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (cond (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (insert yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ((not (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 yow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ((not (string-match "\n" yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (delete-windows-on (get-buffer-create "*Help*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (message "%s" yow))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (message "Yow!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (with-output-to-temp-buffer "*Help*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (princ yow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (set-buffer standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (help-mode)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (defun read-zippyism (prompt &optional require-match)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 If optional second arg is non-nil, require input to match a completion."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
68 (read-cookie prompt yow-file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
69 "Am I CONSING yet?..." "I have SEEN the CONSING!!"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 require-match))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun insert-zippyism (&optional zippyism)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Prompt with completion for a known Zippy quotation, and insert it at point."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (interactive (list (read-zippyism "Pinhead wisdom: " t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (insert zippyism))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
77 ; Yowza!! Feed zippy quotes to the doctor. Watch results.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
78 ; fun, fun, fun. Entertainment for hours...
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
79 ;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
80 ; written by Kayvan Aghaiepour
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun psychoanalyze-pinhead ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "Zippy goes to the analyst."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (doctor) ; start the psychotherapy
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
87 (message nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (switch-to-buffer "*doctor*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (sit-for 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (while (not (input-pending-p))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
91 (insert (yow))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (sit-for 0)
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 (doctor-ret-or-read 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (provide 'yow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;;; yow.el ends here