annotate lisp/finder.el @ 5883:d93195c2c906

Escape quotation marks when printing values interactively, #'getenv src/ChangeLog addition: 2015-04-01 Aidan Kehoe <kehoea@parhasard.net> * process.c (Fgetenv): When interactively showing a variable's value, use %S in the format string so quotation marks are escaped correctly.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 03 Apr 2015 00:15:18 +0100
parents 308d34e9f07d
children
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
22 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
23 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
24 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
25 ;; option) any later version.
2984
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
26
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
27 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
28 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
29 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
30 ;; for more details.
2984
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
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4783
diff changeset
33 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
2984
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
34
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
35 ;;; Synched up with: FSF 19.34.
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 ;;; Commentary:
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 ;; 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
40 ;; services by keyword.
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
41 ;;
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
42 ;; Things to do:
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
43 ;; 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
44 ;; 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
45 ;; 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
46 ;; 2. Search by string in synopsis line?
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
47 ;; 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
48
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
49 ;;; Code:
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 (require 'lisp-mnt)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
52 (condition-case nil
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
53 (require 'finder-inf)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
54 (t nil))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
55 ;; XEmacs addition
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
56 (require 'picture)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
57 (require 'mode-motion)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
58
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
59 (defvar finder-emacs-root-directory
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
60 (file-name-directory (directory-file-name data-directory))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
61 "Root directory of current emacs tree.")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
62
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
63 (defvar finder-abbreviate-directory-list
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
64 (list finder-emacs-root-directory)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
65 "*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
66 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
67 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
68
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
69 (defvar finder-file-regexp "\\.el$"
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
70 "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
71
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
72 ;; Local variable in finder buffer.
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
73 (defvar finder-headmark)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
74
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
75 (defvar finder-known-keywords
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 (abbrev . "abbreviation handling, typing shortcuts, macros")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
78 (bib . "code related to the `bib' bibliography processor")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
79 (build . "code used to build XEmacs")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
80 (c . "C, C++, and Objective-C language support")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
81 (calendar . "calendar and time management support")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
82 (comm . "communications, networking, remote access to files")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
83 (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
84 (data . "support for editing files of data")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
85 (docs . "support for XEmacs documentation")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
86 (dumped . "files preloaded into XEmacs")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
87 (emulations . "emulations of other editors")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
88 (extensions . "Emacs Lisp language extensions")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
89 (faces . "support for multiple fonts")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
90 (frames . "support for XEmacs frames and window systems")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
91 (games . "games, jokes and amusements")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
92 (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
93 (hardware . "support for interfacing with exotic hardware")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
94 (help . "support for on-line help systems")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
95 (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
96 (i18n . "internationalization and alternate character-set support")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
97 (internal . "code implementing core functionality in XEmacs")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
98 (languages . "specialized modes for editing programming languages")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
99 (lisp . "Lisp support, including Emacs Lisp")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
100 (local . "code local to your site")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
101 (mail . "modes for electronic-mail handling")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
102 (maint . "maintenance aids for the Emacs development group")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
103 (matching . "various sorts of searching and matching")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
104 (mouse . "mouse support")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
105 (mswin . "support for anything running on MS Windows")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
106 ,(when (featurep 'mule)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
107 (cons 'mule "multi-language extensions"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
108 (news . "support for netnews reading and posting")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
109 (oop . "support for object-oriented programming")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
110 (outlines . "support for hierarchical outlining")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
111 (processes . "process, subshell, compilation, and job control support")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
112 (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
113 (terminals . "support for terminal types")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
114 (tex . "code related to the TeX formatter")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
115 (tools . "programming tools")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
116 (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
117 (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
118 (vms . "support code for vms")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
119 (wp . "word processing")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
120 (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
121 ))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
122
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
123 (defvar finder-mode-map nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
124 (or finder-mode-map
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
125 (let ((map (make-sparse-keymap)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
126 (define-key map " " 'finder-select)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
127 (define-key map "f" 'finder-select)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
128 (define-key map "\C-m" 'finder-select)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
129 ;; XEmacs changes
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
130 (define-key map "e" 'finder-edit)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
131 (define-key map "v" 'finder-view)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
132 (define-key map "?" 'finder-summary)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
133 (define-key map "q" 'finder-exit)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
134 (define-key map "d" 'finder-list-keywords)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
135 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
136 (define-key map [button2] 'finder-mouse-select)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
137 (setq finder-mode-map map)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
138
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
139
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
140 ;;; Code for regenerating the keyword list.
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 (defvar finder-package-info nil
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
143 "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
144
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
145 (defvar finder-compile-keywords-quiet nil
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
146 "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
147
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
148 (defun finder-compile-keywords (&rest dirs)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
149 "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
150 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
151 arguments compiles from `load-path'."
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
152 (save-excursion
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
153 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
154 (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
155 (let ((processed nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
156 (directory-abbrev-alist
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
157 (append
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
158 (mapcar (function (lambda (dir)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
159 (cons (concat "^" (regexp-quote dir))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
160 "")))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
161 finder-abbreviate-directory-list)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
162 directory-abbrev-alist))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
163 (using-load-path))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
164 (or dirs (setq dirs load-path))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
165 (setq using-load-path (equal dirs load-path))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
166 (erase-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
167 (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
168 (insert ";; Keywords: help\n")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
169 (insert ";;; Commentary:\n")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
170 (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
171 (insert ";;; Code:\n")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
172 (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
173 (mapc
2984
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
174 (lambda (d)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
175 (mapcar
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
176 (lambda (f)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
177 (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
178 (let (summary keystart keywords)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
179 (setq processed (cons f processed))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
180 (if (not finder-compile-keywords-quiet)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
181 (message "Processing %s ..." f))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
182 (save-excursion
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
183 (set-buffer (get-buffer-create "*finder-scratch*"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
184 (buffer-disable-undo (current-buffer))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
185 (erase-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
186 (insert-file-contents (expand-file-name f d))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
187 (with-trapping-errors
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
188 :operation (format "processing %s in finder" f)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
189 :class 'finder
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
190 (setq summary (lm-synopsis)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
191 keywords (lm-keywords))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
192 (when summary
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
193 (insert (format " (\"%s\"\n " f))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
194 (prin1 summary (current-buffer))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
195 (insert "\n ")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
196 (setq keystart (point))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
197 (insert (if keywords (format "(%s)" keywords) "nil"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
198 (subst-char-in-region keystart (point) ?, ? )
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
199 (insert "\n ")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
200 (prin1 (abbreviate-file-name d) (current-buffer))
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 ;;
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
203 ;; 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
204 ;; 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
205 ;; library directories only.
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
206 (if (and using-load-path
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
207 (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
208 nil
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
209 (setq d (file-name-as-directory (or d ".")))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
210 (directory-files d nil "^[^=].*\\.el$"))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
211 dirs)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
212 (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
213 (kill-buffer "*finder-scratch*")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
214 (unless noninteractive
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
215 (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
216 (basic-save-buffer))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
217
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
218 (defun finder-compile-keywords-make-dist ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
219 "Regenerate `finder-inf.el' for the Emacs distribution."
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
220 (finder-compile-keywords default-directory))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
221
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
222 ;;; Now the retrieval code
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 (defun finder-insert-at-column (column &rest strings)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
225 "Insert list of STRINGS, at column COLUMN."
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
226 (if (>= (current-column) column) (insert "\n"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
227 (move-to-column column)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
228 (let ((col (current-column)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
229 (if (< col column)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
230 (indent-to column)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
231 (if (and (/= col column)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
232 (= (preceding-char) ?\t))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
233 (let (indent-tabs-mode)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
234 (delete-char -1)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
235 (indent-to col)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
236 (move-to-column column)))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
237 (apply 'insert strings))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
238
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
239 (defun finder-list-keywords ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
240 "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
241 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
242 (setq buffer-read-only nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
243 (erase-buffer)
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2984
diff changeset
244 (mapc
2984
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
245 (lambda (assoc)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
246 (let ((keyword (car assoc)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
247 (insert (symbol-name keyword))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
248 (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
249 (cons (symbol-name keyword) keyword)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
250 finder-known-keywords)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
251 (goto-char (point-min))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
252 (setq finder-headmark (point))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
253 (setq buffer-read-only t)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
254 (set-buffer-modified-p nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
255 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
256 (if (not (one-window-p))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
257 (balance-windows))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
258 (finder-summary))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
259
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
260 (defun finder-list-matches (key)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
261 (setq buffer-read-only nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
262 (erase-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
263 (let ((id (intern key)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
264 (insert
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
265 "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
266 (setq finder-headmark (point))
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2984
diff changeset
267 (mapc
2984
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
268 (lambda (x)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
269 (if (memq id (car (cdr (cdr x))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
270 (progn
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
271 (insert (car x))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
272 (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
273 finder-package-info)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
274 (goto-char (point-min))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
275 (forward-line)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
276 (setq buffer-read-only t)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
277 (set-buffer-modified-p nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
278 (shrink-window-if-larger-than-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
279 (finder-summary)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
280
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
281 ;; 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
282 (defun finder-find-library (file)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
283 (if (file-name-absolute-p file)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
284 file
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
285 (let ((dirs load-path)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
286 found)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
287 (while (and dirs (not found))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
288 (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
289 (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
290 (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
291 (setq found (expand-file-name file (car dirs)))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
292 (setq dirs (cdr dirs)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
293 found)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
294
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
295 ;;;###autoload
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
296 (defun finder-commentary (file)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
297 "Display FILE's commentary section.
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
298 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
299 (interactive "sLibrary name: ")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
300 (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
301 (finder-find-library (concat file ".el"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
302 (error "Can't find library %s" file)))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
303 (if (null str)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
304 (error "Can't find any Commentary section"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
305 (pop-to-buffer "*Finder*")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
306 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
307 (setq buffer-read-only nil
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
308 mode-motion-hook 'mode-motion-highlight-line)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
309 (erase-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
310 (insert str)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
311 (goto-char (point-min))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
312 (delete-blank-lines)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
313 (goto-char (point-max))
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-min))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
316 (while (re-search-forward "^;+ ?" nil t)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
317 (replace-match "" nil nil))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
318 (goto-char (point-min))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
319 (setq buffer-read-only t)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
320 (set-buffer-modified-p nil)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
321 (shrink-window-if-larger-than-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
322 (finder-summary)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
323
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
324 (defun finder-current-item ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
325 (if (and finder-headmark (< (point) finder-headmark))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
326 (error "No keyword or filename on this line")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
327 (save-excursion
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
328 (beginning-of-line)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
329 (current-word))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
330
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
331 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
332 (defun finder-edit ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
333 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
334 (let ((entry (finder-current-item)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
335 (if (string-match finder-file-regexp entry)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
336 (let ((path (finder-find-library entry)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
337 (if path
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
338 (find-file-other-window path)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
339 (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
340 ;; a finder keyword
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
341 (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
342
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
343 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
344 (defun finder-view ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
345 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
346 (let ((entry (finder-current-item)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
347 (if (string-match finder-file-regexp entry)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
348 (let ((path (finder-find-library entry)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
349 (if path
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
350 (view-file-other-window path)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
351 (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
352 ;; a finder keyword
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
353 (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
354
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
355 (defun finder-select ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
356 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
357 (let ((key (finder-current-item)))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
358 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
359 (if (string-match finder-file-regexp key)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
360 (finder-commentary key)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
361 (finder-list-matches key))))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
362
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
363 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
364 (defun finder-mouse-select (ev)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
365 (interactive "e")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
366 (goto-char (event-point ev))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
367 (finder-select))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
368
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
369 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
370 ;;;###autoload
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
371 (defun finder-by-keyword ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
372 "Find packages matching a given keyword."
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
373 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
374 (finder-mode)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
375 (finder-list-keywords))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
376
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
377 (defun finder-mode ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
378 "Major mode for browsing package documentation.
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
379 \\<finder-mode-map>
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
380 \\[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
381 \\[finder-edit] edit Lisp library in another window
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
382 \\[finder-view] view Lisp library in another window
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
383 \\[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
384 "
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
385 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
386 (pop-to-buffer "*Finder*")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
387 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
388 (setq buffer-read-only nil
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
389 mode-motion-hook 'mode-motion-highlight-line)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
390 (erase-buffer)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
391 (use-local-map finder-mode-map)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
392 (set-syntax-table emacs-lisp-mode-syntax-table)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
393 (setq mode-name "Finder")
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
394 (setq major-mode 'finder-mode)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
395 (make-local-variable 'finder-headmark)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
396 (setq finder-headmark nil))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
397
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
398 (defun finder-summary ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
399 "Summarize basic Finder commands."
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
400 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
401 (message "%s"
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
402 (substitute-command-keys
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
403 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
404 "\\<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
405
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
406 (defun finder-exit ()
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
407 "Exit Finder mode and kill the buffer."
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
408 (interactive)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
409 ;; XEmacs change
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
410 (or (one-window-p t 0)
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
411 (delete-window))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
412 (kill-buffer "*Finder*"))
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
413
ffa5a6e7f2dd [xemacs-hg @ 2005-10-09 14:23:06 by adrian]
adrian
parents: 2983
diff changeset
414 (provide '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 ;;; finder.el ends here