/[emacs]/emacs/lisp/finder.el
ViewVC logotype

Diff of /emacs/lisp/finder.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.49 by monnier, Fri Mar 22 23:27:35 2002 UTC revision 1.49.2.1 by miles, Fri Apr 4 06:20:05 2003 UTC
# Line 39  Line 39 
39  ;;; Code:  ;;; Code:
40    
41  (require 'lisp-mnt)  (require 'lisp-mnt)
42    (require 'find-func)                    ;for find-library(-suffixes)
43  ;; Use `load' rather than `require' so that it doesn't get loaded  ;; Use `load' rather than `require' so that it doesn't get loaded
44  ;; during byte-compilation (at which point it might be missing).  ;; during byte-compilation (at which point it might be missing).
45  (load "finder-inf" nil t)  (load "finder-inf" t t)
46    
47  ;; Local variable in finder buffer.  ;; Local variable in finder buffer.
48  (defvar finder-headmark)  (defvar finder-headmark)
# Line 109  Line 110 
110  (defvar finder-package-info nil  (defvar finder-package-info nil
111    "Assoc list mapping file names to description & keyword lists.")    "Assoc list mapping file names to description & keyword lists.")
112    
113    (defvar generated-finder-keywords-file "finder-inf.el"
114      "File \\[finder-compile-keywords] puts finder keywords into.")
115    
116  (defun finder-compile-keywords (&rest dirs)  (defun finder-compile-keywords (&rest dirs)
117    "Regenerate the keywords association list into the file `finder-inf.el'.    "Regenerate the keywords association list into `generated-finder-keywords-file'.
118  Optional arguments DIRS are a list of Emacs Lisp directories to compile from;  Optional arguments DIRS are a list of Emacs Lisp directories to compile from;
119  no arguments compiles from `load-path'."  no arguments compiles from `load-path'."
120    (save-excursion    (save-excursion
121      (let ((processed nil))      (let ((processed nil))
122        (find-file "finder-inf.el")        (find-file generated-finder-keywords-file)
123        (erase-buffer)        (erase-buffer)
124        (insert ";;; finder-inf.el --- keyword-to-package mapping\n")        (insert ";;; " (file-name-nondirectory generated-finder-keywords-file)
125                  " --- keyword-to-package mapping\n")
126        (insert ";; This file is part of GNU Emacs.\n")        (insert ";; This file is part of GNU Emacs.\n")
       (insert ";; Keywords: help\n")  
127        (insert ";;; Commentary:\n")        (insert ";;; Commentary:\n")
128        (insert ";; Don't edit this file.  It's generated by finder.el\n\n")        (insert ";; Don't edit this file.  It's generated by finder.el\n\n")
129        (insert ";;; Code:\n")        (insert ";;; Code:\n")
# Line 166  no arguments compiles from `load-path'." Line 170  no arguments compiles from `load-path'."
170              (directory-files (or d ".")))))              (directory-files (or d ".")))))
171         (or dirs load-path))         (or dirs load-path))
172        (insert "))\n        (insert "))\n
173  \(provide 'finder-inf)  \(provide '" (file-name-sans-extension
174                  (file-name-nondirectory generated-finder-keywords-file)) ")
175    
176  ;;; Local Variables:  ;;; Local Variables:
177  ;;; version-control: never  ;;; version-control: never
178  ;;; no-byte-compile: t  ;;; no-byte-compile: t
179  ;;; no-update-autoloads: t  ;;; no-update-autoloads: t
180  ;;; End:  ;;; End:
181  ;;; finder-inf.el ends here\n")  ;;; " (file-name-nondirectory generated-finder-keywords-file) " ends here\n")
182        (kill-buffer "*finder-scratch*")        (kill-buffer "*finder-scratch*")
183        (eval-current-buffer) ;; So we get the new keyword list immediately        (eval-current-buffer) ;; So we get the new keyword list immediately
184        (basic-save-buffer))))        (basic-save-buffer))))
# Line 259  no arguments compiles from `load-path'." Line 264  no arguments compiles from `load-path'."
264      (shrink-window-if-larger-than-buffer)      (shrink-window-if-larger-than-buffer)
265      (finder-summary)))      (finder-summary)))
266    
 (defun finder-find-library (library)  
   "Search for file LIBRARY on `load-path'.  
 Try compressed versions if jka-compr is in use."  
   (or (locate-library library t)  
       (if (rassq 'jka-compr-handler file-name-handler-alist)  
         (or (locate-library (concat library ".gz") t)  
             (locate-library (concat library ".Z") t)  
             ;; last resort for MS-DOG et al  
             (locate-library (concat library "z"))))))  
   
267  ;;;###autoload  ;;;###autoload
268  (defun finder-commentary (file)  (defun finder-commentary (file)
269    "Display FILE's commentary section.    "Display FILE's commentary section.
270  FILE should be in a form suitable for passing to `locate-library'."  FILE should be in a form suitable for passing to `locate-library'."
271    (interactive "sLibrary name: ")    (interactive
272    (let* ((str (lm-commentary (or (finder-find-library file)     (list
273                                   (finder-find-library (concat file ".el"))      (completing-read "Library name: "
274                                   (error "Can't find library %s" file)))))                       'locate-file-completion
275                         (cons (or find-function-source-path load-path)
276                               (find-library-suffixes)))))
277      (let* ((str (lm-commentary (find-library-name file))))
278      (if (null str)      (if (null str)
279          (error "Can't find any Commentary section"))          (error "Can't find any Commentary section"))
280      (pop-to-buffer "*Finder*")      ;; This used to use *Finder* but that would clobber the
281        ;; directory of categories.
282        (pop-to-buffer "*Finder-package*")
283      (setq buffer-read-only nil)      (setq buffer-read-only nil)
284      (erase-buffer)      (erase-buffer)
285      (insert str)      (insert str)

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.49.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26