annotate lisp/finder.el @ 28285:c54d62415e91

Changed the type of parameter passed to the function defined by `quickurl-format-function'. Before only the text of the URL was passed. Now the whole URL structure is passed and the function is responsible for extracting the parts it requires. Changed the default of `quickurl-format-function' accordingly. (quickurl-insert): Changed the `funcall' of `quickurl-format-function' to match the above change. (quickurl-list-insert): Changed the `url' case so that it makes use of `quickurl-format-function', previous to this the format was hard wired.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 23 Mar 2000 13:53:14 +0000
parents 995b6841718b
children 7618c3801a21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; finder.el --- topic & keyword-based code finder
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
3 ;; Copyright (C) 1992, 1997, 1998, 1999 Free Software Foundation, Inc.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
4
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
6 ;; Created: 16 Jun 1992
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
7 ;; Version: 1.0
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8 ;; Keywords: help
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
12244
ac7375e60931 Update GPL to version 2.
Karl Heuer <kwzh@gnu.org>
parents: 11488
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; any later version.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13580
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13580
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13580
diff changeset
25 ;; Boston, MA 02111-1307, USA.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
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
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
29 ;; This mode uses the Keywords library header to provide code-finding
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30 ;; services by keyword.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31 ;;
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32 ;; Things to do:
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
33 ;; 1. Support multiple keywords per search. This could be extremely hairy;
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34 ;; there doesn't seem to be any way to get completing-read to exit on
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
35 ;; an EOL with no substring pending, which is what we'd want to end the loop.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
36 ;; 2. Search by string in synopsis line?
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
37 ;; 3. Function to check finder-package-info for unknown keywords.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
38
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39 ;;; Code:
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
41 (require 'lisp-mnt)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
42 (require 'finder-inf)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
43
2996
358fe58ae153 (finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents: 2716
diff changeset
44 ;; Local variable in finder buffer.
358fe58ae153 (finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents: 2716
diff changeset
45 (defvar finder-headmark)
358fe58ae153 (finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents: 2716
diff changeset
46
25622
4e3d4f5cc358 Comment on finder-known-keywords.
Dave Love <fx@gnu.org>
parents: 25308
diff changeset
47 ;; These are supposed to correspond to top-level customization groups,
4e3d4f5cc358 Comment on finder-known-keywords.
Dave Love <fx@gnu.org>
parents: 25308
diff changeset
48 ;; says rms.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49 (defvar finder-known-keywords
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 '(
2270
a74fc62a3a1f Typo fix.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
51 (abbrev . "abbreviation handling, typing shortcuts, macros")
5141
3efae588d663 (finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents: 3708
diff changeset
52 (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
53 (c . "support for the C language and related languages")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 (calendar . "calendar and time management support")
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2228
diff changeset
55 (comm . "communications, networking, remote access to files")
22295
b2ceb0b98995 (finder-known-keywords): Fix `convenience' entry.
Dave Love <fx@gnu.org>
parents: 22129
diff changeset
56 (convenience . "convenience features for faster editing")
5141
3efae588d663 (finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents: 3708
diff changeset
57 (data . "support editing files of data")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
58 (docs . "support for Emacs documentation")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (emulations . "emulations of other editors")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
60 (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
61 (faces . "support for multiple fonts")
11454
d9ec5322d181 (finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 9200
diff changeset
62 (frames . "support for Emacs frames and window systems")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
63 (games . "games, jokes and amusements")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
64 (hardware . "support for interfacing with exotic hardware")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
65 (help . "support for on-line help systems")
11454
d9ec5322d181 (finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 9200
diff changeset
66 (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
67 (i18n . "internationalization and alternate character-set support")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68 (internal . "code for Emacs internals, build process, defaults")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
69 (languages . "specialized modes for editing programming languages")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
70 (lisp . "Lisp support, including Emacs Lisp")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
71 (local . "code local to your site")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72 (maint . "maintenance aids for the Emacs development group")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73 (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
74 (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
75 (mouse . "mouse support")
25308
8a92c65da346 (finder-known-keywords): Add `multimedia'.
Dave Love <fx@gnu.org>
parents: 24221
diff changeset
76 (multimedia . "images and sound support")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
77 (news . "support for netnews reading and posting")
11454
d9ec5322d181 (finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 9200
diff changeset
78 (oop . "support for object-oriented programming")
d9ec5322d181 (finder-known-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 9200
diff changeset
79 (outlines . "support for hierarchical outlining")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
80 (processes . "process, subshell, compilation, and job control support")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
81 (terminals . "support for terminal types")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
82 (tex . "code related to the TeX formatter")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
83 (tools . "programming tools")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
84 (unix . "front-ends/assistants for, or emulators of, UNIX features")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
85 (vms . "support code for vms")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
86 (wp . "word processing")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
87 ))
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
88
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
89 (defvar finder-mode-map nil)
9200
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
90 (or finder-mode-map
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
91 (let ((map (make-sparse-keymap)))
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
92 (define-key map " " 'finder-select)
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
93 (define-key map "f" 'finder-select)
20009
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
94 (define-key map [mouse-2] 'finder-mouse-select)
9200
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
95 (define-key map "\C-m" 'finder-select)
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
96 (define-key map "?" 'finder-summary)
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
97 (define-key map "q" 'finder-exit)
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
98 (define-key map "d" 'finder-list-keywords)
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
99 (setq finder-mode-map map)))
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
100
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
101
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
102 ;;; Code for regenerating the keyword list.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
103
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
104 (defvar finder-package-info nil
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
105 "Assoc list mapping file names to description & keyword lists.")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
106
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
107 (defun finder-compile-keywords (&rest dirs)
2996
358fe58ae153 (finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents: 2716
diff changeset
108 "Regenerate the keywords association list into the file `finder-inf.el'.
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
109 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
110 no arguments compiles from `load-path'."
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
111 (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
112 (let ((processed nil))
d40154ca6354 (finder-compile-keywords) Treat nil in a path argument as $PWD.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1475
diff changeset
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>
parents: 1475
diff changeset
114 (erase-buffer)
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2228
diff changeset
115 (insert ";;; finder-inf.el --- keyword-to-package mapping\n")
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2228
diff changeset
116 (insert ";; Keywords: help\n")
2457
3d2f74e16e54 Added or corrected documentation headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2271
diff changeset
117 (insert ";;; Commentary:\n")
3d2f74e16e54 Added or corrected documentation headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2271
diff changeset
118 (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
119 (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
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>
parents: 1475
diff changeset
121 (mapcar
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
122 (lambda (d)
21758
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
123 (when (file-exists-p (directory-file-name d))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
124 (message "Directory %s" d)
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
125 (mapcar
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
126 (lambda (f)
21758
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
127 (if (and (or (string-match "^[^=].*\\.el$" f)
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
128 ;; Allow compressed files also. Fixme:
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
129 ;; generalize this, especially for
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
130 ;; MS-DOG-type filenames.
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
131 (and (string-match "^[^=].*\\.el\\.\\(gz\\|Z\\)$" f)
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
132 (require 'jka-compr)))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
133 ;; Ignore lock files.
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
134 (not (string-match "^.#" f))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
135 (not (member f processed)))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
136 (let (summary keystart keywords)
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
137 (setq processed (cons f processed))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
138 (save-excursion
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
139 (set-buffer (get-buffer-create "*finder-scratch*"))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
140 (buffer-disable-undo (current-buffer))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
141 (erase-buffer)
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
142 (insert-file-contents
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
143 (concat (file-name-as-directory (or d ".")) f))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
144 (setq summary (lm-synopsis))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
145 (setq keywords (lm-keywords)))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
146 (insert
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
147 (format " (\"%s\"\n "
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
148 (if (string-match "\\.\\(gz\\|Z\\)$" f)
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
149 (file-name-sans-extension f)
21758
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
150 f)))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
151 (prin1 summary (current-buffer))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
152 (insert
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
153 "\n ")
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
154 (setq keystart (point))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
155 (insert
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
156 (if keywords (format "(%s)" keywords) "nil")
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
157 ")\n")
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
158 (subst-char-in-region keystart (point) ?, ? )
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
159 )))
bc7f520d8251 (finder-compile-keywords):
Richard M. Stallman <rms@gnu.org>
parents: 20264
diff changeset
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>
parents: 1475
diff changeset
161 (or dirs load-path))
2457
3d2f74e16e54 Added or corrected documentation headers
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2271
diff changeset
162 (insert "))\n\n(provide 'finder-inf)\n\n;;; 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>
parents: 1475
diff changeset
163 (kill-buffer "*finder-scratch*")
2271
026941de1886 Make sure that when new keywords are compiled, we see them
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2270
diff changeset
164 (eval-current-buffer) ;; So we get the new keyword list immediately
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
165 (basic-save-buffer))))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166
14669
6feeb4e59815 (finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14599
diff changeset
167 (defun finder-compile-keywords-make-dist ()
6feeb4e59815 (finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14599
diff changeset
168 "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
169 (apply 'finder-compile-keywords command-line-args-left)
ae0f1e4a63be (finder-compile-keywords-make-dist):
Richard M. Stallman <rms@gnu.org>
parents: 14669
diff changeset
170 (kill-emacs))
14669
6feeb4e59815 (finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14599
diff changeset
171
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
172 ;;; Now the retrieval code
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
173
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
174 (defun finder-insert-at-column (column &rest strings)
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
175 "Insert, at column COLUMN, other args STRINGS."
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
176 (if (> (current-column) column) (insert "\n"))
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
177 (move-to-column column t)
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
178 (apply 'insert strings))
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
179
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
180 (defun finder-mouse-face-on-line ()
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
181 "Put a `mouse-face' property on the previous line."
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
182 (save-excursion
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
183 (previous-line 1)
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
184 (put-text-property (save-excursion (beginning-of-line) (point))
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
185 (progn (end-of-line) (point))
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
186 'mouse-face 'highlight)))
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
187
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
188 (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
189 "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
190 (interactive)
18226
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
191 (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
192 (pop-to-buffer "*Finder*")
18284
21a40db838e2 (finder-list-keywords): Create *Finder* buffer if nec.
Richard M. Stallman <rms@gnu.org>
parents: 18226
diff changeset
193 (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
194 (finder-mode)
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
195 (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
196 (erase-buffer)
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
197 (mapcar
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
198 (lambda (assoc)
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
199 (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
200 (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
201 (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
202 (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
203 finder-known-keywords)
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
204 (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
205 (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
206 (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
207 (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
208 (balance-windows)
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
209 (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
210
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
211 (defun finder-list-matches (key)
18687
3854a35dffd8 (finder-list-matches): Create *Finder Category* buffer.
Richard M. Stallman <rms@gnu.org>
parents: 18284
diff changeset
212 (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
213 (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
214 (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
215 (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
216 (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
217 (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
218 "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
219 (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>
parents: 2502
diff changeset
220 (mapcar
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
221 (lambda (x)
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
222 (if (memq id (car (cdr (cdr x))))
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
223 (progn
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
224 (insert (car x))
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
225 (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
226 (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
227 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
228 (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
229 (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
230 (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
231 (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
232 (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
233 (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
234
20264
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
235 (defun finder-find-library (library)
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
236 "Search for file LIBRARY on `load-path'.
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
237 Try compressed versions if jka-compr is in use."
20264
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
238 (or (locate-library library t)
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
239 (if (rassq 'jka-compr-handler file-name-handler-alist)
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
240 (or (locate-library (concat library ".gz") t)
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
241 (locate-library (concat library ".Z") t)
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
242 ;; last resort for MS-DOG et al
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
243 (locate-library (concat library "z"))))))
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
244
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
245 (defun finder-commentary (file)
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
246 "Display FILE's commentary section.
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
247 FILE should be in a form suitable for passing to `locate-library'."
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
248 (interactive "sLibrary name: ")
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
249 (let* ((str (lm-commentary (or (finder-find-library file)
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
250 (finder-find-library (concat file ".el"))
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
251 (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>
parents: 2502
diff changeset
252 (if (null str)
7943
8053544ffe30 (finder-commentary): Fix error message syntax.
Richard M. Stallman <rms@gnu.org>
parents: 5848
diff changeset
253 (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>
parents: 2502
diff changeset
254 (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>
parents: 2502
diff changeset
255 (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
256 (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
257 (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
258 (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
259 (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
260 (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
261 (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
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 (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
264 (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
265 (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
266 (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
267 (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
268 (shrink-window-if-larger-than-buffer)
26675
995b6841718b (finder-commentary): Activate Finder mode.
Gerd Moellmann <gerd@gnu.org>
parents: 25622
diff changeset
269 (finder-mode)
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
270 (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
271
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
272 (defun finder-current-item ()
2996
358fe58ae153 (finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents: 2716
diff changeset
273 (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>
parents: 2502
diff changeset
274 (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>
parents: 2502
diff changeset
275 (save-excursion
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
276 (beginning-of-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
277 (current-word))))
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
278
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
279 (defun finder-select ()
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
280 "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
281 (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
282 (let ((key (finder-current-item)))
20009
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
283 (if (string-match "\\.el$" key)
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
284 (finder-commentary key)
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
285 (finder-list-matches key))))
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
286
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
287 (defun finder-mouse-select (event)
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
288 "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
289 (interactive "e")
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
290 (save-excursion
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
291 (set-buffer (window-buffer (posn-window (event-start event))))
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
292 (goto-char (posn-point (event-start event)))
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
293 (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
294
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
295 (defun finder-by-keyword ()
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
296 "Find packages matching a given keyword."
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
297 (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
298 (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
299
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
300 (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
301 "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
302 \\<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
303 \\[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
304 \\[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
305 (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
306 (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
307 (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
308 (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
309 (setq major-mode 'finder-mode)
2996
358fe58ae153 (finder-known-keywords): Use i18n, not i14n.
Richard M. Stallman <rms@gnu.org>
parents: 2716
diff changeset
310 (make-local-variable 'finder-headmark)
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
311 (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>
parents: 2502
diff changeset
312
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
313 (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
314 "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
315 (interactive)
14313
8e13f59d2c19 (finder-summary): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
316 (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
317 (substitute-command-keys
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
318 "\\<finder-mode-map>\\[finder-select] = select, \
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
319 \\[finder-mouse-select] = select, \\[finder-list-keywords] = to \
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
320 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
321
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
322 (defun finder-exit ()
20264
3b9b07f3eab5 (finder-find-library): Re-instate (with a different
Karl Heuer <kwzh@gnu.org>
parents: 20241
diff changeset
323 "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
324 (interactive)
20241
25b1541c8219 (finder-exit): Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 20009
diff changeset
325 (or (one-window-p t)
25b1541c8219 (finder-exit): Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 20009
diff changeset
326 (delete-window))
20009
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
327 ;; Can happen in either buffer -- kill each of the two that exists
20241
25b1541c8219 (finder-exit): Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 20009
diff changeset
328 (and (get-buffer "*Finder*")
25b1541c8219 (finder-exit): Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 20009
diff changeset
329 (kill-buffer "*Finder*"))
25b1541c8219 (finder-exit): Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 20009
diff changeset
330 (and (get-buffer "*Finder Category*")
25b1541c8219 (finder-exit): Simplify.
Karl Heuer <kwzh@gnu.org>
parents: 20009
diff changeset
331 (kill-buffer "*Finder Category*")))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
332
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
333 (provide 'finder)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
334
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
335 ;;; finder.el ends here