Commit c5d87135 authored by Eric S. Raymond's avatar Eric S. Raymond

(finder-compile-keywords) Treat nil in a path argument as $PWD.

(finder-by-keyword) Handle LFD as input gracefully.
parent d6292428
...@@ -79,42 +79,46 @@ ...@@ -79,42 +79,46 @@
Optional arguments are a list of Emacs Lisp directories to compile from; no Optional arguments are a list of Emacs Lisp directories to compile from; no
arguments compiles from `load-path'." arguments compiles from `load-path'."
(save-excursion (save-excursion
(find-file "finder-inf.el") (let ((processed nil))
(erase-buffer) (find-file "finder-inf.el")
(insert ";;; Don't edit this file. It's generated by finder.el\n\n") (erase-buffer)
(insert "\n(setq finder-package-info '(\n") (insert ";;; Don't edit this file. It's generated by finder.el\n\n")
(mapcar (insert "\n(setq finder-package-info '(\n")
(function (lambda (d) (mapcar
(mapcar (function
(function (lambda (f) (lambda (d)
(if (string-match "\\.el$" f) (mapcar
(let (summary keystart) (function
(save-excursion (lambda (f)
(set-buffer (get-buffer-create "*finder-scratch*")) (if (and (string-match "\\.el$" f) (not (member f processed)))
(erase-buffer) (let (summary keystart)
(insert-file-contents (setq processed (cons f processed))
(concat (file-name-as-directory d) f)) (save-excursion
(setq summary (lm-synopsis)) (set-buffer (get-buffer-create "*finder-scratch*"))
(setq keywords (lm-keywords))) (erase-buffer)
(insert (insert-file-contents
(format " (\"%s\"\n " f)) (concat (file-name-as-directory (or d ".")) f))
(prin1 summary (current-buffer)) (setq summary (lm-synopsis))
(insert (setq keywords (lm-keywords)))
"\n ") (insert
(setq keystart (point)) (format " (\"%s\"\n " f))
(insert (prin1 summary (current-buffer))
(if keywords (format "(%s)" keywords) "nil") (insert
")\n") "\n ")
(subst-char-in-region keystart (point) ?, ? ) (setq keystart (point))
) (insert
))) (if keywords (format "(%s)" keywords) "nil")
(directory-files (or d "."))) ")\n")
)) (subst-char-in-region keystart (point) ?, ? )
(or dirs load-path)) )
(insert "))\n\n(provide 'finder-inf)\n") )))
(kill-buffer "*finder-scratch*") (directory-files (or d ".")))
(basic-save-buffer) ))
)) (or dirs load-path))
(insert "))\n\n(provide 'finder-inf)\n")
(kill-buffer "*finder-scratch*")
(basic-save-buffer)
)))
;;; Now the retrieval code ;;; Now the retrieval code
...@@ -132,25 +136,29 @@ arguments compiles from `load-path'." ...@@ -132,25 +136,29 @@ arguments compiles from `load-path'."
(goto-char (point-min)) (goto-char (point-min))
(let (key (let (key
(known (mapcar (function (lambda (x) (car x))) finder-known-keywords))) (known (mapcar (function (lambda (x) (car x))) finder-known-keywords)))
(let ((key (intern (completing-read (let ((key (completing-read
"Package keyword: " "Package keyword: "
(vconcat known) (vconcat known)
(function (lambda (arg) (memq arg known))) (function (lambda (arg) (memq arg known)))
t)))) t))
id)
(erase-buffer) (erase-buffer)
(insert (if (equal key "")
"The following packages match the keyword `" (symbol-name key) "':\n\n") (delete-window (get-buffer-window "*Help*"))
(mapcar (setq id (intern key))
(function (lambda (x) (insert
(if (memq key (car (cdr (cdr x)))) "The following packages match the keyword `" key "':\n\n")
(progn (mapcar
(insert (car x)) (function (lambda (x)
(insert-at-column 16 (car (cdr x)) "\n") (if (memq id (car (cdr (cdr x))))
)) (progn
)) (insert (car x))
finder-package-info) (insert-at-column 16 (car (cdr x)) "\n")
(goto-char (point-min)) ))
))) ))
finder-package-info)
(goto-char (point-min))
))))
(provide 'finder) (provide 'finder)
......
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