diff options
| author | Juri Linkov | 2010-03-23 09:11:50 +0200 |
|---|---|---|
| committer | Juri Linkov | 2010-03-23 09:11:50 +0200 |
| commit | 75a3ff20abab33d759ab0d1eb2631778bcf82f86 (patch) | |
| tree | 3b2bc7adf7172c2c7f4afc2ed6ab6973fc2463ab | |
| parent | 814fb70858add5fffcedce54c13c53ba6bfa5548 (diff) | |
| download | emacs-75a3ff20abab33d759ab0d1eb2631778bcf82f86.tar.gz emacs-75a3ff20abab33d759ab0d1eb2631778bcf82f86.zip | |
* finder.el: Remove TODO tasks.
* info.el (Info-finder-find-node): Add node "all"
with all package info. Handle a list of multiple keywords
separated by comma.
(info-finder): In interactive use with a prefix argument,
use `completing-read-multiple' to read a list of keywords
separated by comma.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/finder.el | 6 | ||||
| -rw-r--r-- | lisp/info.el | 56 |
3 files changed, 57 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf6b4d3496f..77b970789ff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-03-23 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * finder.el: Remove TODO tasks. | ||
| 4 | |||
| 5 | * info.el (Info-finder-find-node): Add node "all" | ||
| 6 | with all package info. Handle a list of multiple keywords | ||
| 7 | separated by comma. | ||
| 8 | (info-finder): In interactive use with a prefix argument, | ||
| 9 | use `completing-read-multiple' to read a list of keywords | ||
| 10 | separated by comma. | ||
| 11 | |||
| 1 | 2010-03-23 Stefan Monnier <monnier@iro.umontreal.ca> | 12 | 2010-03-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 13 | ||
| 3 | Add a new completion style `substring'. | 14 | Add a new completion style `substring'. |
diff --git a/lisp/finder.el b/lisp/finder.el index 358c0a1fee2..2de8e2e01a7 100644 --- a/lisp/finder.el +++ b/lisp/finder.el | |||
| @@ -27,12 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | ;; This mode uses the Keywords library header to provide code-finding | 28 | ;; This mode uses the Keywords library header to provide code-finding |
| 29 | ;; services by keyword. | 29 | ;; services by keyword. |
| 30 | ;; | ||
| 31 | ;; Things to do: | ||
| 32 | ;; 1. Support multiple keywords per search. This could be extremely hairy; | ||
| 33 | ;; there doesn't seem to be any way to get completing-read to exit on | ||
| 34 | ;; an EOL with no substring pending, which is what we'd want to end the loop. | ||
| 35 | ;; 2. Search by string in synopsis line? | ||
| 36 | 30 | ||
| 37 | ;;; Code: | 31 | ;;; Code: |
| 38 | 32 | ||
diff --git a/lisp/info.el b/lisp/info.el index 4f9c5a0da71..df892d499dc 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -3362,7 +3362,8 @@ Build a menu of the possible matches." | |||
| 3362 | (insert (format "* %-14s %s.\n" | 3362 | (insert (format "* %-14s %s.\n" |
| 3363 | (concat (symbol-name keyword) "::") | 3363 | (concat (symbol-name keyword) "::") |
| 3364 | (cdr assoc))))) | 3364 | (cdr assoc))))) |
| 3365 | (cons '(unknown . "unknown keywords") | 3365 | (append '((all . "All package info") |
| 3366 | (unknown . "unknown keywords")) | ||
| 3366 | finder-known-keywords))) | 3367 | finder-known-keywords))) |
| 3367 | ((equal nodename "unknown") | 3368 | ((equal nodename "unknown") |
| 3368 | ;; Display unknown keywords | 3369 | ;; Display unknown keywords |
| @@ -3377,6 +3378,22 @@ Build a menu of the possible matches." | |||
| 3377 | (concat (symbol-name (car assoc)) "::") | 3378 | (concat (symbol-name (car assoc)) "::") |
| 3378 | (cdr assoc)))) | 3379 | (cdr assoc)))) |
| 3379 | (finder-unknown-keywords))) | 3380 | (finder-unknown-keywords))) |
| 3381 | ((equal nodename "all") | ||
| 3382 | ;; Display all package info. | ||
| 3383 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" | ||
| 3384 | Info-finder-file nodename)) | ||
| 3385 | (insert "Finder Package Info\n") | ||
| 3386 | (insert "*******************\n\n") | ||
| 3387 | (mapc (lambda (package) | ||
| 3388 | (insert (format "%s - %s\n" | ||
| 3389 | (format "*Note %s::" (nth 0 package)) | ||
| 3390 | (nth 1 package))) | ||
| 3391 | (insert "Keywords: " | ||
| 3392 | (mapconcat (lambda (keyword) | ||
| 3393 | (format "*Note %s::" (symbol-name keyword))) | ||
| 3394 | (nth 2 package) ", ") | ||
| 3395 | "\n\n")) | ||
| 3396 | finder-package-info)) | ||
| 3380 | ((string-match-p "\\.el\\'" nodename) | 3397 | ((string-match-p "\\.el\\'" nodename) |
| 3381 | ;; Display commentary section | 3398 | ;; Display commentary section |
| 3382 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" | 3399 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" |
| @@ -3401,6 +3418,7 @@ Build a menu of the possible matches." | |||
| 3401 | (buffer-string)))))) | 3418 | (buffer-string)))))) |
| 3402 | (t | 3419 | (t |
| 3403 | ;; Display packages that match the keyword | 3420 | ;; Display packages that match the keyword |
| 3421 | ;; or the list of keywords separated by comma. | ||
| 3404 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" | 3422 | (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" |
| 3405 | Info-finder-file nodename)) | 3423 | Info-finder-file nodename)) |
| 3406 | (insert "Finder Packages\n") | 3424 | (insert "Finder Packages\n") |
| @@ -3408,21 +3426,39 @@ Build a menu of the possible matches." | |||
| 3408 | (insert | 3426 | (insert |
| 3409 | "The following packages match the keyword `" nodename "':\n\n") | 3427 | "The following packages match the keyword `" nodename "':\n\n") |
| 3410 | (insert "* Menu:\n\n") | 3428 | (insert "* Menu:\n\n") |
| 3411 | (let ((id (intern nodename))) | 3429 | (let ((keywords |
| 3430 | (mapcar 'intern (if (string-match-p "," nodename) | ||
| 3431 | (split-string nodename ",[ \t\n]*" t) | ||
| 3432 | (list nodename))))) | ||
| 3412 | (mapc | 3433 | (mapc |
| 3413 | (lambda (x) | 3434 | (lambda (package) |
| 3414 | (when (memq id (cadr (cdr x))) | 3435 | (unless (memq nil (mapcar (lambda (k) (memq k (nth 2 package))) |
| 3436 | keywords)) | ||
| 3415 | (insert (format "* %-16s %s.\n" | 3437 | (insert (format "* %-16s %s.\n" |
| 3416 | (concat (car x) "::") | 3438 | (concat (nth 0 package) "::") |
| 3417 | (cadr x))))) | 3439 | (nth 1 package))))) |
| 3418 | finder-package-info))))) | 3440 | finder-package-info))))) |
| 3419 | 3441 | ||
| 3420 | ;;;###autoload | 3442 | ;;;###autoload |
| 3421 | (defun info-finder () | 3443 | (defun info-finder (&optional keywords) |
| 3422 | "Display descriptions of the keywords in the Finder virtual manual." | 3444 | "Display descriptions of the keywords in the Finder virtual manual. |
| 3423 | (interactive) | 3445 | In interactive use, a prefix argument directs this command to read |
| 3446 | a list of keywords separated by comma. After that, it displays a node | ||
| 3447 | with a list packages that contain all specified keywords." | ||
| 3448 | (interactive | ||
| 3449 | (when current-prefix-arg | ||
| 3450 | (require 'finder) | ||
| 3451 | (list | ||
| 3452 | (completing-read-multiple | ||
| 3453 | "Keywords (separated by comma): " | ||
| 3454 | (mapcar 'symbol-name (mapcar 'car (append finder-known-keywords | ||
| 3455 | (finder-unknown-keywords)))) | ||
| 3456 | nil t)))) | ||
| 3424 | (require 'finder) | 3457 | (require 'finder) |
| 3425 | (Info-find-node Info-finder-file "Top")) | 3458 | (if keywords |
| 3459 | (Info-find-node Info-finder-file (mapconcat 'identity keywords ", ")) | ||
| 3460 | (Info-find-node Info-finder-file "Top"))) | ||
| 3461 | |||
| 3426 | 3462 | ||
| 3427 | (defun Info-undefined () | 3463 | (defun Info-undefined () |
| 3428 | "Make command be undefined in Info." | 3464 | "Make command be undefined in Info." |