annotate lisp/finder.el @ 4843:715b15990d0a

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