Mercurial > emacs
changeset 107391:78dd74750b2b
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.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Sun, 14 Mar 2010 23:28:52 +0200 |
parents | bb307bf2e752 |
children | a61767ff6672 e4adbc6451e9 |
files | lisp/ChangeLog lisp/finder.el lisp/info.el |
diffstat | 3 files changed, 48 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Mar 14 23:15:02 2010 +0200 +++ b/lisp/ChangeLog Sun Mar 14 23:28:52 2010 +0200 @@ -1,3 +1,12 @@ +2010-03-14 Juri Linkov <juri@jurta.org> + + 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. + 2010-03-14 Juri Linkov <juri@jurta.org> * finder.el (finder-compile-keywords): Replace `princ' with
--- a/lisp/finder.el Sun Mar 14 23:15:02 2010 +0200 +++ b/lisp/finder.el Sun Mar 14 23:28:52 2010 +0200 @@ -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 @@ '(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."
--- a/lisp/info.el Sun Mar 14 23:15:02 2010 +0200 +++ b/lisp/info.el Sun Mar 14 23:28:52 2010 +0200 @@ -3343,6 +3343,7 @@ (defvar finder-known-keywords) (defvar finder-package-info) (declare-function find-library-name "find-func" (library)) +(declare-function finder-unknown-keywords "finder" ()) (declare-function lm-commentary "lisp-mnt" (&optional file)) (defun Info-finder-find-node (filename nodename &optional no-going-back) @@ -3361,7 +3362,21 @@ (insert (format "* %-14s %s.\n" (concat (symbol-name keyword) "::") (cdr assoc))))) - finder-known-keywords)) + (cons '(unknown . "unknown keywords") + finder-known-keywords))) + ((equal nodename "unknown") + ;; Display unknown keywords + (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n" + Info-finder-file nodename)) + (insert "Finder Unknown Keywords\n") + (insert "***********************\n\n") + (insert "* Menu:\n\n") + (mapc + (lambda (assoc) + (insert (format "* %-14s %s.\n" + (concat (symbol-name (car assoc)) "::") + (cdr assoc)))) + (finder-unknown-keywords))) ((string-match-p "\\.el\\'" nodename) ;; Display commentary section (insert (format "\n\^_\nFile: %s, Node: %s, Up: Top\n\n"