emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113122: Use cookie functions in yow


From: Glenn Morris
Subject: [Emacs-diffs] trunk r113122: Use cookie functions in yow
Date: Fri, 21 Jun 2013 16:00:15 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113122
revision-id: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2013-06-21 09:00:00 -0700
message:
  Use cookie functions in yow
  
  * play/cookie1.el (cookie-apropos): Add optional display argument.
  * obsolete/yow.el (apropos-zippy): Use cookie-apropos.
  (psychoanalyze-pinhead): Use cookie-doctor.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/obsolete/yow.el           yow.el-20091113204419-o5vbwnq5f7feedwu-103
  lisp/play/cookie1.el           cookie1.el-20091113204419-o5vbwnq5f7feedwu-559
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-06-21 15:30:53 +0000
+++ b/lisp/ChangeLog    2013-06-21 16:00:00 +0000
@@ -1,3 +1,9 @@
+2013-06-21  Glenn Morris  <address@hidden>
+
+       * play/cookie1.el (cookie-apropos): Add optional display argument.
+       * obsolete/yow.el (apropos-zippy): Use cookie-apropos.
+       (psychoanalyze-pinhead): Use cookie-doctor.
+
 2013-06-21  Juanma Barranquero  <address@hidden>
 
        * emacs-lisp/package.el (tar-get-file-descriptor)

=== modified file 'lisp/obsolete/yow.el'
--- a/lisp/obsolete/yow.el      2013-06-21 07:35:33 +0000
+++ b/lisp/obsolete/yow.el      2013-06-21 16:00:00 +0000
@@ -74,33 +74,7 @@
   "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 (called-interactively-p 'interactive)
-         (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")))
-                   (help-print-return-message))))))
-    matches))
+  (cookie-apropos regexp yow-file (called-interactively-p 'interactive)))
 
 
 ;; Yowza!! Feed zippy quotes to the doctor. Watch results.
@@ -114,15 +88,7 @@
 (defun psychoanalyze-pinhead ()
   "Zippy goes to the analyst."
   (interactive)
-  (doctor)                             ; start the psychotherapy
-  (message "")
-  (switch-to-buffer "*doctor*")
-  (sit-for 0)
-  (while (not (input-pending-p))
-    (insert (yow))
-    (sit-for 0)
-    (doctor-ret-or-read 1)
-    (doctor-ret-or-read 1)))
+  (cookie-doctor yow-file))
 
 (provide 'yow)
 

=== modified file 'lisp/play/cookie1.el'
--- a/lisp/play/cookie1.el      2013-06-21 07:35:33 +0000
+++ b/lisp/play/cookie1.el      2013-06-21 16:00:00 +0000
@@ -185,11 +185,11 @@
 (define-obsolete-function-alias 'shuffle-vector 'cookie-shuffle-vector "24.4")
 
 
-(defun cookie-apropos (regexp phrase-file)
+(defun cookie-apropos (regexp phrase-file &optional display)
   "Return a list of all entries matching REGEXP from PHRASE-FILE.
 Interactively, PHRASE-FILE defaults to `cookie-file', unless that
 is nil or a prefix argument is used.
-If called interactively, display a list of matches."
+If called interactively, or if DISPLAY is non-nil, display a list of matches."
   (interactive (list (read-regexp "Apropos phrase (regexp): ")
                     (if (or current-prefix-arg (not cookie-file))
                         (read-file-name "Cookie file: " nil
@@ -211,7 +211,7 @@
         (setq i (1+ i))))
     (and matches
          (setq matches (sort matches 'string-lessp)))
-    (and (called-interactively-p 'interactive)
+    (and (or display (called-interactively-p 'interactive))
          (cond ((null matches)
                 (message "No matches found."))
                (t


reply via email to

[Prev in Thread] Current Thread [Next in Thread]