annotate lisp/finder.el @ 2345:91711632f474

* configure: Doc fix. * configure: Fix corrupted config_h_opts. * configure: Properly report option names in error messages. * configure: Properly recognize --x-includes and --x-libraries options. * configure: Fix syntax errors in code handling XFree386.
author Jim Blandy <jimb@redhat.com>
date Thu, 25 Mar 1993 01:14:34 +0000
parents 026941de1886
children 3d2f74e16e54
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; finder.el --- topic & keyword-based code finder
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
4
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
6 ;; Created: 16 Jun 1992
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
7 ;; Version: 1.0
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8 ;; Keywords: help
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; the Free Software Foundation; either version 1, or (at your option)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; any later version.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26 ;; Commentary:
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28 ;; This mode uses the Keywords library header to provide code-finding
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
29 ;; services by keyword.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30 ;;
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31 ;; Things to do:
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32 ;; 1. Support multiple keywords per search. This could be extremely hairy;
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
33 ;; there doesn't seem to be any way to get completing-read to exit on
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34 ;; an EOL with no substring pending, which is what we'd want to end the loop.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
35 ;; 2. Search by string in synopsis line?
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
36 ;; 3. Function to check finder-package-info for unknown keywords.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
37
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
38 ;;; Code:
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40 (require 'lisp-mnt)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
41 (require 'finder-inf)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42 (require 'picture)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
43
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
44 (defvar finder-known-keywords
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
45 '(
2270
a74fc62a3a1f Typo fix.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
46 (abbrev . "abbreviation handling, typing shortcuts, macros")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
47 (bib . "code related to the bib(1) bibliography processor")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
48 (c . "C and C++ language support")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49 (calendar . "calendar and time management support")
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2228
diff changeset
50 (comm . "communications, networking, remote access to files")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
51 (docs . "support for Emacs documentation")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
52 (emulations . "emulations of other editors")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
53 (extensions . "Emacs Lisp language extensions")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 (games . "games, jokes and amusements")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
55 (hardware . "support for interfacing with exotic hardware")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
56 (help . "support for on-line help systems")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
57 (i14n . "internationalization and alternate character-set support")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
58 (internal . "code for Emacs internals, build process, defaults")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (languages . "specialized modes for editing programming languages")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
60 (lisp . "Lisp support, including Emacs Lisp")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
61 (local . "code local to your site")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
62 (maint . "maintenance aids for the Emacs development group")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
63 (mail . "modes for electronic-mail handling")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
64 (news . "support for netnews reading and posting")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
65 (processes . "process, subshell, compilation, and job control support")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
66 (terminals . "support for terminal types")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
67 (tex . "code related to the TeX formatter")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 (tools . "programming tools")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
69 (unix . "front-ends/assistants for, or emulators of, UNIX features")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
70 (vms . "support code for vms")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
71 (wp . "word processing")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72 ))
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
74 ;;; Code for regenerating the keyword list.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
75
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
76 (defvar finder-package-info nil
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
77 "Assoc list mapping file names to description & keyword lists.")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
78
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
79 (defun finder-compile-keywords (&rest dirs)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
80 "Regenerate the keywords association list into the file finder-inf.el.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
81 Optional arguments are a list of Emacs Lisp directories to compile from; no
1475
2596132752ff Doc fix.
Christopher Zaborsky <rogue@erratum.com>
parents: 928
diff changeset
82 arguments compiles from `load-path'."
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
83 (save-excursion
2228
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
84 (let ((processed nil))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
85 (find-file "finder-inf.el")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
86 (erase-buffer)
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2228
diff changeset
87 (insert ";;; finder-inf.el --- keyword-to-package mapping\n")
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2228
diff changeset
88 (insert ";; Keywords: help\n")
2228
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
89 (insert ";;; Don't edit this file. It's generated by finder.el\n\n")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
90 (insert "\n(setq finder-package-info '(\n")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
91 (mapcar
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
92 (function
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
93 (lambda (d)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
94 (mapcar
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
95 (function
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
96 (lambda (f)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
97 (if (and (string-match "\\.el$" f) (not (member f processed)))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
98 (let (summary keystart)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
99 (setq processed (cons f processed))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
100 (save-excursion
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
101 (set-buffer (get-buffer-create "*finder-scratch*"))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
102 (erase-buffer)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
103 (insert-file-contents
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
104 (concat (file-name-as-directory (or d ".")) f))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
105 (setq summary (lm-synopsis))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
106 (setq keywords (lm-keywords)))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
107 (insert
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
108 (format " (\"%s\"\n " f))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
109 (prin1 summary (current-buffer))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
110 (insert
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
111 "\n ")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
112 (setq keystart (point))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
113 (insert
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
114 (if keywords (format "(%s)" keywords) "nil")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
115 ")\n")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
116 (subst-char-in-region keystart (point) ?, ? )
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
117 )
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
118 )))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
119 (directory-files (or d ".")))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
120 ))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
121 (or dirs load-path))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
122 (insert "))\n\n(provide 'finder-inf)\n")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
123 (kill-buffer "*finder-scratch*")
2271
026941de1886 Make sure that when new keywords are compiled, we see them
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2270
diff changeset
124 (eval-current-buffer) ;; So we get the new keyword list immediately
2228
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
125 (basic-save-buffer)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
126 )))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
127
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
128 ;;; Now the retrieval code
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
129
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
130 (defun finder-by-keyword ()
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
131 "Find packages matching a given keyword."
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
132 (interactive)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
133 (pop-to-buffer "*Help*")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
134 (erase-buffer)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
135 (mapcar
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
136 (function (lambda (x)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
137 (insert (symbol-name (car x)))
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
138 (insert-at-column 14 (cdr x) "\n")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
139 ))
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
140 finder-known-keywords)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
141 (goto-char (point-min))
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
142 (let (key
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
143 (known (mapcar (function (lambda (x) (car x))) finder-known-keywords)))
2228
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
144 (let ((key (completing-read
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
145 "Package keyword: "
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
146 (vconcat known)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
147 (function (lambda (arg) (memq arg known)))
2228
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
148 t))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
149 id)
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
150 (erase-buffer)
2228
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
151 (if (equal key "")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
152 (delete-window (get-buffer-window "*Help*"))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
153 (setq id (intern key))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
154 (insert
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
155 "The following packages match the keyword `" key "':\n\n")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
156 (mapcar
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
157 (function (lambda (x)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
158 (if (memq id (car (cdr (cdr x))))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
159 (progn
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
160 (insert (car x))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
161 (insert-at-column 16 (car (cdr x)) "\n")
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
162 ))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
163 ))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
164 finder-package-info)
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
165 (goto-char (point-min))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
166 ))))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
167
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
168 (provide 'finder)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
169
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
170 ;;; finder.el ends here