867
|
1 ;;; finder.el --- topic & keyword-based code finder
|
|
2
|
38359
29beb6347e09
(finder-insert-at-column): Also move to the next line if exactly at COLUMN.
Miles Bader <miles@gnu.org>
diff
changeset
|
3 ;; Copyright (C) 1992, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
|
867
|
4
|
|
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
|
|
6 ;; Created: 16 Jun 1992
|
|
7 ;; Version: 1.0
|
|
8 ;; Keywords: help
|
|
9
|
|
10 ;; This file is part of GNU Emacs.
|
|
11
|
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
13 ;; it under the terms of the GNU General Public License as published by
|
12244
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
867
|
15 ;; any later version.
|
|
16
|
|
17 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 ;; GNU General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
14169
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
25 ;; Boston, MA 02111-1307, USA.
|
867
|
26
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
27 ;;; Commentary:
|
867
|
28
|
|
29 ;; This mode uses the Keywords library header to provide code-finding
|
|
30 ;; services by keyword.
|
|
31 ;;
|
|
32 ;; Things to do:
|
|
33 ;; 1. Support multiple keywords per search. This could be extremely hairy;
|
|
34 ;; there doesn't seem to be any way to get completing-read to exit on
|
|
35 ;; an EOL with no substring pending, which is what we'd want to end the loop.
|
|
36 ;; 2. Search by string in synopsis line?
|
|
37 ;; 3. Function to check finder-package-info for unknown keywords.
|
|
38
|
|
39 ;;; Code:
|
|
40
|
|
41 (require 'lisp-mnt)
|
44105
|
42 ;; Use `load' rather than `require' so that it doesn't get loaded
|
|
43 ;; during byte-compilation (at which point it might be missing).
|
|
44 (load "finder-inf" nil t)
|
867
|
45
|
2996
|
46 ;; Local variable in finder buffer.
|
|
47 (defvar finder-headmark)
|
|
48
|
25622
|
49 ;; These are supposed to correspond to top-level customization groups,
|
|
50 ;; says rms.
|
867
|
51 (defvar finder-known-keywords
|
|
52 '(
|
2270
|
53 (abbrev . "abbreviation handling, typing shortcuts, macros")
|
33420
|
54 ;; Too specific:
|
5141
|
55 (bib . "code related to the `bib' bibliography processor")
|
11470
|
56 (c . "support for the C language and related languages")
|
867
|
57 (calendar . "calendar and time management support")
|
2247
|
58 (comm . "communications, networking, remote access to files")
|
22295
|
59 (convenience . "convenience features for faster editing")
|
5141
|
60 (data . "support editing files of data")
|
867
|
61 (docs . "support for Emacs documentation")
|
|
62 (emulations . "emulations of other editors")
|
|
63 (extensions . "Emacs Lisp language extensions")
|
5141
|
64 (faces . "support for multiple fonts")
|
33420
|
65 (files . "support for editing and manipulating files")
|
11454
|
66 (frames . "support for Emacs frames and window systems")
|
867
|
67 (games . "games, jokes and amusements")
|
|
68 (hardware . "support for interfacing with exotic hardware")
|
|
69 (help . "support for on-line help systems")
|
11454
|
70 (hypermedia . "support for links between text or other media types")
|
2996
|
71 (i18n . "internationalization and alternate character-set support")
|
867
|
72 (internal . "code for Emacs internals, build process, defaults")
|
|
73 (languages . "specialized modes for editing programming languages")
|
|
74 (lisp . "Lisp support, including Emacs Lisp")
|
|
75 (local . "code local to your site")
|
|
76 (maint . "maintenance aids for the Emacs development group")
|
|
77 (mail . "modes for electronic-mail handling")
|
5141
|
78 (matching . "various sorts of searching and matching")
|
|
79 (mouse . "mouse support")
|
25308
|
80 (multimedia . "images and sound support")
|
867
|
81 (news . "support for netnews reading and posting")
|
11454
|
82 (oop . "support for object-oriented programming")
|
|
83 (outlines . "support for hierarchical outlining")
|
867
|
84 (processes . "process, subshell, compilation, and job control support")
|
|
85 (terminals . "support for terminal types")
|
|
86 (tex . "code related to the TeX formatter")
|
|
87 (tools . "programming tools")
|
|
88 (unix . "front-ends/assistants for, or emulators of, UNIX features")
|
33420
|
89 ;; Not a custom group and not currently useful.
|
|
90 ;; (vms . "support code for vms")
|
867
|
91 (wp . "word processing")
|
|
92 ))
|
|
93
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
94 (defvar finder-mode-map nil)
|
9200
|
95 (or finder-mode-map
|
|
96 (let ((map (make-sparse-keymap)))
|
|
97 (define-key map " " 'finder-select)
|
|
98 (define-key map "f" 'finder-select)
|
20009
|
99 (define-key map [mouse-2] 'finder-mouse-select)
|
9200
|
100 (define-key map "\C-m" 'finder-select)
|
|
101 (define-key map "?" 'finder-summary)
|
|
102 (define-key map "q" 'finder-exit)
|
|
103 (define-key map "d" 'finder-list-keywords)
|
|
104 (setq finder-mode-map map)))
|
|
105
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
106
|
867
|
107 ;;; Code for regenerating the keyword list.
|
|
108
|
|
109 (defvar finder-package-info nil
|
|
110 "Assoc list mapping file names to description & keyword lists.")
|
|
111
|
|
112 (defun finder-compile-keywords (&rest dirs)
|
2996
|
113 "Regenerate the keywords association list into the file `finder-inf.el'.
|
24221
|
114 Optional arguments DIRS are a list of Emacs Lisp directories to compile from;
|
|
115 no arguments compiles from `load-path'."
|
867
|
116 (save-excursion
|
2228
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
117 (let ((processed nil))
|
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
118 (find-file "finder-inf.el")
|
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
119 (erase-buffer)
|
2247
|
120 (insert ";;; finder-inf.el --- keyword-to-package mapping\n")
|
38436
|
121 (insert ";; This file is part of GNU Emacs.\n")
|
2247
|
122 (insert ";; Keywords: help\n")
|
2457
|
123 (insert ";;; Commentary:\n")
|
|
124 (insert ";; Don't edit this file. It's generated by finder.el\n\n")
|
|
125 (insert ";;; Code:\n")
|
2228
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
126 (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>
diff
changeset
|
127 (mapcar
|
14599
|
128 (lambda (d)
|
21758
|
129 (when (file-exists-p (directory-file-name d))
|
|
130 (message "Directory %s" d)
|
|
131 (mapcar
|
24221
|
132 (lambda (f)
|
21758
|
133 (if (and (or (string-match "^[^=].*\\.el$" f)
|
|
134 ;; Allow compressed files also. Fixme:
|
|
135 ;; generalize this, especially for
|
|
136 ;; MS-DOG-type filenames.
|
|
137 (and (string-match "^[^=].*\\.el\\.\\(gz\\|Z\\)$" f)
|
|
138 (require 'jka-compr)))
|
|
139 ;; Ignore lock files.
|
|
140 (not (string-match "^.#" f))
|
|
141 (not (member f processed)))
|
|
142 (let (summary keystart keywords)
|
|
143 (setq processed (cons f processed))
|
|
144 (save-excursion
|
|
145 (set-buffer (get-buffer-create "*finder-scratch*"))
|
|
146 (buffer-disable-undo (current-buffer))
|
|
147 (erase-buffer)
|
|
148 (insert-file-contents
|
|
149 (concat (file-name-as-directory (or d ".")) f))
|
|
150 (setq summary (lm-synopsis))
|
|
151 (setq keywords (lm-keywords)))
|
|
152 (insert
|
|
153 (format " (\"%s\"\n "
|
|
154 (if (string-match "\\.\\(gz\\|Z\\)$" f)
|
24221
|
155 (file-name-sans-extension f)
|
21758
|
156 f)))
|
|
157 (prin1 summary (current-buffer))
|
|
158 (insert
|
|
159 "\n ")
|
|
160 (setq keystart (point))
|
|
161 (insert
|
|
162 (if keywords (format "(%s)" keywords) "nil")
|
|
163 ")\n")
|
|
164 (subst-char-in-region keystart (point) ?, ? )
|
|
165 )))
|
|
166 (directory-files (or d ".")))))
|
2228
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
167 (or dirs load-path))
|
30883
|
168 (insert "))\n
|
|
169 \(provide 'finder-inf)
|
|
170
|
|
171 ;;; Local Variables:
|
|
172 ;;; version-control: never
|
|
173 ;;; no-byte-compile: t
|
|
174 ;;; no-update-autoloads: t
|
|
175 ;;; End:
|
|
176 ;;; finder-inf.el ends here\n")
|
2228
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
177 (kill-buffer "*finder-scratch*")
|
2271
026941de1886
Make sure that when new keywords are compiled, we see them
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
178 (eval-current-buffer) ;; So we get the new keyword list immediately
|
14599
|
179 (basic-save-buffer))))
|
867
|
180
|
14669
|
181 (defun finder-compile-keywords-make-dist ()
|
|
182 "Regenerate `finder-inf.el' for the Emacs distribution."
|
17745
|
183 (apply 'finder-compile-keywords command-line-args-left)
|
|
184 (kill-emacs))
|
14669
|
185
|
867
|
186 ;;; Now the retrieval code
|
|
187
|
14599
|
188 (defun finder-insert-at-column (column &rest strings)
|
21805
|
189 "Insert, at column COLUMN, other args STRINGS."
|
38359
29beb6347e09
(finder-insert-at-column): Also move to the next line if exactly at COLUMN.
Miles Bader <miles@gnu.org>
diff
changeset
|
190 (if (>= (current-column) column) (insert "\n"))
|
21805
|
191 (move-to-column column t)
|
14599
|
192 (apply 'insert strings))
|
|
193
|
33420
|
194 (defvar finder-help-echo nil)
|
|
195
|
21805
|
196 (defun finder-mouse-face-on-line ()
|
33420
|
197 "Put `mouse-face' and `help-echo' properties on the previous line."
|
21805
|
198 (save-excursion
|
|
199 (previous-line 1)
|
33420
|
200 (unless finder-help-echo
|
|
201 (setq finder-help-echo
|
|
202 (let* ((keys1 (where-is-internal 'finder-select
|
|
203 finder-mode-map))
|
|
204 (keys (nconc (where-is-internal
|
|
205 'finder-mouse-select finder-mode-map)
|
|
206 keys1)))
|
|
207 (concat (mapconcat 'key-description keys ", ")
|
|
208 ": select item"))))
|
|
209 (add-text-properties
|
|
210 (line-beginning-position) (line-end-position)
|
|
211 '(mouse-face highlight
|
|
212 help-echo finder-help-echo))))
|
21805
|
213
|
28528
|
214 ;;;###autoload
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
215 (defun finder-list-keywords ()
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
216 "Display descriptions of the keywords in the Finder buffer."
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
217 (interactive)
|
18226
|
218 (if (get-buffer "*Finder*")
|
|
219 (pop-to-buffer "*Finder*")
|
18284
|
220 (pop-to-buffer (set-buffer (get-buffer-create "*Finder*")))
|
18226
|
221 (finder-mode)
|
|
222 (setq buffer-read-only nil)
|
|
223 (erase-buffer)
|
33420
|
224 (mapc
|
18226
|
225 (lambda (assoc)
|
|
226 (let ((keyword (car assoc)))
|
|
227 (insert (symbol-name keyword))
|
|
228 (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
|
21805
|
229 (finder-mouse-face-on-line)))
|
18226
|
230 finder-known-keywords)
|
|
231 (goto-char (point-min))
|
|
232 (setq finder-headmark (point))
|
|
233 (setq buffer-read-only t)
|
|
234 (set-buffer-modified-p nil)
|
|
235 (balance-windows)
|
|
236 (finder-summary)))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
237
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
238 (defun finder-list-matches (key)
|
18687
|
239 (pop-to-buffer (set-buffer (get-buffer-create "*Finder Category*")))
|
18226
|
240 (finder-mode)
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
241 (setq buffer-read-only nil)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
242 (erase-buffer)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
243 (let ((id (intern key)))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
244 (insert
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
245 "The following packages match the keyword `" key "':\n\n")
|
2996
|
246 (setq finder-headmark (point))
|
33420
|
247 (mapc
|
14599
|
248 (lambda (x)
|
|
249 (if (memq id (car (cdr (cdr x))))
|
|
250 (progn
|
|
251 (insert (car x))
|
21805
|
252 (finder-insert-at-column 16 (concat (nth 1 x) "\n"))
|
|
253 (finder-mouse-face-on-line))))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
254 finder-package-info)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
255 (goto-char (point-min))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
256 (forward-line)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
257 (setq buffer-read-only t)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
258 (set-buffer-modified-p nil)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
259 (shrink-window-if-larger-than-buffer)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
260 (finder-summary)))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
261
|
20264
|
262 (defun finder-find-library (library)
|
24221
|
263 "Search for file LIBRARY on `load-path'.
|
|
264 Try compressed versions if jka-compr is in use."
|
20264
|
265 (or (locate-library library t)
|
|
266 (if (rassq 'jka-compr-handler file-name-handler-alist)
|
|
267 (or (locate-library (concat library ".gz") t)
|
|
268 (locate-library (concat library ".Z") t)
|
|
269 ;; last resort for MS-DOG et al
|
|
270 (locate-library (concat library "z"))))))
|
|
271
|
28528
|
272 ;;;###autoload
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
273 (defun finder-commentary (file)
|
24221
|
274 "Display FILE's commentary section.
|
|
275 FILE should be in a form suitable for passing to `locate-library'."
|
|
276 (interactive "sLibrary name: ")
|
|
277 (let* ((str (lm-commentary (or (finder-find-library file)
|
|
278 (finder-find-library (concat file ".el"))
|
|
279 (error "Can't find library %s" file)))))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
280 (if (null str)
|
7943
|
281 (error "Can't find any Commentary section"))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
282 (pop-to-buffer "*Finder*")
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
283 (setq buffer-read-only nil)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
284 (erase-buffer)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
285 (insert str)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
286 (goto-char (point-min))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
287 (delete-blank-lines)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
288 (goto-char (point-max))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
289 (delete-blank-lines)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
290 (goto-char (point-min))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
291 (while (re-search-forward "^;+ ?" nil t)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
292 (replace-match "" nil nil))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
293 (goto-char (point-min))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
294 (setq buffer-read-only t)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
295 (set-buffer-modified-p nil)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
296 (shrink-window-if-larger-than-buffer)
|
26675
|
297 (finder-mode)
|
14599
|
298 (finder-summary)))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
299
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
300 (defun finder-current-item ()
|
2996
|
301 (if (and finder-headmark (< (point) finder-headmark))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
302 (error "No keyword or filename on this line")
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
303 (save-excursion
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
304 (beginning-of-line)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
305 (current-word))))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
306
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
307 (defun finder-select ()
|
21805
|
308 "Select item on current line in a finder buffer."
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
309 (interactive)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
310 (let ((key (finder-current-item)))
|
20009
|
311 (if (string-match "\\.el$" key)
|
|
312 (finder-commentary key)
|
|
313 (finder-list-matches key))))
|
|
314
|
|
315 (defun finder-mouse-select (event)
|
21805
|
316 "Select item in a finder buffer with the mouse."
|
20009
|
317 (interactive "e")
|
|
318 (save-excursion
|
21805
|
319 (set-buffer (window-buffer (posn-window (event-start event))))
|
|
320 (goto-char (posn-point (event-start event)))
|
|
321 (finder-select)))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
322
|
28528
|
323 ;;;###autoload
|
867
|
324 (defun finder-by-keyword ()
|
|
325 "Find packages matching a given keyword."
|
|
326 (interactive)
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
327 (finder-list-keywords))
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
328
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
329 (defun finder-mode ()
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
330 "Major mode for browsing package documentation.
|
2716
|
331 \\<finder-mode-map>
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
332 \\[finder-select] more help for the item on the current line
|
24221
|
333 \\[finder-exit] exit Finder mode and kill the Finder buffer."
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
334 (interactive)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
335 (use-local-map finder-mode-map)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
336 (set-syntax-table emacs-lisp-mode-syntax-table)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
337 (setq mode-name "Finder")
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
338 (setq major-mode 'finder-mode)
|
2996
|
339 (make-local-variable 'finder-headmark)
|
14599
|
340 (setq finder-headmark nil))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
341
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
342 (defun finder-summary ()
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
343 "Summarize basic Finder commands."
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
344 (interactive)
|
14313
|
345 (message "%s"
|
2716
|
346 (substitute-command-keys
|
21805
|
347 "\\<finder-mode-map>\\[finder-select] = select, \
|
|
348 \\[finder-mouse-select] = select, \\[finder-list-keywords] = to \
|
|
349 finder directory, \\[finder-exit] = quit, \\[finder-summary] = help")))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
350
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
351 (defun finder-exit ()
|
20264
|
352 "Exit Finder mode and kill the buffer."
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
353 (interactive)
|
20241
|
354 (or (one-window-p t)
|
|
355 (delete-window))
|
20009
|
356 ;; Can happen in either buffer -- kill each of the two that exists
|
20241
|
357 (and (get-buffer "*Finder*")
|
|
358 (kill-buffer "*Finder*"))
|
|
359 (and (get-buffer "*Finder Category*")
|
|
360 (kill-buffer "*Finder Category*")))
|
867
|
361
|
30883
|
362
|
867
|
363 (provide 'finder)
|
|
364
|
|
365 ;;; finder.el ends here
|