summaryrefslogtreecommitdiff
path: root/lisp/finder.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2010-03-14 23:28:52 +0200
committerJuri Linkov <juri@jurta.org>2010-03-14 23:28:52 +0200
commit57938a7982e20e7d8b96171f19821876c98cb4dc (patch)
treec240deef8a85f75a80a646dd1e9e559e27a61531 /lisp/finder.el
parent88f4758e1c0051fb9c82630f3f816e4efb28b0b0 (diff)
downloademacs-57938a7982e20e7d8b96171f19821876c98cb4dc.tar.gz
Add finder unknown keywords.
* finder.el (finder-unknown-keywords): New function. * info.el (Info-finder-find-node): Use `finder-unknown-keywords' to create a Finder node with unknown keywords.
Diffstat (limited to 'lisp/finder.el')
-rw-r--r--lisp/finder.el24
1 files changed, 23 insertions, 1 deletions
diff --git a/lisp/finder.el b/lisp/finder.el
index b1e67908d1a..358c0a1fee2 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -33,7 +33,6 @@
;; there doesn't seem to be any way to get completing-read to exit on
;; an EOL with no substring pending, which is what we'd want to end the loop.
;; 2. Search by string in synopsis line?
-;; 3. Function to check finder-package-info for unknown keywords.
;;; Code:
@@ -230,6 +229,29 @@ no arguments compiles from `load-path'."
'(mouse-face highlight
help-echo finder-help-echo))))
+(defun finder-unknown-keywords ()
+ "Return an alist of unknown keywords and number of their occurences.
+Unknown are keywords that are present in `finder-package-info'
+but absent in `finder-known-keywords'."
+ (let ((unknown-keywords-hash (make-hash-table)))
+ ;; Prepare a hash where key is a keyword
+ ;; and value is the number of keyword occurences.
+ (mapc (lambda (package)
+ (mapc (lambda (keyword)
+ (unless (assq keyword finder-known-keywords)
+ (puthash keyword
+ (1+ (gethash keyword unknown-keywords-hash 0))
+ unknown-keywords-hash)))
+ (nth 2 package)))
+ finder-package-info)
+ ;; Make an alist from the hash and sort by the keyword name.
+ (sort (let (unknown-keywords-list)
+ (maphash (lambda (key value)
+ (push (cons key value) unknown-keywords-list))
+ unknown-keywords-hash)
+ unknown-keywords-list)
+ (lambda (a b) (string< (car a) (car b))))))
+
;;;###autoload
(defun finder-list-keywords ()
"Display descriptions of the keywords in the Finder buffer."