diff options
| author | Glenn Morris | 2013-06-21 20:37:18 -0400 |
|---|---|---|
| committer | Glenn Morris | 2013-06-21 20:37:18 -0400 |
| commit | 2663dd23eb43e9ebe20006f46feb6f410f13ac53 (patch) | |
| tree | 5d623e1abce6e94c32badbaf8d2893f7cff081f4 | |
| parent | 3d94f3ad819bb61ec54e8ed5b905aa28368b02eb (diff) | |
| download | emacs-2663dd23eb43e9ebe20006f46feb6f410f13ac53.tar.gz emacs-2663dd23eb43e9ebe20006f46feb6f410f13ac53.zip | |
* lisp/play/cookie1.el (cookie-apropos): Minor simplification.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/play/cookie1.el | 36 |
2 files changed, 17 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 223620b6f48..26cf6272289 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2013-06-22 Glenn Morris <rgm@fencepost.gnu.org> | 1 | 2013-06-22 Glenn Morris <rgm@fencepost.gnu.org> |
| 2 | 2 | ||
| 3 | * play/cookie1.el (cookie-apropos): Minor simplification. | ||
| 4 | |||
| 3 | * progmodes/gdb-mi.el (gdb-mapcar*): Remove, replace with cl-mapcar. | 5 | * progmodes/gdb-mi.el (gdb-mapcar*): Remove, replace with cl-mapcar. |
| 4 | 6 | ||
| 5 | 2013-06-22 Dmitry Gutov <dgutov@yandex.ru> | 7 | 2013-06-22 Dmitry Gutov <dgutov@yandex.ru> |
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." | |||
| 194 | (if (or current-prefix-arg (not cookie-file)) | 194 | (if (or current-prefix-arg (not cookie-file)) |
| 195 | (read-file-name "Cookie file: " nil | 195 | (read-file-name "Cookie file: " nil |
| 196 | cookie-file t cookie-file) | 196 | cookie-file t cookie-file) |
| 197 | cookie-file))) | 197 | cookie-file) t)) |
| 198 | (setq phrase-file (cookie-check-file phrase-file)) | 198 | (setq phrase-file (cookie-check-file phrase-file)) |
| 199 | ;; Make sure phrases are loaded. | 199 | ;; Make sure phrases are loaded. |
| 200 | (cookie phrase-file) | 200 | (cookie phrase-file) |
| 201 | (let* ((case-fold-search t) | 201 | (let* ((case-fold-search t) |
| 202 | (cookie-table-symbol (intern phrase-file cookie-cache)) | 202 | (cookie-table-symbol (intern phrase-file cookie-cache)) |
| 203 | (string-table (symbol-value cookie-table-symbol)) | 203 | (string-table (symbol-value cookie-table-symbol)) |
| 204 | (matches nil) | 204 | (matches nil)) |
| 205 | (len (length string-table)) | 205 | (and (dotimes (i (length string-table) matches) |
| 206 | (i 0)) | 206 | (and (string-match-p regexp (aref string-table i)) |
| 207 | (save-match-data | 207 | (setq matches (cons (aref string-table i) matches)))) |
| 208 | (while (< i len) | ||
| 209 | (and (string-match regexp (aref string-table i)) | ||
| 210 | (setq matches (cons (aref string-table i) matches))) | ||
| 211 | (setq i (1+ i)))) | ||
| 212 | (and matches | ||
| 213 | (setq matches (sort matches 'string-lessp))) | 208 | (setq matches (sort matches 'string-lessp))) |
| 214 | (and (or display (called-interactively-p 'interactive)) | 209 | (and display |
| 215 | (cond ((null matches) | 210 | (if matches |
| 216 | (message "No matches found.")) | 211 | (let ((l matches)) |
| 217 | (t | 212 | (with-output-to-temp-buffer "*Cookie Apropos*" |
| 218 | (let ((l matches)) | 213 | (while l |
| 219 | (with-output-to-temp-buffer "*Cookie Apropos*" | 214 | (princ (car l)) |
| 220 | (while l | 215 | (setq l (cdr l)) |
| 221 | (princ (car l)) | 216 | (and l (princ "\n\n"))) |
| 222 | (setq l (cdr l)) | 217 | (help-print-return-message))) |
| 223 | (and l (princ "\n\n"))) | 218 | (message "No matches found."))) |
| 224 | (help-print-return-message)))))) | ||
| 225 | matches)) | 219 | matches)) |
| 226 | 220 | ||
| 227 | 221 | ||