diff options
author | Glenn Morris <rgm@gnu.org> | 2013-06-21 20:37:18 -0400 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2013-06-21 20:37:18 -0400 |
commit | 2663dd23eb43e9ebe20006f46feb6f410f13ac53 (patch) | |
tree | 5d623e1abce6e94c32badbaf8d2893f7cff081f4 /lisp/play/cookie1.el | |
parent | 3d94f3ad819bb61ec54e8ed5b905aa28368b02eb (diff) | |
download | emacs-2663dd23eb43e9ebe20006f46feb6f410f13ac53.tar.gz |
* lisp/play/cookie1.el (cookie-apropos): Minor simplification.
Diffstat (limited to 'lisp/play/cookie1.el')
-rw-r--r-- | lisp/play/cookie1.el | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el index 0a53d8f4e61..d6b8e482071 100644 --- a/lisp/play/cookie1.el +++ b/lisp/play/cookie1.el @@ -194,34 +194,28 @@ If called interactively, or if DISPLAY is non-nil, display a list of matches." (if (or current-prefix-arg (not cookie-file)) (read-file-name "Cookie file: " nil cookie-file t cookie-file) - 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) - (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 + (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 (or display (called-interactively-p 'interactive)) - (cond ((null matches) - (message "No matches found.")) - (t - (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)))))) + (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)) |