yow.el 2.8 KB

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