(apropos-zippy): New command.
(yow-load-message, yow-after-load-message): New constants. (yow, read-zippyism): Use them. Now KEN and BARBIE are PERMANENTLY ADDICTED to MIND-ALTERING DRUGS..
This commit is contained in:
parent
26a4a227ac
commit
6f579a691a
1 changed files with 43 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
;;; yow.el --- quote random zippyisms
|
;;; yow.el --- quote random zippyisms
|
||||||
|
|
||||||
;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
|
;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;; Maintainer: FSF
|
;; Maintainer: FSF
|
||||||
;; Author: Richard Mlynarik
|
;; Author: Richard Mlynarik
|
||||||
|
@ -37,12 +37,14 @@
|
||||||
(defvar yow-file (concat data-directory "yow.lines")
|
(defvar yow-file (concat data-directory "yow.lines")
|
||||||
"File containing pertinent pinhead phrases.")
|
"File containing pertinent pinhead phrases.")
|
||||||
|
|
||||||
|
(defconst yow-load-message "Am I CONSING yet?...")
|
||||||
|
(defconst yow-after-load-message "I have SEEN the CONSING!!")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun yow (&optional insert)
|
(defun yow (&optional insert)
|
||||||
"Return or display a random Zippy quotation. With prefix arg, insert it."
|
"Return or display a random Zippy quotation. With prefix arg, insert it."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((yow (cookie yow-file
|
(let ((yow (cookie yow-file yow-load-message yow-after-load-message)))
|
||||||
"Am I CONSING yet?..." "I have SEEN the CONSING!!")))
|
|
||||||
(cond (insert
|
(cond (insert
|
||||||
(insert yow))
|
(insert yow))
|
||||||
((not (interactive-p))
|
((not (interactive-p))
|
||||||
|
@ -61,8 +63,7 @@
|
||||||
(defsubst read-zippyism (prompt &optional require-match)
|
(defsubst read-zippyism (prompt &optional require-match)
|
||||||
"Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
|
"Read a Zippyism from the minibuffer with completion, prompting with PROMPT.
|
||||||
If optional second arg is non-nil, require input to match a completion."
|
If optional second arg is non-nil, require input to match a completion."
|
||||||
(read-cookie prompt yow-file
|
(read-cookie prompt yow-file yow-load-message yow-after-load-message
|
||||||
"Am I CONSING yet?..." "I have SEEN the CONSING!!"
|
|
||||||
require-match))
|
require-match))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
@ -70,11 +71,44 @@ If optional second arg is non-nil, require input to match a completion."
|
||||||
"Prompt with completion for a known Zippy quotation, and insert it at point."
|
"Prompt with completion for a known Zippy quotation, and insert it at point."
|
||||||
(interactive (list (read-zippyism "Pinhead wisdom: " t)))
|
(interactive (list (read-zippyism "Pinhead wisdom: " t)))
|
||||||
(insert zippyism))
|
(insert zippyism))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(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))
|
||||||
|
(matches nil)
|
||||||
|
(len (length string-table))
|
||||||
|
(i 0))
|
||||||
|
(save-match-data
|
||||||
|
(while (< i len)
|
||||||
|
(and (string-match regexp (aref string-table i))
|
||||||
|
(setq matches (cons (aref string-table i) matches)))
|
||||||
|
(setq i (1+ i))))
|
||||||
|
(and matches
|
||||||
|
(setq matches (sort matches 'string-lessp)))
|
||||||
|
(and (interactive-p)
|
||||||
|
(cond ((null matches)
|
||||||
|
(message "No matches found."))
|
||||||
|
(t
|
||||||
|
(let ((l matches))
|
||||||
|
(with-output-to-temp-buffer "*Zippy Apropos*"
|
||||||
|
(while l
|
||||||
|
(princ (car l))
|
||||||
|
(setq l (cdr l))
|
||||||
|
(and l (princ "\n\n"))))))))
|
||||||
|
matches))
|
||||||
|
|
||||||
|
|
||||||
; Yowza!! Feed zippy quotes to the doctor. Watch results.
|
;; Yowza!! Feed zippy quotes to the doctor. Watch results.
|
||||||
; fun, fun, fun. Entertainment for hours...
|
;; fun, fun, fun. Entertainment for hours...
|
||||||
;
|
;;
|
||||||
; written by Kayvan Aghaiepour
|
;; written by Kayvan Aghaiepour
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun psychoanalyze-pinhead ()
|
(defun psychoanalyze-pinhead ()
|
||||||
|
|
Loading…
Reference in a new issue