Commit | Line | Data |
---|---|---|
8b2120f4 | 1 | ;;; yow.el --- quote random zippyisms |
6cf0d154 | 2 | |
ba318903 | 3 | ;; Copyright (C) 1993-1995, 2000-2014 Free Software Foundation, Inc. |
58142744 | 4 | |
34dc21db | 5 | ;; Maintainer: emacs-devel@gnu.org |
f6dd89c6 | 6 | ;; Author: Richard Mlynarik |
6251ee24 | 7 | ;; Keywords: games |
4e16ddf4 | 8 | ;; Obsolete-since: 24.4 |
76d7458e | 9 | |
a18d567f RS |
10 | ;; This file is part of GNU Emacs. |
11 | ||
b1fc2b50 | 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
a18d567f | 13 | ;; it under the terms of the GNU General Public License as published by |
b1fc2b50 GM |
14 | ;; the Free Software Foundation, either version 3 of the License, or |
15 | ;; (at your option) any later version. | |
a18d567f RS |
16 | |
17 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;; GNU General Public License for more details. | |
21 | ||
22 | ;; You should have received a copy of the GNU General Public License | |
b1fc2b50 | 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
a18d567f | 24 | |
6cf0d154 ER |
25 | ;;; Commentary: |
26 | ||
eb8c3be9 | 27 | ;; Important pinheadery for GNU Emacs. |
4e16ddf4 GM |
28 | ;; This file is obsolete. For similar functionality, see |
29 | ;; fortune.el and cookie1.el. | |
6cf0d154 ER |
30 | |
31 | ;;; Code: | |
32 | ||
269d869f | 33 | (require 'cookie1) |
ed73b256 | 34 | |
323f7c49 SE |
35 | (defgroup yow nil |
36 | "Quote random zippyisms." | |
37 | :prefix "yow-" | |
38 | :group 'games) | |
39 | ||
f53a85a9 | 40 | (defcustom yow-file (expand-file-name "yow.lines" data-directory) |
323f7c49 SE |
41 | "File containing pertinent pinhead phrases." |
42 | :type 'file | |
43 | :group 'yow) | |
a18d567f | 44 | |
6f579a69 NF |
45 | (defconst yow-load-message "Am I CONSING yet?...") |
46 | (defconst yow-after-load-message "I have SEEN the CONSING!!") | |
47 | ||
7229064d | 48 | ;;;###autoload |
b85b15f3 | 49 | (defun yow (&optional insert display) |
b6173cae | 50 | "Return or display a random Zippy quotation. With prefix arg, insert it." |
b85b15f3 | 51 | (interactive "P\np") |
6f579a69 | 52 | (let ((yow (cookie yow-file yow-load-message yow-after-load-message))) |
b6173cae RM |
53 | (cond (insert |
54 | (insert yow)) | |
b85b15f3 | 55 | ((not display) |
a18d567f | 56 | yow) |
a18d567f | 57 | (t |
1be14568 | 58 | (message "%s" yow))))) |
a18d567f | 59 | |
2694dfb9 RM |
60 | (defsubst read-zippyism (prompt &optional require-match) |
61 | "Read a Zippyism from the minibuffer with completion, prompting with PROMPT. | |
62 | If optional second arg is non-nil, require input to match a completion." | |
e7a526e3 | 63 | (cookie-read prompt yow-file yow-load-message yow-after-load-message |
2694dfb9 | 64 | require-match)) |
b6173cae RM |
65 | |
66 | ;;;###autoload | |
67 | (defun insert-zippyism (&optional zippyism) | |
68 | "Prompt with completion for a known Zippy quotation, and insert it at point." | |
69 | (interactive (list (read-zippyism "Pinhead wisdom: " t))) | |
70 | (insert zippyism)) | |
6f579a69 NF |
71 | |
72 | ;;;###autoload | |
73 | (defun apropos-zippy (regexp) | |
74 | "Return a list of all Zippy quotes matching REGEXP. | |
75 | If called interactively, display a list of matches." | |
76 | (interactive "sApropos Zippy (regexp): ") | |
cad5d1cb | 77 | (cookie-apropos regexp yow-file (called-interactively-p 'interactive))) |
6f579a69 | 78 | |
a18d567f | 79 | \f |
6f579a69 NF |
80 | ;; Yowza!! Feed zippy quotes to the doctor. Watch results. |
81 | ;; fun, fun, fun. Entertainment for hours... | |
82 | ;; | |
83 | ;; written by Kayvan Aghaiepour | |
a18d567f | 84 | |
004a00f4 DN |
85 | (declare-function doctor-ret-or-read "doctor" (arg)) |
86 | ||
7229064d | 87 | ;;;###autoload |
a18d567f RS |
88 | (defun psychoanalyze-pinhead () |
89 | "Zippy goes to the analyst." | |
90 | (interactive) | |
cad5d1cb | 91 | (cookie-doctor yow-file)) |
a18d567f | 92 | |
49116ac0 JB |
93 | (provide 'yow) |
94 | ||
76d7458e | 95 | ;;; yow.el ends here |