Mercurial > emacs
annotate lisp/finder.el @ 63406:f7610876f0d3
(Function Debugging): Primitives can break on entry too.
author | Lute Kamstra <lute@gnu.org> |
---|---|
date | Tue, 14 Jun 2005 11:36:41 +0000 |
parents | b89461946700 |
children | 6fb026ad601f f042e7c0fe20 |
rev | line source |
---|---|
867 | 1 ;;; finder.el --- topic & keyword-based code finder |
2 | |
54572
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
3 ;; Copyright (C) 1992,97,98,1999,2001,2004 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>
parents:
2502
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) | |
47419
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
42 (require 'find-func) ;for find-library(-suffixes) |
44105
70f755b6a5c9
Don't load finder-inf.el during byte-compilation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
43 ;; Use `load' rather than `require' so that it doesn't get loaded |
70f755b6a5c9
Don't load finder-inf.el during byte-compilation.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
44 ;; during byte-compilation (at which point it might be missing). |
47825
3c21e01f4d87
("finder-inf"): Don't fail if the file is absent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47419
diff
changeset
|
45 (load "finder-inf" t t) |
867 | 46 |
52533
acdfe93d0ae8
(finder-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
47 (defvar finder-mode-hook nil |
acdfe93d0ae8
(finder-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
48 "*Hook run when function `finder-mode' is called.") |
acdfe93d0ae8
(finder-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
49 |
2996
358fe58ae153
(finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents:
2716
diff
changeset
|
50 ;; Local variable in finder buffer. |
358fe58ae153
(finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents:
2716
diff
changeset
|
51 (defvar finder-headmark) |
358fe58ae153
(finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents:
2716
diff
changeset
|
52 |
25622 | 53 ;; These are supposed to correspond to top-level customization groups, |
54 ;; says rms. | |
867 | 55 (defvar finder-known-keywords |
56 '( | |
2270 | 57 (abbrev . "abbreviation handling, typing shortcuts, macros") |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
58 ;; Too specific: |
5141
3efae588d663
(finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents:
3708
diff
changeset
|
59 (bib . "code related to the `bib' bibliography processor") |
11470
2958364d4d99
(finder-known-keywords): Generalize `c' keyword.
Richard M. Stallman <rms@gnu.org>
parents:
11454
diff
changeset
|
60 (c . "support for the C language and related languages") |
867 | 61 (calendar . "calendar and time management support") |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2228
diff
changeset
|
62 (comm . "communications, networking, remote access to files") |
22295
b2ceb0b98995
(finder-known-keywords): Fix `convenience' entry.
Dave Love <fx@gnu.org>
parents:
22129
diff
changeset
|
63 (convenience . "convenience features for faster editing") |
54483
b7f0abc3ce60
(finder-known-keywords): Fix data, tex, unix.
Juri Linkov <juri@jurta.org>
parents:
53501
diff
changeset
|
64 (data . "support for editing files of data") |
867 | 65 (docs . "support for Emacs documentation") |
66 (emulations . "emulations of other editors") | |
67 (extensions . "Emacs Lisp language extensions") | |
5141
3efae588d663
(finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents:
3708
diff
changeset
|
68 (faces . "support for multiple fonts") |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
69 (files . "support for editing and manipulating files") |
11454
d9ec5322d181
(finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
9200
diff
changeset
|
70 (frames . "support for Emacs frames and window systems") |
867 | 71 (games . "games, jokes and amusements") |
72 (hardware . "support for interfacing with exotic hardware") | |
73 (help . "support for on-line help systems") | |
11454
d9ec5322d181
(finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
9200
diff
changeset
|
74 (hypermedia . "support for links between text or other media types") |
2996
358fe58ae153
(finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents:
2716
diff
changeset
|
75 (i18n . "internationalization and alternate character-set support") |
867 | 76 (internal . "code for Emacs internals, build process, defaults") |
77 (languages . "specialized modes for editing programming languages") | |
78 (lisp . "Lisp support, including Emacs Lisp") | |
79 (local . "code local to your site") | |
80 (maint . "maintenance aids for the Emacs development group") | |
81 (mail . "modes for electronic-mail handling") | |
5141
3efae588d663
(finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents:
3708
diff
changeset
|
82 (matching . "various sorts of searching and matching") |
3efae588d663
(finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents:
3708
diff
changeset
|
83 (mouse . "mouse support") |
25308
8a92c65da346
(finder-known-keywords): Add `multimedia'.
Dave Love <fx@gnu.org>
parents:
24221
diff
changeset
|
84 (multimedia . "images and sound support") |
867 | 85 (news . "support for netnews reading and posting") |
11454
d9ec5322d181
(finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
9200
diff
changeset
|
86 (oop . "support for object-oriented programming") |
d9ec5322d181
(finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
9200
diff
changeset
|
87 (outlines . "support for hierarchical outlining") |
867 | 88 (processes . "process, subshell, compilation, and job control support") |
89 (terminals . "support for terminal types") | |
54483
b7f0abc3ce60
(finder-known-keywords): Fix data, tex, unix.
Juri Linkov <juri@jurta.org>
parents:
53501
diff
changeset
|
90 (tex . "supporting code for the TeX formatter") |
867 | 91 (tools . "programming tools") |
54483
b7f0abc3ce60
(finder-known-keywords): Fix data, tex, unix.
Juri Linkov <juri@jurta.org>
parents:
53501
diff
changeset
|
92 (unix . "front-ends/assistants for, or emulators of, UNIX-like features") |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
93 ;; Not a custom group and not currently useful. |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
94 ;; (vms . "support code for vms") |
867 | 95 (wp . "word processing") |
96 )) | |
97 | |
54572
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
98 (defvar finder-mode-map |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
99 (let ((map (make-sparse-keymap))) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
100 (define-key map " " 'finder-select) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
101 (define-key map "f" 'finder-select) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
102 (define-key map [mouse-2] 'finder-mouse-select) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
103 (define-key map "\C-m" 'finder-select) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
104 (define-key map "?" 'finder-summary) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
105 (define-key map "q" 'finder-exit) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
106 (define-key map "d" 'finder-list-keywords) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
107 map)) |
9200
e48652e64736
(finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents:
7943
diff
changeset
|
108 |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
109 |
867 | 110 ;;; Code for regenerating the keyword list. |
111 | |
112 (defvar finder-package-info nil | |
113 "Assoc list mapping file names to description & keyword lists.") | |
114 | |
48991
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
115 (defvar generated-finder-keywords-file "finder-inf.el" |
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
116 "File \\[finder-compile-keywords] puts finder keywords into.") |
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
117 |
867 | 118 (defun finder-compile-keywords (&rest dirs) |
48991
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
119 "Regenerate the keywords association list into `generated-finder-keywords-file'. |
24221
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
120 Optional arguments DIRS are a list of Emacs Lisp directories to compile from; |
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
121 no arguments compiles from `load-path'." |
867 | 122 (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
|
123 (let ((processed nil)) |
48991
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
124 (find-file generated-finder-keywords-file) |
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 (erase-buffer) |
48991
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
126 (insert ";;; " (file-name-nondirectory generated-finder-keywords-file) |
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
127 " --- keyword-to-package mapping\n") |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38359
diff
changeset
|
128 (insert ";; This file is part of GNU Emacs.\n") |
2457
3d2f74e16e54
Added or corrected documentation headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2271
diff
changeset
|
129 (insert ";;; Commentary:\n") |
3d2f74e16e54
Added or corrected documentation headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2271
diff
changeset
|
130 (insert ";; Don't edit this file. It's generated by finder.el\n\n") |
3d2f74e16e54
Added or corrected documentation headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2271
diff
changeset
|
131 (insert ";;; Code:\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
|
132 (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
|
133 (mapcar |
14599 | 134 (lambda (d) |
21758
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
135 (when (file-exists-p (directory-file-name d)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
136 (message "Directory %s" d) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
137 (mapcar |
24221
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
138 (lambda (f) |
21758
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
139 (if (and (or (string-match "^[^=].*\\.el$" f) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
140 ;; Allow compressed files also. Fixme: |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
141 ;; generalize this, especially for |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
142 ;; MS-DOG-type filenames. |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
143 (and (string-match "^[^=].*\\.el\\.\\(gz\\|Z\\)$" f) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
144 (require 'jka-compr))) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
145 ;; Ignore lock files. |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
146 (not (string-match "^.#" f)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
147 (not (member f processed))) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
148 (let (summary keystart keywords) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
149 (setq processed (cons f processed)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
150 (save-excursion |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
151 (set-buffer (get-buffer-create "*finder-scratch*")) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
152 (buffer-disable-undo (current-buffer)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
153 (erase-buffer) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
154 (insert-file-contents |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
155 (concat (file-name-as-directory (or d ".")) f)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
156 (setq summary (lm-synopsis)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
157 (setq keywords (lm-keywords))) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
158 (insert |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
159 (format " (\"%s\"\n " |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
160 (if (string-match "\\.\\(gz\\|Z\\)$" f) |
24221
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
161 (file-name-sans-extension f) |
21758
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
162 f))) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
163 (prin1 summary (current-buffer)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
164 (insert |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
165 "\n ") |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
166 (setq keystart (point)) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
167 (insert |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
168 (if keywords (format "(%s)" keywords) "nil") |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
169 ")\n") |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
170 (subst-char-in-region keystart (point) ?, ? ) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
171 ))) |
bc7f520d8251
(finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents:
20264
diff
changeset
|
172 (directory-files (or d "."))))) |
2228
d40154ca6354
(finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1475
diff
changeset
|
173 (or dirs load-path)) |
30883
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
174 (insert "))\n |
48991
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
175 \(provide '" (file-name-sans-extension |
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
176 (file-name-nondirectory generated-finder-keywords-file)) ") |
30883
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
177 |
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
178 ;;; Local Variables: |
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
179 ;;; version-control: never |
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
180 ;;; no-byte-compile: t |
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
181 ;;; no-update-autoloads: t |
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
182 ;;; End: |
48991
d3a44c8bd8d2
* finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents:
48688
diff
changeset
|
183 ;;; " (file-name-nondirectory generated-finder-keywords-file) " ends here\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
|
184 (kill-buffer "*finder-scratch*") |
62459
b89461946700
Replace `eval-current-buffer' by `eval-buffer'.
Juanma Barranquero <lekktu@gmail.com>
parents:
60746
diff
changeset
|
185 (eval-buffer) ;; So we get the new keyword list immediately |
14599 | 186 (basic-save-buffer)))) |
867 | 187 |
14669
6feeb4e59815
(finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14599
diff
changeset
|
188 (defun finder-compile-keywords-make-dist () |
6feeb4e59815
(finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14599
diff
changeset
|
189 "Regenerate `finder-inf.el' for the Emacs distribution." |
17745
ae0f1e4a63be
(finder-compile-keywords-make-dist):
Richard M. Stallman <rms@gnu.org>
parents:
14669
diff
changeset
|
190 (apply 'finder-compile-keywords command-line-args-left) |
ae0f1e4a63be
(finder-compile-keywords-make-dist):
Richard M. Stallman <rms@gnu.org>
parents:
14669
diff
changeset
|
191 (kill-emacs)) |
14669
6feeb4e59815
(finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14599
diff
changeset
|
192 |
867 | 193 ;;; Now the retrieval code |
194 | |
14599 | 195 (defun finder-insert-at-column (column &rest strings) |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
196 "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>
parents:
33420
diff
changeset
|
197 (if (>= (current-column) column) (insert "\n")) |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
198 (move-to-column column t) |
14599 | 199 (apply 'insert strings)) |
200 | |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
201 (defvar finder-help-echo nil) |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
202 |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
203 (defun finder-mouse-face-on-line () |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
204 "Put `mouse-face' and `help-echo' properties on the previous line." |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
205 (save-excursion |
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
206 (previous-line 1) |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
207 (unless finder-help-echo |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
208 (setq finder-help-echo |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
209 (let* ((keys1 (where-is-internal 'finder-select |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
210 finder-mode-map)) |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
211 (keys (nconc (where-is-internal |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
212 'finder-mouse-select finder-mode-map) |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
213 keys1))) |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
214 (concat (mapconcat 'key-description keys ", ") |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
215 ": select item")))) |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
216 (add-text-properties |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
217 (line-beginning-position) (line-end-position) |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
218 '(mouse-face highlight |
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
219 help-echo finder-help-echo)))) |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
220 |
28528
7618c3801a21
(finder-commentary): Add autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
26675
diff
changeset
|
221 ;;;###autoload |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
222 (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>
parents:
2502
diff
changeset
|
223 "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>
parents:
2502
diff
changeset
|
224 (interactive) |
18226
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
225 (if (get-buffer "*Finder*") |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
226 (pop-to-buffer "*Finder*") |
18284
21a40db838e2
(finder-list-keywords): Create *Finder* buffer if nec.
Richard M. Stallman <rms@gnu.org>
parents:
18226
diff
changeset
|
227 (pop-to-buffer (set-buffer (get-buffer-create "*Finder*"))) |
18226
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
228 (finder-mode) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
229 (setq buffer-read-only nil) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
230 (erase-buffer) |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
231 (mapc |
18226
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
232 (lambda (assoc) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
233 (let ((keyword (car assoc))) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
234 (insert (symbol-name keyword)) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
235 (finder-insert-at-column 14 (concat (cdr assoc) "\n")) |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
236 (finder-mouse-face-on-line))) |
18226
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
237 finder-known-keywords) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
238 (goto-char (point-min)) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
239 (setq finder-headmark (point)) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
240 (setq buffer-read-only t) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
241 (set-buffer-modified-p nil) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
242 (balance-windows) |
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
243 (finder-summary))) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
244 |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
245 (defun finder-list-matches (key) |
18687
3854a35dffd8
(finder-list-matches): Create *Finder Category* buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18284
diff
changeset
|
246 (pop-to-buffer (set-buffer (get-buffer-create "*Finder Category*"))) |
18226
37ff8dfff53b
(finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents:
17745
diff
changeset
|
247 (finder-mode) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
248 (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>
parents:
2502
diff
changeset
|
249 (erase-buffer) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
250 (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>
parents:
2502
diff
changeset
|
251 (insert |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
252 "The following packages match the keyword `" key "':\n\n") |
2996
358fe58ae153
(finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents:
2716
diff
changeset
|
253 (setq finder-headmark (point)) |
33420
cc332f3565f2
(finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents:
30883
diff
changeset
|
254 (mapc |
14599 | 255 (lambda (x) |
256 (if (memq id (car (cdr (cdr x)))) | |
257 (progn | |
258 (insert (car x)) | |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
259 (finder-insert-at-column 16 (concat (nth 1 x) "\n")) |
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
260 (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>
parents:
2502
diff
changeset
|
261 finder-package-info) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
262 (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>
parents:
2502
diff
changeset
|
263 (forward-line) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
264 (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>
parents:
2502
diff
changeset
|
265 (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>
parents:
2502
diff
changeset
|
266 (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>
parents:
2502
diff
changeset
|
267 (finder-summary))) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
268 |
28528
7618c3801a21
(finder-commentary): Add autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
26675
diff
changeset
|
269 ;;;###autoload |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
270 (defun finder-commentary (file) |
24221
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
271 "Display FILE's commentary section. |
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
272 FILE should be in a form suitable for passing to `locate-library'." |
47419
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
273 (interactive |
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
274 (list |
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
275 (completing-read "Library name: " |
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
276 'locate-file-completion |
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
277 (cons (or find-function-source-path load-path) |
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
278 (find-library-suffixes))))) |
0e00286fe517
(finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44105
diff
changeset
|
279 (let* ((str (lm-commentary (find-library-name file)))) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
280 (if (null str) |
7943
8053544ffe30
(finder-commentary): Fix error message syntax.
Richard M. Stallman <rms@gnu.org>
parents:
5848
diff
changeset
|
281 (error "Can't find any Commentary section")) |
48408
2eb7a3846b4c
(finder-commentary): Use buffer *Finder-package*.
Richard M. Stallman <rms@gnu.org>
parents:
47825
diff
changeset
|
282 ;; This used to use *Finder* but that would clobber the |
2eb7a3846b4c
(finder-commentary): Use buffer *Finder-package*.
Richard M. Stallman <rms@gnu.org>
parents:
47825
diff
changeset
|
283 ;; directory of categories. |
53501
97bc08aa2492
(finder-commentary): Call delete-other-windows.
Richard M. Stallman <rms@gnu.org>
parents:
52533
diff
changeset
|
284 (delete-other-windows) |
48408
2eb7a3846b4c
(finder-commentary): Use buffer *Finder-package*.
Richard M. Stallman <rms@gnu.org>
parents:
47825
diff
changeset
|
285 (pop-to-buffer "*Finder-package*") |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
286 (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>
parents:
2502
diff
changeset
|
287 (erase-buffer) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
288 (insert str) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
289 (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>
parents:
2502
diff
changeset
|
290 (delete-blank-lines) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
291 (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>
parents:
2502
diff
changeset
|
292 (delete-blank-lines) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
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>
parents:
2502
diff
changeset
|
294 (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>
parents:
2502
diff
changeset
|
295 (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>
parents:
2502
diff
changeset
|
296 (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>
parents:
2502
diff
changeset
|
297 (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>
parents:
2502
diff
changeset
|
298 (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>
parents:
2502
diff
changeset
|
299 (shrink-window-if-larger-than-buffer) |
26675
995b6841718b
(finder-commentary): Activate Finder mode.
Gerd Moellmann <gerd@gnu.org>
parents:
25622
diff
changeset
|
300 (finder-mode) |
14599 | 301 (finder-summary))) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
302 |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
303 (defun finder-current-item () |
60746
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
304 (let ((key (save-excursion |
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
305 (beginning-of-line) |
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
306 (current-word)))) |
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
307 (if (or (and finder-headmark (< (point) finder-headmark)) |
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
308 (= (length key) 0)) |
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
309 (error "No keyword or filename on this line") |
23533546bb38
(finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents:
54572
diff
changeset
|
310 key))) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
311 |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
312 (defun finder-select () |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
313 "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>
parents:
2502
diff
changeset
|
314 (interactive) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
315 (let ((key (finder-current-item))) |
20009
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
316 (if (string-match "\\.el$" key) |
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
317 (finder-commentary key) |
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
318 (finder-list-matches key)))) |
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
319 |
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
320 (defun finder-mouse-select (event) |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
321 "Select item in a finder buffer with the mouse." |
20009
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
322 (interactive "e") |
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
323 (save-excursion |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
324 (set-buffer (window-buffer (posn-window (event-start event)))) |
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
325 (goto-char (posn-point (event-start event))) |
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
326 (finder-select))) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
327 |
28528
7618c3801a21
(finder-commentary): Add autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents:
26675
diff
changeset
|
328 ;;;###autoload |
867 | 329 (defun finder-by-keyword () |
330 "Find packages matching a given keyword." | |
331 (interactive) | |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
332 (finder-list-keywords)) |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
333 |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
334 (defun finder-mode () |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
335 "Major mode for browsing package documentation. |
2716
acd678e58602
* finder.el: Bind finder-exit to 'q', not 'x'; the former is the
Jim Blandy <jimb@redhat.com>
parents:
2527
diff
changeset
|
336 \\<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>
parents:
2502
diff
changeset
|
337 \\[finder-select] more help for the item on the current line |
24221
efc15742dcc3
(finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents:
22295
diff
changeset
|
338 \\[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>
parents:
2502
diff
changeset
|
339 (interactive) |
54572
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
340 (kill-all-local-variables) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
341 (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>
parents:
2502
diff
changeset
|
342 (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>
parents:
2502
diff
changeset
|
343 (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>
parents:
2502
diff
changeset
|
344 (setq major-mode 'finder-mode) |
54572
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
345 (set (make-local-variable 'finder-headmark) nil) |
2f882266c186
(finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54483
diff
changeset
|
346 (run-mode-hooks 'finder-mode-hook)) |
2527
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
347 |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
348 (defun finder-summary () |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
349 "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>
parents:
2502
diff
changeset
|
350 (interactive) |
14313
8e13f59d2c19
(finder-summary): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
351 (message "%s" |
2716
acd678e58602
* finder.el: Bind finder-exit to 'q', not 'x'; the former is the
Jim Blandy <jimb@redhat.com>
parents:
2527
diff
changeset
|
352 (substitute-command-keys |
21805
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
353 "\\<finder-mode-map>\\[finder-select] = select, \ |
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
354 \\[finder-mouse-select] = select, \\[finder-list-keywords] = to \ |
aafa93c1a5ce
(finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents:
21758
diff
changeset
|
355 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>
parents:
2502
diff
changeset
|
356 |
93015b63b041
Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2502
diff
changeset
|
357 (defun finder-exit () |
20264
3b9b07f3eab5
(finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents:
20241
diff
changeset
|
358 "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>
parents:
2502
diff
changeset
|
359 (interactive) |
20241 | 360 (or (one-window-p t) |
361 (delete-window)) | |
20009
09bc233eb018
(finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents:
19169
diff
changeset
|
362 ;; Can happen in either buffer -- kill each of the two that exists |
20241 | 363 (and (get-buffer "*Finder*") |
364 (kill-buffer "*Finder*")) | |
365 (and (get-buffer "*Finder Category*") | |
366 (kill-buffer "*Finder Category*"))) | |
867 | 367 |
30883
869204bacd5f
Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28528
diff
changeset
|
368 |
867 | 369 (provide 'finder) |
370 | |
52401 | 371 ;;; arch-tag: ec85ff49-8cb8-41f5-a63f-9131d53ce2c5 |
867 | 372 ;;; finder.el ends here |