+;;; yow.el --- quote random zippyisms
+;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Author: Richard Mlynarik
+;; This file is part of XEmacs.
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;;; Synched up with: FSF 19.34.
+;; Important pinheadery for GNU Emacs.
+;; See cookie1.el for implementation. Note --- the `n' argument of yow
+;; from the 18.xx implementation is no longer; we only support *random*
+(defvar yow-file (locate-data-file "yow.lines")
+ "File containing pertinent Pinhead Phrases.")
+(defconst yow-load-message "Am I CONSING yet?...")
+(defconst yow-after-load-message "I have SEEN the CONSING!!")
+(defun yow (&optional insert)
+ "Return or display a random Zippy quotation. With prefix arg, insert it."
+ (let ((yow (cookie yow-file yow-load-message yow-after-load-message)))
+ ((not (string-match "\n" yow))
+ (delete-windows-on (get-buffer-create "*Help*"))
+ (with-output-to-temp-buffer "*Help*"
+ (set-buffer standard-output)
+(defun read-zippyism (prompt &optional require-match)
+ "Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
+If optional second arg is non-nil, require input to match a completion."
+ (read-cookie prompt yow-file yow-load-message yow-after-load-message
+(defun insert-zippyism (&optional zippyism)
+ "Prompt with completion for a known Zippy quotation, and insert it at point."
+ (interactive (list (read-zippyism "Pinhead wisdom: " t)))
+(defun apropos-zippy (regexp)
+ "Return a list of all Zippy quotes matching REGEXP.
+If called interactively, display a list of matches."
+ (interactive "sApropos Zippy (regexp): ")
+ ;; Make sure yows are loaded
+ (cookie yow-file yow-load-message yow-after-load-message)
+ (let* ((case-fold-search t)
+ (cookie-table-symbol (intern yow-file cookie-cache))
+ (string-table (symbol-value cookie-table-symbol))
+ (len (length string-table))
+ (and (string-match regexp (aref string-table i))
+ (setq matches (cons (aref string-table i) matches)))
+ (setq matches (sort matches 'string-lessp)))
+ (message "No matches found."))
+ (with-output-to-temp-buffer "*Zippy Apropos*"
+ (and l (princ "\n\n"))))))))
+;; Yowza!! Feed zippy quotes to the doctor. Watch results.
+;; fun, fun, fun. Entertainment for hours...
+;; written by Kayvan Aghaiepour
+(defun psychoanalyze-pinhead ()
+ "Zippy goes to the analyst."
+ (doctor) ; start the psychotherapy
+ (switch-to-buffer "*doctor*")
+ (while (not (input-pending-p))
+ (doctor-ret-or-read 1)))