Function: cookie-apropos

cookie-apropos is an interactive and byte-compiled function defined in cookie1.el.gz.

Signature

(cookie-apropos REGEXP PHRASE-FILE &optional DISPLAY)

Documentation

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.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/play/cookie1.el.gz
(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))
    (dotimes (i (length string-table))
      (and (string-match-p regexp (aref string-table i))
           (setq matches (cons (aref string-table i) matches))))
    (and 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))