update.
[chise/xemacs-chise.git.1] / lisp / finder.el
index 4656b32..6124ce8 100644 (file)
@@ -78,41 +78,48 @@ directories to view or extract information from package source code.")
   `(
     (abbrev    . "abbreviation handling, typing shortcuts, macros")
     (bib       . "code related to the `bib' bibliography processor")
+    (build     . "code used to build XEmacs")
     (c         . "C, C++, and Objective-C language support")
     (calendar  . "calendar and time management support")
     (comm      . "communications, networking, remote access to files")
+    (content    . "contains content (menu/dialog box descs, text, images, &c)")
     (data      . "support for editing files of data")
-    (docs      . "support for Emacs documentation")
-    (dumped     . "files preloaded into Emacs")
+    (docs      . "support for XEmacs documentation")
+    (dumped     . "files preloaded into XEmacs")
     (emulations        . "emulations of other editors")
     (extensions        . "Emacs Lisp language extensions")
     (faces     . "support for multiple fonts")
-    (frames    . "support for Emacs frames and window systems")
+    (frames    . "support for XEmacs frames and window systems")
     (games     . "games, jokes and amusements")
+    (gui       . "support for menubars, dialog boxes, and other GUI features")
     (hardware  . "support for interfacing with exotic hardware")
     (help      . "support for on-line help systems")
     (hypermedia        . "support for links between text or other media types")
     (i18n      . "internationalization and alternate character-set support")
-    (internal  . "code for Emacs internals, build process, defaults")
+    (internal  . "code implementing core functionality in XEmacs")
     (languages . "specialized modes for editing programming languages")
     (lisp      . "Lisp support, including Emacs Lisp")
     (local     . "code local to your site")
-    (maint     . "maintenance aids for the Emacs development group")
     (mail      . "modes for electronic-mail handling")
+    (maint     . "maintenance aids for the Emacs development group")
     (matching  . "various sorts of searching and matching")
     (mouse     . "mouse support")
+    (mswin     . "support for anything running on MS Windows")
     ,(when (featurep 'mule)
        (cons 'mule "multi-language extensions"))
     (news      . "support for netnews reading and posting")
     (oop       . "support for object-oriented programming")
     (outlines  . "support for hierarchical outlining")
     (processes . "process, subshell, compilation, and job control support")
+    (services  . "provides services for use by other programs (cf `user')")
     (terminals . "support for terminal types")
     (tex       . "code related to the TeX formatter")
     (tools     . "programming tools")
     (unix      . "front-ends/assistants for, or emulators of, UNIX features")
+    (user      . "program interacts directly with the user (cf `services'")
     (vms       . "support code for vms")
     (wp                . "word processing")
+    (www       . "support for the Web (WWW, the World Wide Web)")
     ))
 
 (defvar finder-mode-map nil)
@@ -150,7 +157,9 @@ arguments compiles from `load-path'."
     (let ((processed nil)
          (directory-abbrev-alist
           (append
-           (mapcar (function (lambda (dir) (cons dir "")))
+           (mapcar (function (lambda (dir)
+                               (cons (concat "^" (regexp-quote dir))
+                                     "")))
                    finder-abbreviate-directory-list)
            directory-abbrev-alist))
          (using-load-path))
@@ -162,47 +171,44 @@ arguments compiles from `load-path'."
       (insert ";;; Commentary:\n")
       (insert ";; Don't edit this file.  It's generated by finder.el\n\n")
       (insert ";;; Code:\n")
-      (insert "\n(setq finder-package-info '(\n")
+      (insert "\n(defconst finder-package-info '(\n")
       (mapcar
-       (function
-       (lambda (d)
-         (mapcar
-          (function
-           (lambda (f) 
-             (if (not (member f processed))
-                 (let (summary keystart keywords)
-                   (setq processed (cons f processed))
-                   (if (not finder-compile-keywords-quiet)
-                       (message "Processing %s ..." f))
-                   (save-excursion
-                     (set-buffer (get-buffer-create "*finder-scratch*"))
-                     (buffer-disable-undo (current-buffer))
-                     (erase-buffer)
-                     (insert-file-contents (expand-file-name f d))
-                     (condition-case err
-                         (setq summary  (lm-synopsis)
-                               keywords (lm-keywords))
-                       (t (message "finder: error processing %s %S" f err))))
-                   (if (not summary)
-                       nil
-                     (insert (format "    (\"%s\"\n        " f))
-                     (prin1 summary (current-buffer))
-                     (insert "\n        ")
-                     (setq keystart (point))
-                     (insert (if keywords (format "(%s)" keywords) "nil"))
-                     (subst-char-in-region keystart (point) ?, ? )
-                     (insert "\n        ")
-                     (prin1 (abbreviate-file-name d) (current-buffer))
-                     (insert ")\n"))))))
-          ;;
-          ;; Skip null, non-existent or relative pathnames, e.g. "./", if
-          ;; using load-path, so that they do not interfere with a scan of
-          ;; library directories only.
-          (if (and using-load-path
-                   (not (and d (file-name-absolute-p d) (file-exists-p d))))
-              nil
-            (setq d (file-name-as-directory (or d ".")))
-            (directory-files d nil "^[^=].*\\.el$")))))
+       (lambda (d)
+        (mapcar
+         (lambda (f) 
+           (when (and (not (member f processed)) (file-readable-p f))
+             (let (summary keystart keywords)
+               (setq processed (cons f processed))
+               (if (not finder-compile-keywords-quiet)
+                   (message "Processing %s ..." f))
+               (save-excursion
+                 (set-buffer (get-buffer-create "*finder-scratch*"))
+                 (buffer-disable-undo (current-buffer))
+                 (erase-buffer)
+                 (insert-file-contents (expand-file-name f d))
+                 (condition-case err
+                     (setq summary  (lm-synopsis)
+                           keywords (lm-keywords))
+                   (t (message "finder: error processing %s %S" f err))))
+               (when summary
+                 (insert (format "    (\"%s\"\n        " f))
+                 (prin1 summary (current-buffer))
+                 (insert "\n        ")
+                 (setq keystart (point))
+                 (insert (if keywords (format "(%s)" keywords) "nil"))
+                 (subst-char-in-region keystart (point) ?, ? )
+                 (insert "\n        ")
+                 (prin1 (abbreviate-file-name d) (current-buffer))
+                 (insert ")\n")))))
+         ;;
+         ;; Skip null, non-existent or relative pathnames, e.g. "./", if
+         ;; using load-path, so that they do not interfere with a scan of
+         ;; library directories only.
+         (if (and using-load-path
+                  (not (and d (file-name-absolute-p d) (file-exists-p d))))
+             nil
+           (setq d (file-name-as-directory (or d ".")))
+           (directory-files d nil "^[^=].*\\.el$"))))
        dirs)
       (insert "))\n\n(provide 'finder-inf)\n\n;;; finder-inf.el ends here\n")
       (kill-buffer "*finder-scratch*")
@@ -281,15 +287,20 @@ arguments compiles from `load-path'."
          found)
       (while (and dirs (not found))
        (if (file-exists-p (expand-file-name (concat file ".el") (car dirs)))
-           (setq found (expand-file-name file (car dirs)))
+           (setq found (expand-file-name (concat file ".el") (car dirs)))
          (if (file-exists-p (expand-file-name file (car dirs)))
              (setq found (expand-file-name file (car dirs)))))
        (setq dirs (cdr dirs)))
       found)))
 
+;;;###autoload
 (defun finder-commentary (file)
-  (interactive)
-  (let* ((str (lm-commentary (finder-find-library file))))
+  "Display FILE's commentary section.
+FILE should be in a form suitable for passing to `locate-library'."
+  (interactive "sLibrary name: ")
+  (let* ((str (lm-commentary (or (finder-find-library file)
+                                (finder-find-library (concat file ".el"))
+                                (error "Can't find library %s" file)))))
     (if (null str)
        (error "Can't find any Commentary section"))
     (pop-to-buffer "*Finder*")
@@ -394,7 +405,7 @@ arguments compiles from `load-path'."
     "\\<finder-mode-map>\\[finder-select] = select, \\[finder-list-keywords] = keywords, \\[finder-edit] = edit, \\[finder-view] = view, \\[finder-exit] = quit, \\[finder-summary] = help")))
 
 (defun finder-exit ()
-  "Exit Finder mode and kill the buffer"
+  "Exit Finder mode and kill the buffer."
   (interactive)
   ;; XEmacs change
   (or (one-window-p t 0)