Commit 57938a79 authored by Juri Linkov's avatar Juri Linkov

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.
parent 88f4758e
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
......
......@@ -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."
......
......@@ -3343,6 +3343,7 @@ Build a menu of the possible matches."
(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 @@ Build a menu of the possible matches."
(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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment