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