+ (aset vector j temp))))
+
+(define-obsolete-function-alias 'shuffle-vector 'cookie-shuffle-vector "24.4")
+
+
+(defun cookie-apropos (regexp phrase-file &optional display)
+ "Return a list of all entries matching REGEXP from PHRASE-FILE.
+Interactively, uses `read-regexp' to read REGEXP.
+Interactively, PHRASE-FILE defaults to `cookie-file', unless that
+is nil or a prefix argument is used.
+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
+ cookie-file t cookie-file)
+ cookie-file) t))
+ (setq phrase-file (cookie-check-file phrase-file))
+ ;; Make sure phrases are loaded.
+ (cookie phrase-file)
+ (let* ((case-fold-search t)
+ (cookie-table-symbol (intern phrase-file cookie-cache))
+ (string-table (symbol-value cookie-table-symbol))
+ (matches nil))
+ (and (dotimes (i (length string-table) matches)
+ (and (string-match-p regexp (aref string-table i))
+ (setq matches (cons (aref string-table i) matches))))
+ (setq matches (sort matches 'string-lessp)))
+ (and display
+ (if matches
+ (let ((l matches))
+ (with-output-to-temp-buffer "*Cookie Apropos*"
+ (while l
+ (princ (car l))
+ (setq l (cdr l))
+ (and l (princ "\n\n")))
+ (help-print-return-message)))
+ (message "No matches found.")))
+ matches))
+
+
+(declare-function doctor-ret-or-read "doctor" (arg))
+
+(defun cookie-doctor (phrase-file)
+ "Feed cookie phrases from PHRASE-FILE to the doctor.
+Interactively, PHRASE-FILE defaults to `cookie-file', unless that
+is nil or a prefix argument is used."
+ (interactive (list (if (or current-prefix-arg (not cookie-file))
+ (read-file-name "Cookie file: " nil
+ cookie-file t cookie-file)
+ cookie-file)))
+ (setq phrase-file (cookie-check-file phrase-file))
+ (doctor) ; start the psychotherapy
+ (message "")
+ (switch-to-buffer "*doctor*")
+ (sit-for 0)
+ (while (not (input-pending-p))
+ (insert (cookie phrase-file))
+ (sit-for 0)
+ (doctor-ret-or-read 1)
+ (doctor-ret-or-read 1)))
+