annotate lisp/finder.el @ 390:c6012109f545 r21-2-10

Import from CVS: tag r21-2-10
author cvs
date Mon, 13 Aug 2007 11:10:03 +0200
parents 8626e4521993
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1 ;;; finder.el --- topic & keyword-based code finder
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
4
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
6 ;; Created: 16 Jun 1992
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
7 ;; Version: 1.0
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
8 ;; Keywords: help
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
9 ;; X-Modified-by: Bob Weiner <weiner@mot.com>, 4/18/95, to include Lisp
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
10 ;; library directory names in finder-program-info, for fast display of
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
11 ;; Lisp libraries and associated commentaries. Added {v}, finder-view,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
12 ;; and {e}, finder-edit commands for displaying libraries.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
13 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
14 ;; Added user variable, 'finder-abbreviate-directory-list', used to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
15 ;; abbreviate directories before they are saved to finder-program-info.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
16 ;; Such relative directories can be portable from one Emacs installation
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
17 ;; to another. Default value is based upon the value of Emacs'
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
18 ;; data-directory variable.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
19
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
20 ;; This file is part of XEmacs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
21
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
22 ;; XEmacs is free software; you can redistribute it and/or modify it
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
23 ;; under the terms of the GNU General Public License as published by
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
24 ;; the Free Software Foundation; either version 2, or (at your option)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
25 ;; any later version.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
26
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
27 ;; XEmacs is distributed in the hope that it will be useful, but
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
28 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
29 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
30 ;; General Public License for more details.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
31
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
32 ;; You should have received a copy of the GNU General Public License
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
33 ;; along with XEmacs; see the file COPYING. If not, write to the Free
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
34 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
35 ;; 02111-1307, USA.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
36
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
37 ;;; Synched up with: FSF 19.34.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
38
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
39 ;;; Commentary:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
40
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
41 ;; This mode uses the Keywords library header to provide code-finding
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
42 ;; services by keyword.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
43 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
44 ;; Things to do:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
45 ;; 1. Support multiple keywords per search. This could be extremely hairy;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
46 ;; there doesn't seem to be any way to get completing-read to exit on
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
47 ;; an EOL with no substring pending, which is what we'd want to end the loop.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
48 ;; 2. Search by string in synopsis line?
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
49 ;; 3. Function to check finder-package-info for unknown keywords.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
50
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
51 ;;; Code:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
52
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
53 (require 'lisp-mnt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
54 (condition-case nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
55 (require 'finder-inf)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
56 (t nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
57 ;; XEmacs addition
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
58 (require 'picture)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
59 (require 'mode-motion)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
60
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
61 (defvar finder-emacs-root-directory
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
62 (file-name-directory (directory-file-name data-directory))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
63 "Root directory of current emacs tree.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
64
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
65 (defvar finder-abbreviate-directory-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
66 (list finder-emacs-root-directory)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
67 "*List of directory roots to remove from finder-package-info directory entries.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
68 The first element in the list is used when expanding relative package
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
69 directories to view or extract information from package source code.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
70
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
71 (defvar finder-file-regexp "\\.el$"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
72 "Regexp which matches file names but not Emacs Lisp finder keywords.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
73
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
74 ;; Local variable in finder buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
75 (defvar finder-headmark)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
76
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
77 (defvar finder-known-keywords
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
78 `(
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
79 (abbrev . "abbreviation handling, typing shortcuts, macros")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
80 (bib . "code related to the `bib' bibliography processor")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
81 (c . "C, C++, and Objective-C language support")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
82 (calendar . "calendar and time management support")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
83 (comm . "communications, networking, remote access to files")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
84 (data . "support for editing files of data")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
85 (docs . "support for Emacs documentation")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
86 (dumped . "files preloaded into Emacs")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
87 (emulations . "emulations of other editors")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
88 (extensions . "Emacs Lisp language extensions")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
89 (faces . "support for multiple fonts")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
90 (frames . "support for Emacs frames and window systems")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
91 (games . "games, jokes and amusements")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
92 (hardware . "support for interfacing with exotic hardware")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
93 (help . "support for on-line help systems")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
94 (hypermedia . "support for links between text or other media types")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
95 (i18n . "internationalization and alternate character-set support")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
96 (internal . "code for Emacs internals, build process, defaults")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
97 (languages . "specialized modes for editing programming languages")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
98 (lisp . "Lisp support, including Emacs Lisp")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
99 (local . "code local to your site")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
100 (maint . "maintenance aids for the Emacs development group")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
101 (mail . "modes for electronic-mail handling")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
102 (matching . "various sorts of searching and matching")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
103 (mouse . "mouse support")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
104 ,(when (featurep 'mule)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
105 (cons 'mule "multi-language extensions"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
106 (news . "support for netnews reading and posting")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
107 (oop . "support for object-oriented programming")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
108 (outlines . "support for hierarchical outlining")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
109 (processes . "process, subshell, compilation, and job control support")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
110 (terminals . "support for terminal types")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
111 (tex . "code related to the TeX formatter")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
112 (tools . "programming tools")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
113 (unix . "front-ends/assistants for, or emulators of, UNIX features")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
114 (vms . "support code for vms")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
115 (wp . "word processing")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
116 ))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
117
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
118 (defvar finder-mode-map nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
119 (or finder-mode-map
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
120 (let ((map (make-sparse-keymap)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
121 (define-key map " " 'finder-select)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
122 (define-key map "f" 'finder-select)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
123 (define-key map "\C-m" 'finder-select)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
124 ;; XEmacs changes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
125 (define-key map "e" 'finder-edit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
126 (define-key map "v" 'finder-view)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
127 (define-key map "?" 'finder-summary)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
128 (define-key map "q" 'finder-exit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
129 (define-key map "d" 'finder-list-keywords)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
130 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
131 (define-key map [button2] 'finder-mouse-select)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
132 (setq finder-mode-map map)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
133
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
134
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
135 ;;; Code for regenerating the keyword list.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
136
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
137 (defvar finder-package-info nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
138 "Assoc list mapping file names to description & keyword lists.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
139
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
140 (defvar finder-compile-keywords-quiet nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
141 "If non-nil finder-compile-keywords will not print any messages.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
142
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
143 (defun finder-compile-keywords (&rest dirs)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
144 "Regenerate the keywords association list into the file `finder-inf.el'.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
145 Optional arguments are a list of Emacs Lisp directories to compile from; no
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
146 arguments compiles from `load-path'."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
147 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
148 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
149 (find-file "finder-inf.el")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
150 (let ((processed nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
151 (directory-abbrev-alist
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
152 (append
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
153 (mapcar (function (lambda (dir) (cons dir "")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
154 finder-abbreviate-directory-list)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
155 directory-abbrev-alist))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
156 (using-load-path))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
157 (or dirs (setq dirs load-path))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
158 (setq using-load-path (equal dirs load-path))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
159 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
160 (insert ";;; finder-inf.el --- keyword-to-package mapping\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
161 (insert ";; Keywords: help\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
162 (insert ";;; Commentary:\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
163 (insert ";; Don't edit this file. It's generated by finder.el\n\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
164 (insert ";;; Code:\n")
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
165 (insert "\n(defconst finder-package-info '(\n")
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
166 (mapcar
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
167 (lambda (d)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
168 (mapcar
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
169 (lambda (f)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
170 (when (not (member f processed))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
171 (let (summary keystart keywords)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
172 (setq processed (cons f processed))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
173 (if (not finder-compile-keywords-quiet)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
174 (message "Processing %s ..." f))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
175 (save-excursion
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
176 (set-buffer (get-buffer-create "*finder-scratch*"))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
177 (buffer-disable-undo (current-buffer))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
178 (erase-buffer)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
179 (insert-file-contents (expand-file-name f d))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
180 (condition-case err
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
181 (setq summary (lm-synopsis)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
182 keywords (lm-keywords))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
183 (t (message "finder: error processing %s %S" f err))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
184 (when summary
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
185 (insert (format " (\"%s\"\n " f))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
186 (prin1 summary (current-buffer))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
187 (insert "\n ")
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
188 (setq keystart (point))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
189 (insert (if keywords (format "(%s)" keywords) "nil"))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
190 (subst-char-in-region keystart (point) ?, ? )
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
191 (insert "\n ")
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
192 (prin1 (abbreviate-file-name d) (current-buffer))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
193 (insert ")\n")))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
194 ;;
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
195 ;; Skip null, non-existent or relative pathnames, e.g. "./", if
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
196 ;; using load-path, so that they do not interfere with a scan of
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
197 ;; library directories only.
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
198 (if (and using-load-path
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
199 (not (and d (file-name-absolute-p d) (file-exists-p d))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
200 nil
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
201 (setq d (file-name-as-directory (or d ".")))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 272
diff changeset
202 (directory-files d nil "^[^=].*\\.el$"))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
203 dirs)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
204 (insert "))\n\n(provide 'finder-inf)\n\n;;; finder-inf.el ends here\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
205 (kill-buffer "*finder-scratch*")
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
206 (unless noninteractive
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
207 (eval-current-buffer)) ; So we get the new keyword list immediately
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
208 (basic-save-buffer))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
209
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
210 (defun finder-compile-keywords-make-dist ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
211 "Regenerate `finder-inf.el' for the Emacs distribution."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
212 (finder-compile-keywords default-directory))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
213
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
214 ;;; Now the retrieval code
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
215
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
216 (defun finder-insert-at-column (column &rest strings)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
217 "Insert list of STRINGS, at column COLUMN."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
218 (if (>= (current-column) column) (insert "\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
219 (move-to-column column)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
220 (let ((col (current-column)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
221 (if (< col column)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
222 (indent-to column)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
223 (if (and (/= col column)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
224 (= (preceding-char) ?\t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
225 (let (indent-tabs-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
226 (delete-char -1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
227 (indent-to col)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
228 (move-to-column column)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
229 (apply 'insert strings))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
230
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
231 (defun finder-list-keywords ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
232 "Display descriptions of the keywords in the Finder buffer."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
233 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
234 (setq buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
235 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
236 (mapcar
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
237 (lambda (assoc)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
238 (let ((keyword (car assoc)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
239 (insert (symbol-name keyword))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
240 (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
241 (cons (symbol-name keyword) keyword)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
242 finder-known-keywords)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
243 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
244 (setq finder-headmark (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
245 (setq buffer-read-only t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
246 (set-buffer-modified-p nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
247 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
248 (if (not (one-window-p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
249 (balance-windows))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
250 (finder-summary))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
251
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
252 (defun finder-list-matches (key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
253 (setq buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
254 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
255 (let ((id (intern key)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
256 (insert
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
257 "The following packages match the keyword `" key "':\n\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
258 (setq finder-headmark (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
259 (mapcar
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
260 (lambda (x)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
261 (if (memq id (car (cdr (cdr x))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
262 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
263 (insert (car x))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
264 (finder-insert-at-column 16 (concat (car (cdr x)) "\n")))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
265 finder-package-info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
266 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
267 (forward-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
268 (setq buffer-read-only t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
269 (set-buffer-modified-p nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
270 (shrink-window-if-larger-than-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
271 (finder-summary)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
272
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
273 ;; Search for a file named FILE the same way `load' would search.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
274 (defun finder-find-library (file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
275 (if (file-name-absolute-p file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
276 file
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
277 (let ((dirs load-path)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
278 found)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
279 (while (and dirs (not found))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
280 (if (file-exists-p (expand-file-name (concat file ".el") (car dirs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
281 (setq found (expand-file-name file (car dirs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
282 (if (file-exists-p (expand-file-name file (car dirs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
283 (setq found (expand-file-name file (car dirs)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
284 (setq dirs (cdr dirs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
285 found)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
286
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
287 (defun finder-commentary (file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
288 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
289 (let* ((str (lm-commentary (finder-find-library file))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
290 (if (null str)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
291 (error "Can't find any Commentary section"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
292 (pop-to-buffer "*Finder*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
293 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
294 (setq buffer-read-only nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
295 mode-motion-hook 'mode-motion-highlight-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
296 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
297 (insert str)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
298 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
299 (delete-blank-lines)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
300 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
301 (delete-blank-lines)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
302 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
303 (while (re-search-forward "^;+ ?" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
304 (replace-match "" nil nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
305 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
306 (setq buffer-read-only t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
307 (set-buffer-modified-p nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
308 (shrink-window-if-larger-than-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
309 (finder-summary)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
310
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
311 (defun finder-current-item ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
312 (if (and finder-headmark (< (point) finder-headmark))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
313 (error "No keyword or filename on this line")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
314 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
315 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
316 (current-word))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
317
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
318 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
319 (defun finder-edit ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
320 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
321 (let ((entry (finder-current-item)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
322 (if (string-match finder-file-regexp entry)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
323 (let ((path (finder-find-library entry)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
324 (if path
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
325 (find-file-other-window path)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
326 (error "Can't find Emacs Lisp library: '%s'" entry)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
327 ;; a finder keyword
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
328 (error "Finder-edit works on Emacs Lisp libraries only"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
329
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
330 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
331 (defun finder-view ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
332 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
333 (let ((entry (finder-current-item)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
334 (if (string-match finder-file-regexp entry)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
335 (let ((path (finder-find-library entry)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
336 (if path
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
337 (view-file-other-window path)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
338 (error "Can't find Emacs Lisp library: '%s'" entry)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
339 ;; a finder keyword
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
340 (error "Finder-view works on Emacs Lisp libraries only"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
341
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
342 (defun finder-select ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
343 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
344 (let ((key (finder-current-item)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
345 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
346 (if (string-match finder-file-regexp key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
347 (finder-commentary key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
348 (finder-list-matches key))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
349
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
350 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
351 (defun finder-mouse-select (ev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
352 (interactive "e")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
353 (goto-char (event-point ev))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
354 (finder-select))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
355
239
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 217
diff changeset
356 ;; XEmacs change
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 217
diff changeset
357 ;;;###autoload
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
358 (defun finder-by-keyword ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
359 "Find packages matching a given keyword."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
360 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
361 (finder-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
362 (finder-list-keywords))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
363
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
364 (defun finder-mode ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
365 "Major mode for browsing package documentation.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
366 \\<finder-mode-map>
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
367 \\[finder-select] more help for the item on the current line
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
368 \\[finder-edit] edit Lisp library in another window
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
369 \\[finder-view] view Lisp library in another window
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
370 \\[finder-exit] exit Finder mode and kill the Finder buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
371 "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
372 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
373 (pop-to-buffer "*Finder*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
374 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
375 (setq buffer-read-only nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
376 mode-motion-hook 'mode-motion-highlight-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
377 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
378 (use-local-map finder-mode-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
379 (set-syntax-table emacs-lisp-mode-syntax-table)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
380 (setq mode-name "Finder")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
381 (setq major-mode 'finder-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
382 (make-local-variable 'finder-headmark)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
383 (setq finder-headmark nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
384
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
385 (defun finder-summary ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
386 "Summarize basic Finder commands."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
387 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
388 (message "%s"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
389 (substitute-command-keys
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
390 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
391 "\\<finder-mode-map>\\[finder-select] = select, \\[finder-list-keywords] = keywords, \\[finder-edit] = edit, \\[finder-view] = view, \\[finder-exit] = quit, \\[finder-summary] = help")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
392
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
393 (defun finder-exit ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
394 "Exit Finder mode and kill the buffer"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
395 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
396 ;; XEmacs change
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
397 (or (one-window-p t 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
398 (delete-window))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
399 (kill-buffer "*Finder*"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
400
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
401 (provide 'finder)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
402
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
403 ;;; finder.el ends here