867
|
1 ;;; finder.el --- topic & keyword-based code finder
|
|
2
|
24221
|
3 ;; Copyright (C) 1992, 1997, 1998, 1999 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)
|
|
42 (require 'finder-inf)
|
|
43
|
2996
|
44 ;; Local variable in finder buffer.
|
|
45 (defvar finder-headmark)
|
|
46
|
25622
|
47 ;; These are supposed to correspond to top-level customization groups,
|
|
48 ;; says rms.
|
867
|
49 (defvar finder-known-keywords
|
|
50 '(
|
2270
|
51 (abbrev . "abbreviation handling, typing shortcuts, macros")
|
5141
|
52 (bib . "code related to the `bib' bibliography processor")
|
11470
|
53 (c . "support for the C language and related languages")
|
867
|
54 (calendar . "calendar and time management support")
|
2247
|
55 (comm . "communications, networking, remote access to files")
|
22295
|
56 (convenience . "convenience features for faster editing")
|
5141
|
57 (data . "support editing files of data")
|
867
|
58 (docs . "support for Emacs documentation")
|
|
59 (emulations . "emulations of other editors")
|
|
60 (extensions . "Emacs Lisp language extensions")
|
5141
|
61 (faces . "support for multiple fonts")
|
11454
|
62 (frames . "support for Emacs frames and window systems")
|
867
|
63 (games . "games, jokes and amusements")
|
|
64 (hardware . "support for interfacing with exotic hardware")
|
|
65 (help . "support for on-line help systems")
|
11454
|
66 (hypermedia . "support for links between text or other media types")
|
2996
|
67 (i18n . "internationalization and alternate character-set support")
|
867
|
68 (internal . "code for Emacs internals, build process, defaults")
|
|
69 (languages . "specialized modes for editing programming languages")
|
|
70 (lisp . "Lisp support, including Emacs Lisp")
|
|
71 (local . "code local to your site")
|
|
72 (maint . "maintenance aids for the Emacs development group")
|
|
73 (mail . "modes for electronic-mail handling")
|
5141
|
74 (matching . "various sorts of searching and matching")
|
|
75 (mouse . "mouse support")
|
25308
|
76 (multimedia . "images and sound support")
|
867
|
77 (news . "support for netnews reading and posting")
|
11454
|
78 (oop . "support for object-oriented programming")
|
|
79 (outlines . "support for hierarchical outlining")
|
867
|
80 (processes . "process, subshell, compilation, and job control support")
|
|
81 (terminals . "support for terminal types")
|
|
82 (tex . "code related to the TeX formatter")
|
|
83 (tools . "programming tools")
|
|
84 (unix . "front-ends/assistants for, or emulators of, UNIX features")
|
|
85 (vms . "support code for vms")
|
|
86 (wp . "word processing")
|
|
87 ))
|
|
88
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
89 (defvar finder-mode-map nil)
|
9200
|
90 (or finder-mode-map
|
|
91 (let ((map (make-sparse-keymap)))
|
|
92 (define-key map " " 'finder-select)
|
|
93 (define-key map "f" 'finder-select)
|
20009
|
94 (define-key map [mouse-2] 'finder-mouse-select)
|
9200
|
95 (define-key map "\C-m" 'finder-select)
|
|
96 (define-key map "?" 'finder-summary)
|
|
97 (define-key map "q" 'finder-exit)
|
|
98 (define-key map "d" 'finder-list-keywords)
|
|
99 (setq finder-mode-map map)))
|
|
100
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
101
|
867
|
102 ;;; Code for regenerating the keyword list.
|
|
103
|
|
104 (defvar finder-package-info nil
|
|
105 "Assoc list mapping file names to description & keyword lists.")
|
|
106
|
|
107 (defun finder-compile-keywords (&rest dirs)
|
2996
|
108 "Regenerate the keywords association list into the file `finder-inf.el'.
|
24221
|
109 Optional arguments DIRS are a list of Emacs Lisp directories to compile from;
|
|
110 no arguments compiles from `load-path'."
|
867
|
111 (save-excursion
|
2228
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
112 (let ((processed nil))
|
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
113 (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
|
114 (erase-buffer)
|
2247
|
115 (insert ";;; finder-inf.el --- keyword-to-package mapping\n")
|
|
116 (insert ";; Keywords: help\n")
|
2457
|
117 (insert ";;; Commentary:\n")
|
|
118 (insert ";; Don't edit this file. It's generated by finder.el\n\n")
|
|
119 (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
|
120 (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
|
121 (mapcar
|
14599
|
122 (lambda (d)
|
21758
|
123 (when (file-exists-p (directory-file-name d))
|
|
124 (message "Directory %s" d)
|
|
125 (mapcar
|
24221
|
126 (lambda (f)
|
21758
|
127 (if (and (or (string-match "^[^=].*\\.el$" f)
|
|
128 ;; Allow compressed files also. Fixme:
|
|
129 ;; generalize this, especially for
|
|
130 ;; MS-DOG-type filenames.
|
|
131 (and (string-match "^[^=].*\\.el\\.\\(gz\\|Z\\)$" f)
|
|
132 (require 'jka-compr)))
|
|
133 ;; Ignore lock files.
|
|
134 (not (string-match "^.#" f))
|
|
135 (not (member f processed)))
|
|
136 (let (summary keystart keywords)
|
|
137 (setq processed (cons f processed))
|
|
138 (save-excursion
|
|
139 (set-buffer (get-buffer-create "*finder-scratch*"))
|
|
140 (buffer-disable-undo (current-buffer))
|
|
141 (erase-buffer)
|
|
142 (insert-file-contents
|
|
143 (concat (file-name-as-directory (or d ".")) f))
|
|
144 (setq summary (lm-synopsis))
|
|
145 (setq keywords (lm-keywords)))
|
|
146 (insert
|
|
147 (format " (\"%s\"\n "
|
|
148 (if (string-match "\\.\\(gz\\|Z\\)$" f)
|
24221
|
149 (file-name-sans-extension f)
|
21758
|
150 f)))
|
|
151 (prin1 summary (current-buffer))
|
|
152 (insert
|
|
153 "\n ")
|
|
154 (setq keystart (point))
|
|
155 (insert
|
|
156 (if keywords (format "(%s)" keywords) "nil")
|
|
157 ")\n")
|
|
158 (subst-char-in-region keystart (point) ?, ? )
|
|
159 )))
|
|
160 (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
|
161 (or dirs load-path))
|
30883
|
162 (insert "))\n
|
|
163 \(provide 'finder-inf)
|
|
164
|
|
165 ;;; Local Variables:
|
|
166 ;;; version-control: never
|
|
167 ;;; no-byte-compile: t
|
|
168 ;;; no-update-autoloads: t
|
|
169 ;;; End:
|
|
170 ;;; 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
|
171 (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
|
172 (eval-current-buffer) ;; So we get the new keyword list immediately
|
14599
|
173 (basic-save-buffer))))
|
867
|
174
|
14669
|
175 (defun finder-compile-keywords-make-dist ()
|
|
176 "Regenerate `finder-inf.el' for the Emacs distribution."
|
17745
|
177 (apply 'finder-compile-keywords command-line-args-left)
|
|
178 (kill-emacs))
|
14669
|
179
|
867
|
180 ;;; Now the retrieval code
|
|
181
|
14599
|
182 (defun finder-insert-at-column (column &rest strings)
|
21805
|
183 "Insert, at column COLUMN, other args STRINGS."
|
14599
|
184 (if (> (current-column) column) (insert "\n"))
|
21805
|
185 (move-to-column column t)
|
14599
|
186 (apply 'insert strings))
|
|
187
|
21805
|
188 (defun finder-mouse-face-on-line ()
|
|
189 "Put a `mouse-face' property on the previous line."
|
|
190 (save-excursion
|
|
191 (previous-line 1)
|
|
192 (put-text-property (save-excursion (beginning-of-line) (point))
|
|
193 (progn (end-of-line) (point))
|
|
194 'mouse-face 'highlight)))
|
|
195
|
28528
|
196 ;;;###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
|
197 (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
|
198 "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
|
199 (interactive)
|
18226
|
200 (if (get-buffer "*Finder*")
|
|
201 (pop-to-buffer "*Finder*")
|
18284
|
202 (pop-to-buffer (set-buffer (get-buffer-create "*Finder*")))
|
18226
|
203 (finder-mode)
|
|
204 (setq buffer-read-only nil)
|
|
205 (erase-buffer)
|
|
206 (mapcar
|
|
207 (lambda (assoc)
|
|
208 (let ((keyword (car assoc)))
|
|
209 (insert (symbol-name keyword))
|
|
210 (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
|
21805
|
211 (finder-mouse-face-on-line)))
|
18226
|
212 finder-known-keywords)
|
|
213 (goto-char (point-min))
|
|
214 (setq finder-headmark (point))
|
|
215 (setq buffer-read-only t)
|
|
216 (set-buffer-modified-p nil)
|
|
217 (balance-windows)
|
|
218 (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
|
219
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
220 (defun finder-list-matches (key)
|
18687
|
221 (pop-to-buffer (set-buffer (get-buffer-create "*Finder Category*")))
|
18226
|
222 (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
|
223 (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
|
224 (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
|
225 (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
|
226 (insert
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
227 "The following packages match the keyword `" key "':\n\n")
|
2996
|
228 (setq finder-headmark (point))
|
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
229 (mapcar
|
14599
|
230 (lambda (x)
|
|
231 (if (memq id (car (cdr (cdr x))))
|
|
232 (progn
|
|
233 (insert (car x))
|
21805
|
234 (finder-insert-at-column 16 (concat (nth 1 x) "\n"))
|
|
235 (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
|
236 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
|
237 (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
|
238 (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
|
239 (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
|
240 (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
|
241 (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
|
242 (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
|
243
|
20264
|
244 (defun finder-find-library (library)
|
24221
|
245 "Search for file LIBRARY on `load-path'.
|
|
246 Try compressed versions if jka-compr is in use."
|
20264
|
247 (or (locate-library library t)
|
|
248 (if (rassq 'jka-compr-handler file-name-handler-alist)
|
|
249 (or (locate-library (concat library ".gz") t)
|
|
250 (locate-library (concat library ".Z") t)
|
|
251 ;; last resort for MS-DOG et al
|
|
252 (locate-library (concat library "z"))))))
|
|
253
|
28528
|
254 ;;;###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
|
255 (defun finder-commentary (file)
|
24221
|
256 "Display FILE's commentary section.
|
|
257 FILE should be in a form suitable for passing to `locate-library'."
|
|
258 (interactive "sLibrary name: ")
|
|
259 (let* ((str (lm-commentary (or (finder-find-library file)
|
|
260 (finder-find-library (concat file ".el"))
|
|
261 (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
|
262 (if (null str)
|
7943
|
263 (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
|
264 (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
|
265 (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
|
266 (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
|
267 (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
|
268 (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
|
269 (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
|
270 (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
|
271 (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
|
272 (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
|
273 (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
|
274 (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
|
275 (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
|
276 (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
|
277 (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
|
278 (shrink-window-if-larger-than-buffer)
|
26675
|
279 (finder-mode)
|
14599
|
280 (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
|
281
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
282 (defun finder-current-item ()
|
2996
|
283 (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
|
284 (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
|
285 (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
|
286 (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
|
287 (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
|
288
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
289 (defun finder-select ()
|
21805
|
290 "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
|
291 (interactive)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
292 (let ((key (finder-current-item)))
|
20009
|
293 (if (string-match "\\.el$" key)
|
|
294 (finder-commentary key)
|
|
295 (finder-list-matches key))))
|
|
296
|
|
297 (defun finder-mouse-select (event)
|
21805
|
298 "Select item in a finder buffer with the mouse."
|
20009
|
299 (interactive "e")
|
|
300 (save-excursion
|
21805
|
301 (set-buffer (window-buffer (posn-window (event-start event))))
|
|
302 (goto-char (posn-point (event-start event)))
|
|
303 (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
|
304
|
28528
|
305 ;;;###autoload
|
867
|
306 (defun finder-by-keyword ()
|
|
307 "Find packages matching a given keyword."
|
|
308 (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
|
309 (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
|
310
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
311 (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
|
312 "Major mode for browsing package documentation.
|
2716
|
313 \\<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
|
314 \\[finder-select] more help for the item on the current line
|
24221
|
315 \\[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
|
316 (interactive)
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
317 (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
|
318 (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
|
319 (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
|
320 (setq major-mode 'finder-mode)
|
2996
|
321 (make-local-variable 'finder-headmark)
|
14599
|
322 (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
|
323
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
324 (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
|
325 "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
|
326 (interactive)
|
14313
|
327 (message "%s"
|
2716
|
328 (substitute-command-keys
|
21805
|
329 "\\<finder-mode-map>\\[finder-select] = select, \
|
|
330 \\[finder-mouse-select] = select, \\[finder-list-keywords] = to \
|
|
331 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
|
332
|
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
diff
changeset
|
333 (defun finder-exit ()
|
20264
|
334 "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
|
335 (interactive)
|
20241
|
336 (or (one-window-p t)
|
|
337 (delete-window))
|
20009
|
338 ;; Can happen in either buffer -- kill each of the two that exists
|
20241
|
339 (and (get-buffer "*Finder*")
|
|
340 (kill-buffer "*Finder*"))
|
|
341 (and (get-buffer "*Finder Category*")
|
|
342 (kill-buffer "*Finder Category*")))
|
867
|
343
|
30883
|
344
|
867
|
345 (provide 'finder)
|
|
346
|
|
347 ;;; finder.el ends here
|