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