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