annotate lisp/finder.el @ 110109:8c2040cb14d7

gnus-html.el (gnus-html-wash-tags): Don't show images that are really small. They're probably tracking images; nntp.el (nntp-request-set-mark): Refuse to do marks if nntp-marks-file-name is nil.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 02 Sep 2010 01:29:42 +0000
parents 8be2f62f7851
children 93141d34a175
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; finder.el --- topic & keyword-based code finder
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
3 ;; Copyright (C) 1992, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106267
diff changeset
4 ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
5
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
6 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
7 ;; Created: 16 Jun 1992
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
8 ;; Version: 1.0
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9 ;; Keywords: help
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94183
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94183
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94183
diff changeset
16 ;; (at your option) any later version.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94183
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
26 ;;; Commentary:
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28 ;; This mode uses the Keywords library header to provide code-finding
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
29 ;; services by keyword.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31 ;;; Code:
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
33 (require 'package)
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34 (require 'lisp-mnt)
110056
8be2f62f7851 Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents: 110017
diff changeset
35 (require 'find-func) ;for find-library(-suffixes)
8be2f62f7851 Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents: 110017
diff changeset
36 (require 'finder-inf nil t)
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
37
25622
4e3d4f5cc358 Comment on finder-known-keywords.
Dave Love <fx@gnu.org>
parents: 25308
diff changeset
38 ;; These are supposed to correspond to top-level customization groups,
4e3d4f5cc358 Comment on finder-known-keywords.
Dave Love <fx@gnu.org>
parents: 25308
diff changeset
39 ;; says rms.
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40 (defvar finder-known-keywords
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
41 '((abbrev . "abbreviation handling, typing shortcuts, and macros")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
42 (bib . "bibliography processors")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
43 (c . "C and related programming languages")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
44 (calendar . "calendar and time management tools")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
45 (comm . "communications, networking, and remote file access")
22295
b2ceb0b98995 (finder-known-keywords): Fix `convenience' entry.
Dave Love <fx@gnu.org>
parents: 22129
diff changeset
46 (convenience . "convenience features for faster editing")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
47 (data . "editing data (non-text) files")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
48 (docs . "Emacs documentation facilities")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
49 (emulations . "emulations of other editors")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 (extensions . "Emacs Lisp language extensions")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
51 (faces . "fonts and colors for text")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
52 (files . "file editing and manipulation")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
53 (frames . "Emacs frames and window systems")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 (games . "games, jokes and amusements")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
55 (hardware . "interfacing with system hardware")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
56 (help . "on-line help systems")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
57 (hypermedia . "links between text or other media types")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
58 (i18n . "internationalization and character-set support")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59 (internal . "code for Emacs internals, build process, defaults")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
60 (languages . "specialized modes for editing programming languages")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
61 (lisp . "Lisp support, including Emacs Lisp")
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
62 (local . "code local to your site")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
63 (maint . "Emacs development tools and aids")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
64 (mail . "email reading and posting")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
65 (matching . "searching, matching, and sorting")
5141
3efae588d663 (finder-known-keywords): Add data, faces, mouse, matching.
Richard M. Stallman <rms@gnu.org>
parents: 3708
diff changeset
66 (mouse . "mouse support")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
67 (multimedia . "images and sound")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
68 (news . "USENET news reading and posting")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
69 (outlines . "hierarchical outlining and note taking")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
70 (processes . "processes, subshells, and compilation")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
71 (terminals . "text terminals (ttys)")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
72 (tex . "the TeX document formatter")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
73 (tools . "programming tools")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
74 (unix . "UNIX feature interfaces and emulators")
108971
d928a6a7c3f2 * lisp/finder.el (finder-known-keywords): Add keyword "vc"
Juri Linkov <juri@jurta.org>
parents: 107467
diff changeset
75 (vc . "version control")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
76 (wp . "word processing")))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
77
54572
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
78 (defvar finder-mode-map
106267
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
79 (let ((map (make-sparse-keymap))
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
80 (menu-map (make-sparse-keymap "Finder")))
54572
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
81 (define-key map " " 'finder-select)
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
82 (define-key map "f" 'finder-select)
66413
4e56b3fda002 * menu-bar.el (menu-bar-help-menu): Rename "psychiatrist", in line
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
83 (define-key map [follow-link] 'mouse-face)
54572
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
84 (define-key map [mouse-2] 'finder-mouse-select)
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
85 (define-key map "\C-m" 'finder-select)
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
86 (define-key map "?" 'finder-summary)
69914
ef1d39034359 (finder-mode-map): Add n and p bindings.
Richard M. Stallman <rms@gnu.org>
parents: 68651
diff changeset
87 (define-key map "n" 'next-line)
ef1d39034359 (finder-mode-map): Add n and p bindings.
Richard M. Stallman <rms@gnu.org>
parents: 68651
diff changeset
88 (define-key map "p" 'previous-line)
54572
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
89 (define-key map "q" 'finder-exit)
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
90 (define-key map "d" 'finder-list-keywords)
106267
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
91
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
92 (define-key map [menu-bar finder-mode]
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
93 (cons "Finder" menu-map))
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
94 (define-key menu-map [finder-exit]
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
95 '(menu-item "Quit" finder-exit
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
96 :help "Exit Finder mode"))
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
97 (define-key menu-map [finder-summary]
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
98 '(menu-item "Summary" finder-summary
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
99 :help "Summary item on current line in a finder buffer"))
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
100 (define-key menu-map [finder-list-keywords]
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
101 '(menu-item "List keywords" finder-list-keywords
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
102 :help "Display descriptions of the keywords in the Finder buffer"))
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
103 (define-key menu-map [finder-select]
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
104 '(menu-item "Select" finder-select
823bbd791783 (finder-mode-map): Add a menu.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105994
diff changeset
105 :help "Select item on current line in a finder buffer"))
54572
2f882266c186 (finder-mode): Follow coding convention.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 54483
diff changeset
106 map))
9200
e48652e64736 (finder-mode-map): Change key bindings:
Richard M. Stallman <rms@gnu.org>
parents: 7943
diff changeset
107
93178
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
108 (defvar finder-mode-syntax-table
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
109 (let ((st (make-syntax-table emacs-lisp-mode-syntax-table)))
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
110 (modify-syntax-entry ?\; ". " st)
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
111 st)
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
112 "Syntax table used while in `finder-mode'.")
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
113
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
114 (defvar finder-font-lock-keywords
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
115 '(("`\\([^'`]+\\)'" 1 font-lock-constant-face prepend))
93178
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
116 "Font-lock keywords for Finder mode.")
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
117
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
118 (defvar finder-headmark nil
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
119 "Internal finder-mode variable, local in finder buffer.")
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
120
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
121 ;;; Code for regenerating the keyword list.
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
122
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
123 (defvar finder-keywords-hash nil
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
124 "Hash table mapping keywords to lists of package names.
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
125 Keywords and package names both should be symbols.")
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
126
48991
d3a44c8bd8d2 * finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents: 48688
diff changeset
127 (defvar generated-finder-keywords-file "finder-inf.el"
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
128 "The function `finder-compile-keywords' writes keywords into this file.")
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
129
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
130 ;; Skip autogenerated files, because they will never contain anything
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
131 ;; useful, and because in parallel builds of Emacs they may get
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
132 ;; modified while we are trying to read them.
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
133 ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-01/msg00469.html
96163
afc4aa03c2d5 (finder-no-scan-regexp): Add ldefs-boot.el
Glenn Morris <rgm@gnu.org>
parents: 95750
diff changeset
134 ;; ldefs-boot is not auto-generated, but has nothing useful.
afc4aa03c2d5 (finder-no-scan-regexp): Add ldefs-boot.el
Glenn Morris <rgm@gnu.org>
parents: 95750
diff changeset
135 (defvar finder-no-scan-regexp "\\(^\\.#\\|\\(loaddefs\\|ldefs-boot\\|\
afc4aa03c2d5 (finder-no-scan-regexp): Add ldefs-boot.el
Glenn Morris <rgm@gnu.org>
parents: 95750
diff changeset
136 cus-load\\|finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)"
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
137 "Regexp matching file names not to scan for keywords.")
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
138
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
139 (autoload 'autoload-rubric "autoload")
48991
d3a44c8bd8d2 * finder.el (generated-finder-keywords-file): New variable.
Andreas Schwab <schwab@suse.de>
parents: 48688
diff changeset
140
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
141 (defvar finder--builtins-alist
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
142 '(("calc" . calc)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
143 ("ede" . ede)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
144 ("erc" . erc)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
145 ("eshell" . eshell)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
146 ("gnus" . gnus)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
147 ("international" . emacs)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
148 ("language" . emacs)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
149 ("mh-e" . mh-e)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
150 ("semantic" . semantic)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
151 ("analyze" . semantic)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
152 ("bovine" . semantic)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
153 ("decorate" . semantic)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
154 ("symref" . semantic)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
155 ("wisent" . semantic)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
156 ("nxml" . nxml)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
157 ("org" . org)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
158 ("srecode" . srecode)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
159 ("term" . emacs)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
160 ("url" . url))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
161 "Alist of built-in package directories.
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
162 Each element should have the form (DIR . PACKAGE), where DIR is a
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
163 directory name and PACKAGE is the name of a package (a symbol).
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
164 When generating `package--builtins', Emacs assumes any file in
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
165 DIR is part of the package PACKAGE.")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
166
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
167 (defun finder-compile-keywords (&rest dirs)
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
168 "Regenerate list of built-in Emacs packages.
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
169 This recomputes `package--builtins' and `finder-keywords-hash',
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
170 and prints them into the file `generated-finder-keywords-file'.
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
171
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
172 Optional DIRS is a list of Emacs Lisp directories to compile
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
173 from; the default is `load-path'."
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
174 ;; Allow compressed files also.
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
175 (setq package--builtins nil)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
176 (setq finder-keywords-hash (make-hash-table :test 'eq))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
177 (let ((el-file-regexp "^\\([^=].*\\)\\.el\\(\\.\\(gz\\|Z\\)\\)?$")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
178 package-override files base-name processed
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
179 summary keywords package version entry desc)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
180 (dolist (d (or dirs load-path))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
181 (when (file-exists-p (directory-file-name d))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
182 (message "Directory %s" d)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
183 (setq package-override
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
184 (intern-soft
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
185 (cdr-safe
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
186 (assoc (file-name-nondirectory (directory-file-name d))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
187 finder--builtins-alist))))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
188 (setq files (directory-files d nil el-file-regexp))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
189 (dolist (f files)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
190 (unless (or (string-match finder-no-scan-regexp f)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
191 (null (setq base-name
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
192 (and (string-match el-file-regexp f)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
193 (intern (match-string 1 f)))))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
194 (memq base-name processed))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
195 (push base-name processed)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
196 (with-temp-buffer
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
197 (insert-file-contents (expand-file-name f d))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
198 (setq summary (lm-synopsis)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
199 keywords (mapcar 'intern (lm-keywords-list))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
200 package (or package-override
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
201 (intern-soft (lm-header "package"))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
202 base-name)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
203 version (lm-header "version")))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
204 (when summary
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
205 (setq version (ignore-errors (version-to-list version)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
206 (setq entry (assq package package--builtins))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
207 (cond ((null entry)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
208 (push (cons package (vector version nil summary))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
209 package--builtins))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
210 ((eq base-name package)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
211 (setq desc (cdr entry))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
212 (aset desc 0 version)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
213 (aset desc 2 summary)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
214 (dolist (kw keywords)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
215 (puthash kw
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
216 (cons package
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
217 (delq package
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
218 (gethash kw finder-keywords-hash)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
219 finder-keywords-hash))))))))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
220
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
221 (setq package--builtins
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
222 (sort package--builtins
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
223 (lambda (a b) (string< (symbol-name (car a))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
224 (symbol-name (car b))))))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
225
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
226 (save-excursion
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
227 (find-file generated-finder-keywords-file)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
228 (setq buffer-undo-list t)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
229 (erase-buffer)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
230 (insert (autoload-rubric generated-finder-keywords-file
105859
658336850f93 Use autoload-rubric's feature argument.
Glenn Morris <rgm@gnu.org>
parents: 102450
diff changeset
231 "keyword-to-package mapping" t))
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
232 (search-backward " ")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
233 (insert "(setq package--builtins '(\n")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
234 (dolist (package package--builtins)
110056
8be2f62f7851 Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents: 110017
diff changeset
235 (insert " ")
8be2f62f7851 Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents: 110017
diff changeset
236 (prin1 package (current-buffer))
8be2f62f7851 Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents: 110017
diff changeset
237 (insert "\n"))
8be2f62f7851 Fix several Package Menu and Finder bugs.
Chong Yidong <cyd@stupidchicken.com>
parents: 110017
diff changeset
238 (insert "))\n\n")
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
239 ;; Insert hash table.
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
240 (insert "(setq finder-keywords-hash\n ")
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
241 (prin1 finder-keywords-hash (current-buffer))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
242 (insert ")\n")
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
243 (basic-save-buffer)))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
244
14669
6feeb4e59815 (finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14599
diff changeset
245 (defun finder-compile-keywords-make-dist ()
6feeb4e59815 (finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14599
diff changeset
246 "Regenerate `finder-inf.el' for the Emacs distribution."
17745
ae0f1e4a63be (finder-compile-keywords-make-dist):
Richard M. Stallman <rms@gnu.org>
parents: 14669
diff changeset
247 (apply 'finder-compile-keywords command-line-args-left)
ae0f1e4a63be (finder-compile-keywords-make-dist):
Richard M. Stallman <rms@gnu.org>
parents: 14669
diff changeset
248 (kill-emacs))
14669
6feeb4e59815 (finder-compile-keywords-make-dist): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14599
diff changeset
249
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
250 ;;; Now the retrieval code
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
251
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
252 (defun finder-insert-at-column (column &rest strings)
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
253 "Insert, at column COLUMN, other args STRINGS."
38359
29beb6347e09 (finder-insert-at-column): Also move to the next line if exactly at COLUMN.
Miles Bader <miles@gnu.org>
parents: 33420
diff changeset
254 (if (>= (current-column) column) (insert "\n"))
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
255 (move-to-column column t)
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
256 (apply 'insert strings))
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
257
33420
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
258 (defvar finder-help-echo nil)
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
259
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
260 (defun finder-mouse-face-on-line ()
33420
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
261 "Put `mouse-face' and `help-echo' properties on the previous line."
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
262 (save-excursion
84659
76e7ca025173 (finder-compile-keywords): Fix up comment style.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
263 (forward-line -1)
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
264 ;; If finder-insert-at-column moved us to a new line, go back one more.
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
265 (if (looking-at "[ \t]") (forward-line -1))
33420
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
266 (unless finder-help-echo
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
267 (setq finder-help-echo
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
268 (let* ((keys1 (where-is-internal 'finder-select
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
269 finder-mode-map))
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
270 (keys (nconc (where-is-internal
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
271 'finder-mouse-select finder-mode-map)
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
272 keys1)))
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
273 (concat (mapconcat 'key-description keys ", ")
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
274 ": select item"))))
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
275 (add-text-properties
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
276 (line-beginning-position) (line-end-position)
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
277 '(mouse-face highlight
cc332f3565f2 (finder-known-keywords): Add `files', remove `vms'.
Dave Love <fx@gnu.org>
parents: 30883
diff changeset
278 help-echo finder-help-echo))))
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
279
107391
78dd74750b2b Add finder unknown keywords.
Juri Linkov <juri@jurta.org>
parents: 107390
diff changeset
280 (defun finder-unknown-keywords ()
78dd74750b2b Add finder unknown keywords.
Juri Linkov <juri@jurta.org>
parents: 107390
diff changeset
281 "Return an alist of unknown keywords and number of their occurences.
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
282 Unknown keywords are those present in `finder-keywords-hash' but
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
283 not `finder-known-keywords'."
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
284 (let (alist)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
285 (maphash (lambda (kw packages)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
286 (unless (assq kw finder-known-keywords)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
287 (push (cons kw (length packages)) alist)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
288 finder-keywords-hash)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
289 (sort alist (lambda (a b) (string< (car a) (car b))))))
107391
78dd74750b2b Add finder unknown keywords.
Juri Linkov <juri@jurta.org>
parents: 107390
diff changeset
290
28528
7618c3801a21 (finder-commentary): Add autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 26675
diff changeset
291 ;;;###autoload
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
292 (defun finder-list-keywords ()
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
293 "Display descriptions of the keywords in the Finder buffer."
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
294 (interactive)
18226
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
295 (if (get-buffer "*Finder*")
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
296 (pop-to-buffer "*Finder*")
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
297 (pop-to-buffer (get-buffer-create "*Finder*"))
18226
37ff8dfff53b (finder-mode): Don't switch buffers or change text here.
Richard M. Stallman <rms@gnu.org>
parents: 17745
diff changeset
298 (finder-mode)
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
299 (let ((inhibit-read-only t))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
300 (erase-buffer)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
301 (dolist (assoc finder-known-keywords)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
302 (let ((keyword (car assoc)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
303 (insert (propertize (symbol-name keyword)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
304 'font-lock-face 'font-lock-constant-face))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
305 (finder-insert-at-column 14 (concat (cdr assoc) "\n"))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
306 (finder-mouse-face-on-line)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
307 (goto-char (point-min))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
308 (setq finder-headmark (point)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
309 buffer-read-only t)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
310 (set-buffer-modified-p nil)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
311 (balance-windows)
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
312 (finder-summary))))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
313
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
314 (defun finder-list-matches (key)
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
315 (let* ((id (intern key))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
316 (packages (gethash id finder-keywords-hash)))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
317 (unless packages
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
318 (error "No packages matching key `%s'" key))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
319 (package--list-packages packages)))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
320
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
321 (define-button-type 'finder-xref 'action #'finder-goto-xref)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
322
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
323 (defun finder-goto-xref (button)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
324 "Jump to a lisp file for the BUTTON at point."
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
325 (let* ((file (button-get button 'xref))
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
326 (lib (locate-library file)))
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
327 (if lib (finder-commentary lib)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
328 (message "Unable to locate `%s'" file))))
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
329
28528
7618c3801a21 (finder-commentary): Add autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 26675
diff changeset
330 ;;;###autoload
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
331 (defun finder-commentary (file)
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
332 "Display FILE's commentary section.
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
333 FILE should be in a form suitable for passing to `locate-library'."
47419
0e00286fe517 (finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44105
diff changeset
334 (interactive
0e00286fe517 (finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44105
diff changeset
335 (list
0e00286fe517 (finder-find-library): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 44105
diff changeset
336 (completing-read "Library name: "
94183
bade431b9780 * finder.el (finder-commentary):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93178
diff changeset
337 (apply-partially 'locate-file-completion-table
bade431b9780 * finder.el (finder-commentary):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93178
diff changeset
338 (or find-function-source-path load-path)
bade431b9780 * finder.el (finder-commentary):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93178
diff changeset
339 (find-library-suffixes)))))
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
340 (let ((str (lm-commentary (find-library-name file))))
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
341 (or str (error "Can't find any Commentary section"))
48408
2eb7a3846b4c (finder-commentary): Use buffer *Finder-package*.
Richard M. Stallman <rms@gnu.org>
parents: 47825
diff changeset
342 ;; This used to use *Finder* but that would clobber the
2eb7a3846b4c (finder-commentary): Use buffer *Finder-package*.
Richard M. Stallman <rms@gnu.org>
parents: 47825
diff changeset
343 ;; directory of categories.
2eb7a3846b4c (finder-commentary): Use buffer *Finder-package*.
Richard M. Stallman <rms@gnu.org>
parents: 47825
diff changeset
344 (pop-to-buffer "*Finder-package*")
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
345 (setq buffer-read-only nil
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
346 buffer-undo-list t)
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
347 (erase-buffer)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
348 (insert str)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
349 (goto-char (point-min))
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
350 (delete-blank-lines)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
351 (goto-char (point-max))
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
352 (delete-blank-lines)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
353 (goto-char (point-min))
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
354 (while (re-search-forward "^;+ ?" nil t)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
355 (replace-match "" nil nil))
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
356 (goto-char (point-min))
95750
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
357 (while (re-search-forward "\\<\\([-[:alnum:]]+\\.el\\)\\>" nil t)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
358 (if (locate-library (match-string 1))
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
359 (make-text-button (match-beginning 1) (match-end 1)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
360 'xref (match-string-no-properties 1)
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
361 'help-echo "Read this file's commentary"
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
362 :type 'finder-xref)))
6c14c564fa23 (finder-font-lock-keywords): Handle ``quotes''.
Glenn Morris <rgm@gnu.org>
parents: 95629
diff changeset
363 (goto-char (point-min))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
364 (setq buffer-read-only t)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
365 (set-buffer-modified-p nil)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
366 (shrink-window-if-larger-than-buffer)
26675
995b6841718b (finder-commentary): Activate Finder mode.
Gerd Moellmann <gerd@gnu.org>
parents: 25622
diff changeset
367 (finder-mode)
14599
1de3a922cfe0 Removed (require 'picture).
Erik Naggum <erik@naggum.no>
parents: 14313
diff changeset
368 (finder-summary)))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
369
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
370 (defun finder-current-item ()
60746
23533546bb38 (finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents: 54572
diff changeset
371 (let ((key (save-excursion
23533546bb38 (finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents: 54572
diff changeset
372 (beginning-of-line)
23533546bb38 (finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents: 54572
diff changeset
373 (current-word))))
23533546bb38 (finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents: 54572
diff changeset
374 (if (or (and finder-headmark (< (point) finder-headmark))
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
375 (zerop (length key)))
60746
23533546bb38 (finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents: 54572
diff changeset
376 (error "No keyword or filename on this line")
23533546bb38 (finder-current-item): Throw an error on an empty line.
Eli Zaretskii <eliz@gnu.org>
parents: 54572
diff changeset
377 key)))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
378
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
379 (defun finder-select ()
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
380 "Select item on current line in a finder buffer."
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
381 (interactive)
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
382 (let ((key (finder-current-item)))
20009
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
383 (if (string-match "\\.el$" key)
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
384 (finder-commentary key)
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
385 (finder-list-matches key))))
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
386
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
387 (defun finder-mouse-select (event)
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
388 "Select item in a finder buffer with the mouse."
20009
09bc233eb018 (finder-mode-map): Bind [mouse-2].
Karl Heuer <kwzh@gnu.org>
parents: 19169
diff changeset
389 (interactive "e")
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105859
diff changeset
390 (with-current-buffer (window-buffer (posn-window (event-start event)))
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
391 (goto-char (posn-point (event-start event)))
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
392 (finder-select)))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
393
28528
7618c3801a21 (finder-commentary): Add autoload cookie.
Gerd Moellmann <gerd@gnu.org>
parents: 26675
diff changeset
394 ;;;###autoload
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
395 (defun finder-by-keyword ()
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
396 "Find packages matching a given keyword."
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
397 (interactive)
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
398 (finder-list-keywords))
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
399
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
400 (define-derived-mode finder-mode nil "Finder"
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
401 "Major mode for browsing package documentation.
2716
acd678e58602 * finder.el: Bind finder-exit to 'q', not 'x'; the former is the
Jim Blandy <jimb@redhat.com>
parents: 2527
diff changeset
402 \\<finder-mode-map>
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
403 \\[finder-select] more help for the item on the current line
24221
efc15742dcc3 (finder-commentary): Fix interactive spec. Try
Dave Love <fx@gnu.org>
parents: 22295
diff changeset
404 \\[finder-exit] exit Finder mode and kill the Finder buffer."
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
405 :syntax-table finder-mode-syntax-table
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
406 (setq buffer-read-only t
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
407 buffer-undo-list t)
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
408 (set (make-local-variable 'finder-headmark) nil))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
409
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
410 (defun finder-summary ()
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
411 "Summarize basic Finder commands."
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
412 (interactive)
14313
8e13f59d2c19 (finder-summary): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
413 (message "%s"
2716
acd678e58602 * finder.el: Bind finder-exit to 'q', not 'x'; the former is the
Jim Blandy <jimb@redhat.com>
parents: 2527
diff changeset
414 (substitute-command-keys
21805
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
415 "\\<finder-mode-map>\\[finder-select] = select, \
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
416 \\[finder-mouse-select] = select, \\[finder-list-keywords] = to \
aafa93c1a5ce (finder-insert-at-column): Simplify.
Dave Love <fx@gnu.org>
parents: 21758
diff changeset
417 finder directory, \\[finder-exit] = quit, \\[finder-summary] = help")))
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
418
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
419 (defun finder-exit ()
93178
6c44d22f4d83 (finder-mode-syntax-table, finder-font-lock-keywords): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
420 "Exit Finder mode.
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
421 Delete the window and kill all Finder-related buffers."
2527
93015b63b041 Rewritten. The Finder is now a major mode with the ability to browse
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2502
diff changeset
422 (interactive)
95555
97c7d857b5e3 (finder-headmark): Initialize and add doc string.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
423 (ignore-errors (delete-window))
110017
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
424 (let ((buf "*Finder*"))
10e66ac64b61 Merge Finder and package-menu functionality.
Chong Yidong <cyd@stupidchicken.com>
parents: 108971
diff changeset
425 (and (get-buffer buf) (kill-buffer buf))))
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
426
30883
869204bacd5f Add local-variable settings to the generated file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 28528
diff changeset
427
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
428 (provide 'finder)
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
429
84659
76e7ca025173 (finder-compile-keywords): Fix up comment style.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 78236
diff changeset
430 ;; arch-tag: ec85ff49-8cb8-41f5-a63f-9131d53ce2c5
867
f120dd3a71b0 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
431 ;;; finder.el ends here