Mercurial > emacs
annotate lisp/speedbar.el @ 67745:1c2cd41aeda7
(customize-browse): Reword the top-of-buffer help intro.
(custom-buffer-create-internal): Fix previous change.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 23 Dec 2005 01:21:08 +0000 |
parents | d02e0d3b5db9 |
children | 3bd95f4f2941 7beb78bc1f8e |
rev | line source |
---|---|
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1 ;;; speedbar --- quick access to files and tags in a frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3 ;;; Copyright (C) 1996, 97, 98, 99, 00, 01, 02, 03, 04, 05 Free Software Foundation |
22735 | 4 |
5 ;; Author: Eric M. Ludlam <zappo@gnu.org> | |
6 ;; Keywords: file, tags, tools | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
7 |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
8 (defvar speedbar-version "1.0" |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
9 "The current version of speedbar.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
10 (defvar speedbar-incompatible-version "0.14beta4" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
11 "This version of speedbar is incompatible with this version. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
12 Due to massive API changes (removing the use of the word PATH) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
13 this version is not backward compatible to 0.14 or earlier.") |
22735 | 14 |
21650 | 15 ;; This file is part of GNU Emacs. |
22735 | 16 |
21650 | 17 ;; GNU Emacs is free software; you can redistribute it and/or modify |
18 ;; it under the terms of the GNU General Public License as published by | |
19 ;; the Free Software Foundation; either version 2, or (at your option) | |
20 ;; any later version. | |
22735 | 21 |
21650 | 22 ;; GNU Emacs is distributed in the hope that it will be useful, |
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 ;; GNU General Public License for more details. | |
22735 | 26 |
21650 | 27 ;; You should have received a copy of the GNU General Public License |
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
65780
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
29 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
30 ;; Boston, MA 02110-1301, USA. |
21650 | 31 |
32 ;;; Commentary: | |
33 ;; | |
34 ;; The speedbar provides a frame in which files, and locations in | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
35 ;; files are displayed. These items can be clicked on with mouse-2 in |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
36 ;; to display that file location. |
21650 | 37 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
38 ;;; Customizing and Developing for speedbar |
21650 | 39 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
40 ;; Please see the speedbar manual for informaion. |
21650 | 41 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
42 ;;; Notes: |
21650 | 43 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
44 ;; Users of really old emacsen without the need timer functions |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
45 ;; will not have speedbar updating automatically. Use "g" to refresh |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
46 ;; the display after changing directories. Remember, do not interrupt |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
47 ;; the stealthy updates or your display may not be completely |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
48 ;; refreshed. |
21650 | 49 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
50 ;; AUC-TEX users: The imenu tags for AUC-TEX mode don't work very |
21650 | 51 ;; well. Use the imenu keywords from tex-mode.el for better results. |
52 ;; | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
53 ;; This file requires the library package assoc (association lists) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
54 ;; assoc should be available in all modern versions of Emacs. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
55 ;; The custom package is optional (for easy configuration of speedbar) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
56 ;; http://www.dina.kvl.dk/~abraham/custom/ |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
57 ;; custom is available in all versions of Emacs version 20 or better. |
22735 | 58 ;; |
21650 | 59 |
60 ;;; TODO: | |
61 ;; - Timeout directories we haven't visited in a while. | |
62 | |
63 (require 'assoc) | |
64 (require 'easymenu) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
65 (require 'dframe) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
66 (require 'sb-image) |
22735 | 67 |
21650 | 68 ;; customization stuff |
69 (defgroup speedbar nil | |
70 "File and tag browser frame." | |
48380
d2b6a3d52d08
(defgroup speedbar): Use group 'etags instead of nonexisting group
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47627
diff
changeset
|
71 :group 'etags |
21658
d8a81542dbf9
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21650
diff
changeset
|
72 :group 'tools |
22250
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21658
diff
changeset
|
73 :group 'convenience |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
74 ; :version "20.3" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
75 ) |
21650 | 76 |
77 (defgroup speedbar-faces nil | |
78 "Faces used in speedbar." | |
79 :prefix "speedbar-" | |
80 :group 'speedbar | |
81 :group 'faces) | |
82 | |
83 (defgroup speedbar-vc nil | |
84 "Version control display in speedbar." | |
85 :prefix "speedbar-" | |
86 :group 'speedbar) | |
87 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
88 ;;; Code: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
89 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
90 ;; Note: `inversion-test' requires parts of the CEDET package that are |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
91 ;; not included with Emacs. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
92 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
93 ;; (defun speedbar-require-version (major minor &optional beta) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
94 ;; "Non-nil if this version of SPEEDBAR does not satisfy a specific version. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
95 ;; Arguments can be: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
96 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
97 ;; (MAJOR MINOR &optional BETA) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
98 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
99 ;; Values MAJOR and MINOR must be integers. BETA can be an integer, or |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
100 ;; excluded if a released version is required. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
101 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
102 ;; It is assumed that if the current version is newer than that specified, |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
103 ;; everything passes. Exceptions occur when known incompatibilities are |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
104 ;; introduced." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
105 ;; (inversion-test 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
106 ;; (concat major "." minor |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
107 ;; (when beta (concat "beta" beta))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
108 |
22735 | 109 (defvar speedbar-initial-expansion-mode-alist |
110 '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map | |
111 speedbar-buffer-buttons) | |
112 ("quick buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map | |
113 speedbar-buffer-buttons-temp) | |
114 ;; Files last, means first in the Displays menu | |
115 ("files" speedbar-easymenu-definition-special speedbar-file-key-map | |
116 speedbar-directory-buttons speedbar-default-directory-list) | |
117 ) | |
118 "List of named expansion elements for filling the speedbar frame. | |
119 These expansion lists are only valid for regular files. Special modes | |
120 still get to override this list on a mode-by-mode basis. This list of | |
121 lists is of the form (NAME MENU KEYMAP FN1 FN2 ...). NAME is a string | |
122 representing the types of things to be displayed. MENU is an easymenu | |
123 structure used when in this mode. KEYMAP is a local keymap to install | |
124 over the regular speedbar keymap. FN1 ... are functions that will be | |
125 called in order. These functions will always get the default | |
126 directory to use passed in as the first parameter, and a 0 as the | |
127 second parameter. The 0 indicates the uppermost indentation level. | |
128 They must assume that the cursor is at the position where they start | |
129 inserting buttons.") | |
21650 | 130 |
23372
64e80b07376b
(speedbar-frame-mode): Check if cfx or cfy is a list, and make sure it
Eric M. Ludlam <zappo@gnu.org>
parents:
23275
diff
changeset
|
131 (defvar speedbar-initial-expansion-list-name "files" |
22735 | 132 "A symbol name representing the expansion list to use. |
133 The expansion list `speedbar-initial-expansion-mode-alist' contains | |
23372
64e80b07376b
(speedbar-frame-mode): Check if cfx or cfy is a list, and make sure it
Eric M. Ludlam <zappo@gnu.org>
parents:
23275
diff
changeset
|
134 the names and associated functions to use for buttons in speedbar.") |
22735 | 135 |
136 (defvar speedbar-previously-used-expansion-list-name "files" | |
137 "Save the last expansion list method. | |
138 This is used for returning to a previous expansion list method when | |
139 the user is done with the current expansion list.") | |
21650 | 140 |
141 (defvar speedbar-stealthy-function-list | |
22735 | 142 '(("files" |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
143 speedbar-update-current-file |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
144 speedbar-check-read-only |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
145 speedbar-check-vc |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
146 speedbar-check-objects) |
22735 | 147 ) |
21650 | 148 "List of functions to periodically call stealthily. |
22735 | 149 This list is of the form: |
150 '( (\"NAME\" FUNCTION ...) | |
151 ...) | |
152 where NAME is the name of the major display mode these functions are | |
153 for, and the remaining elements FUNCTION are functions to call in order. | |
21650 | 154 Each function must return nil if interrupted, or t if completed. |
155 Stealthy functions which have a single operation should always return | |
156 t. Functions which take a long time should maintain a state (where | |
157 they are in their speedbar related calculations) and permit | |
158 interruption. See `speedbar-check-vc' as a good example.") | |
159 | |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
160 (defvar speedbar-mode-functions-list |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
161 '(("files" (speedbar-item-info . speedbar-files-item-info) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
162 (speedbar-line-directory . speedbar-files-line-directory)) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
163 ("buffers" (speedbar-item-info . speedbar-buffers-item-info) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
164 (speedbar-line-directory . speedbar-buffers-line-directory)) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
165 ("quick buffers" (speedbar-item-info . speedbar-buffers-item-info) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
166 (speedbar-line-directory . speedbar-buffers-line-directory)) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
167 ) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
168 "List of function tables to use for different major display modes. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
169 It is not necessary to define any functions for a specialized mode. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
170 This just provides a simple way of adding lots of customizations. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
171 Each sublist is of the form: |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
172 (\"NAME\" (FUNCTIONSYMBOL . REPLACEMENTFUNCTION) ...) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
173 Where NAME is the name of the specialized mode. The rest of the list |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
174 is a set of dotted pairs of the form FUNCTIONSYMBOL, which is the name |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
175 of a function you would like to replace, and REPLACEMENTFUNCTION, |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
176 which is a function you can call instead. Not all functions can be |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
177 replaced this way. Replaceable functions must provide that |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
178 functionality individually.") |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
179 |
21650 | 180 (defcustom speedbar-mode-specific-contents-flag t |
181 "*Non-nil means speedbar will show special mode contents. | |
182 This permits some modes to create customized contents for the speedbar | |
183 frame." | |
184 :group 'speedbar | |
185 :type 'boolean) | |
186 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
187 (defcustom speedbar-query-confirmation-method 'all |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
188 "*Query control for file operations. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
189 The 'always flag means to always query before file operations. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
190 The 'none-but-delete flag means to not query before any file |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
191 operations, except before a file deletion." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
192 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
193 :type '(radio (const :tag "Always Query before some file operations." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
194 all) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
195 (const :tag "Never Query before file operations, except for deletions." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
196 none-but-delete) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
197 ;;;; (const :tag "Never Every Query." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
198 ;;;; none) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
199 )) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
200 |
21650 | 201 (defvar speedbar-special-mode-expansion-list nil |
22735 | 202 "Default function list for creating specialized button lists. |
203 This list is set by modes that wish to have special speedbar displays. | |
204 The list is of function names. Each function is called with one | |
205 parameter BUFFER, the originating buffer. The current buffer is the | |
206 speedbar buffer.") | |
21650 | 207 |
22735 | 208 (defvar speedbar-special-mode-key-map nil |
209 "Default keymap used when identifying a specialized display mode. | |
210 This keymap is local to each buffer that wants to define special keybindings | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
211 effective when its display is shown.") |
21650 | 212 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
213 (defcustom speedbar-before-visiting-file-hook '(push-mark) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
214 "*Hooks run before speedbar visits a file in the selected frame. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
215 The default buffer is the buffer in the selected window in the attached frame." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
216 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
217 :type 'hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
218 |
21650 | 219 (defcustom speedbar-visiting-file-hook nil |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
220 "*Hooks run when speedbar visits a file in the selected frame." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
221 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
222 :type 'hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
223 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
224 (defcustom speedbar-before-visiting-tag-hook '(push-mark) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
225 "*Hooks run before speedbar visits a tag in the selected frame. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
226 The default buffer is the buffer in the selected window in the attached frame." |
21650 | 227 :group 'speedbar |
228 :type 'hook) | |
229 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
230 (defcustom speedbar-visiting-tag-hook '(speedbar-highlight-one-tag-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
231 "*Hooks run when speedbar visits a tag in the selected frame." |
21650 | 232 :group 'speedbar |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
233 :type 'hook |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
234 :options '(speedbar-highlight-one-tag-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
235 speedbar-recenter-to-top |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
236 speedbar-recenter |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
237 )) |
21650 | 238 |
239 (defcustom speedbar-load-hook nil | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
240 "*Hooks run when speedbar is loaded." |
21650 | 241 :group 'speedbar |
242 :type 'hook) | |
243 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
244 (defcustom speedbar-reconfigure-keymaps-hook nil |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
245 "*Hooks run when the keymaps are regenerated." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
246 :group 'speedbar |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
247 :type 'hook) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
248 |
21650 | 249 (defcustom speedbar-show-unknown-files nil |
250 "*Non-nil show files we can't expand with a ? in the expand button. | |
251 nil means don't show the file in the list." | |
252 :group 'speedbar | |
253 :type 'boolean) | |
254 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
255 ;;; EVENTUALLY REMOVE THESE |
21650 | 256 |
22735 | 257 ;; When I moved to a repeating timer, I had the horrible missfortune |
258 ;; of loosing the ability for adaptive speed choice. This update | |
259 ;; speed currently causes long delays when it should have been turned off. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
260 (defvar speedbar-update-speed dframe-update-speed |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
261 "*Obsoleted variable. Use `dframe-update-speed'.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
262 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
263 (defvar speedbar-navigating-speed dframe-update-speed |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
264 "*Obsoleted variable. Use `dframe-update-speed'.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
265 ;;; END REMOVE THESE |
21650 | 266 |
267 (defcustom speedbar-frame-parameters '((minibuffer . nil) | |
268 (width . 20) | |
269 (border-width . 0) | |
270 (menu-bar-lines . 0) | |
36047
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
271 (tool-bar-lines . 0) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
272 (unsplittable . t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
273 (left-fringe . 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
274 ) |
21650 | 275 "*Parameters to use when creating the speedbar frame in Emacs. |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
276 Any parameter supported by a frame may be added. The parameter `height' |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
277 will be initialized to the height of the frame speedbar is |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
278 attached to and added to this list before the new frame is initialized." |
21650 | 279 :group 'speedbar |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
280 :type '(repeat (cons :format "%v" |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
281 (symbol :tag "Parameter") |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
282 (sexp :tag "Value")))) |
21650 | 283 |
284 ;; These values by Hrvoje Niksic <hniksic@srce.hr> | |
285 (defcustom speedbar-frame-plist | |
286 '(minibuffer nil width 20 border-width 0 | |
287 internal-border-width 0 unsplittable t | |
288 default-toolbar-visible-p nil has-modeline-p nil | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
289 menubar-visible-p nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
290 default-gutter-visible-p nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
291 ) |
21650 | 292 "*Parameters to use when creating the speedbar frame in XEmacs. |
293 Parameters not listed here which will be added automatically are | |
294 `height' which will be initialized to the height of the frame speedbar | |
295 is attached to." | |
296 :group 'speedbar | |
297 :type '(repeat (group :inline t | |
298 (symbol :tag "Property") | |
299 (sexp :tag "Value")))) | |
300 | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
301 (defcustom speedbar-use-imenu-flag (fboundp 'imenu) |
21650 | 302 "*Non-nil means use imenu for file parsing. nil to use etags. |
303 XEmacs prior to 20.4 doesn't support imenu, therefore the default is to | |
304 use etags instead. Etags support is not as robust as imenu support." | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
305 :tag "Use Imenu for tags" |
21650 | 306 :group 'speedbar |
307 :type 'boolean) | |
308 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
309 (defvar speedbar-dynamic-tags-function-list |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
310 '((speedbar-fetch-dynamic-imenu . speedbar-insert-imenu-list) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
311 (speedbar-fetch-dynamic-etags . speedbar-insert-etags-list)) |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
312 "Set to a list of functions which will return and insert a list of tags. |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
313 Each element is of the form ( FETCH . INSERT ) where FETCH |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
314 is a function which takes one parameter (the file to tag) and returns a |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
315 list of tags. The tag list can be of any form as long as the |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
316 corresponding insert method can handle it. If it returns t, then an |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
317 error occurred, and the next fetch routine is tried. |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
318 INSERT is a function which takes an INDENTation level, and a LIST of |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
319 tags to insert. It will then create the speedbar buttons.") |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
320 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
321 (defcustom speedbar-use-tool-tips-flag (and (not (featurep 'xemacs)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
322 (>= emacs-major-version 21)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
323 "*Non-nil means to use tool tips if they are avaialble. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
324 When tooltips are not available, mouse-tracking and minibuffer |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
325 display is used instead." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
326 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
327 :type 'boolean) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
328 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
329 (defcustom speedbar-track-mouse-flag (not speedbar-use-tool-tips-flag) |
22735 | 330 "*Non-nil means to display info about the line under the mouse." |
331 :group 'speedbar | |
332 :type 'boolean) | |
333 | |
67227
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
334 (defcustom speedbar-default-position 'left-right |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
335 "*Default position of the speedbar frame. |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
336 Possible values are 'left, 'right or 'left-right. |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
337 If value is 'left-right, the most suitable location is |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
338 determined automatically." |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
339 :group 'speedbar |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
340 :type '(radio (const :tag "Automatic" left-right) |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
341 (const :tag "Left" left) |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
342 (const :tag "Right" right))) |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
343 |
21650 | 344 (defcustom speedbar-sort-tags nil |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
345 "*If non-nil, sort tags in the speedbar display. *Obsolete*. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
346 Use `semantic-tag-hierarchy-method' instead." |
21650 | 347 :group 'speedbar |
348 :type 'boolean) | |
349 | |
22735 | 350 (defcustom speedbar-tag-hierarchy-method |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
351 '(speedbar-prefix-group-tag-hierarchy |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
352 speedbar-trim-words-tag-hierarchy) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
353 "*List of hooks which speedbar will use to organize tags into groups. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
354 Groups are defined as expandable meta-tags. Imenu supports |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
355 such things in some languages, such as separating variables from |
46286
6117ca314143
(speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
46282
diff
changeset
|
356 functions. Each hook takes one argument LST, and may destructively |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
357 create a new list of the same form. LST is a list of elements of the |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
358 form: |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
359 (ELT1 ELT2 ... ELTn) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
360 where each ELT is of the form |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
361 (TAG-NAME-STRING . NUMBER-OR-MARKER) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
362 or |
46286
6117ca314143
(speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
46282
diff
changeset
|
363 (GROUP-NAME-STRING ELT1 ELT2... ELTn)" |
22735 | 364 :group 'speedbar |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
365 :type 'hook |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
366 :options '(speedbar-prefix-group-tag-hierarchy |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
367 speedbar-trim-words-tag-hierarchy |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
368 speedbar-simple-group-tag-hierarchy |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
369 speedbar-sort-tag-hierarchy) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
370 ) |
22735 | 371 |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
372 (defcustom speedbar-tag-group-name-minimum-length 4 |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
373 "*The minimum length of a prefix group name before expanding. |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
374 Thus, if the `speedbar-tag-hierarchy-method' includes `prefix-group' |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
375 and one such groups common characters is less than this number of |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
376 characters, then the group name will be changed to the form of: |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
377 worda to wordb |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
378 instead of just |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
379 word |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
380 This way we won't get silly looking listings." |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
381 :group 'speedbar |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
382 :type 'integer) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
383 |
22735 | 384 (defcustom speedbar-tag-split-minimum-length 20 |
385 "*Minimum length before we stop trying to create sub-lists in tags. | |
386 This is used by all tag-hierarchy methods that break large lists into | |
387 sub-lists." | |
388 :group 'speedbar | |
389 :type 'integer) | |
390 | |
391 (defcustom speedbar-tag-regroup-maximum-length 10 | |
392 "*Maximum length of submenus that are regrouped. | |
393 If the regrouping option is used, then if two or more short subgroups | |
394 are next to each other, then they are combined until this number of | |
395 items is reached." | |
396 :group 'speedbar | |
397 :type 'integer) | |
398 | |
21650 | 399 (defcustom speedbar-directory-button-trim-method 'span |
400 "*Indicates how the directory button will be displayed. | |
401 Possible values are: | |
402 'span - span large directories over multiple lines. | |
403 'trim - trim large directories to only show the last few. | |
404 nil - no trimming." | |
405 :group 'speedbar | |
406 :type '(radio (const :tag "Span large directories over mutiple lines." | |
407 span) | |
408 (const :tag "Trim large directories to only show the last few." | |
409 trim) | |
410 (const :tag "No trimming." nil))) | |
411 | |
412 (defcustom speedbar-smart-directory-expand-flag t | |
413 "*Non-nil means speedbar should use smart expansion. | |
414 Smart expansion only affects when speedbar wants to display a | |
415 directory for a file in the attached frame. When smart expansion is | |
416 enabled, new directories which are children of a displayed directory | |
417 are expanded in the current framework. If nil, then the current | |
418 hierarchy would be replaced with the new directory." | |
419 :group 'speedbar | |
420 :type 'boolean) | |
421 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
422 (defcustom speedbar-indentation-width 1 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
423 "*When sub-nodes are expanded, the number of spaces used for indentation." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
424 :group 'speedbar |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
425 :type 'integer) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
426 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
427 (defcustom speedbar-hide-button-brackets-flag nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
428 "*Non-nil means speedbar will hide the brackets around the + or -." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
429 :group 'speedbar |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
430 :type 'boolean) |
22735 | 431 |
21650 | 432 (defcustom speedbar-before-popup-hook nil |
433 "*Hooks called before popping up the speedbar frame." | |
434 :group 'speedbar | |
435 :type 'hook) | |
436 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
437 (defcustom speedbar-after-create-hook '(speedbar-frame-reposition-smartly) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
438 "*Hooks called before popping up the speedbar frame." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
439 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
440 :type 'hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
441 |
21650 | 442 (defcustom speedbar-before-delete-hook nil |
443 "*Hooks called before deleting the speedbar frame." | |
444 :group 'speedbar | |
445 :type 'hook) | |
446 | |
447 (defcustom speedbar-mode-hook nil | |
448 "*Hooks called after creating a speedbar buffer." | |
449 :group 'speedbar | |
450 :type 'hook) | |
451 | |
452 (defcustom speedbar-timer-hook nil | |
453 "*Hooks called after running the speedbar timer function." | |
454 :group 'speedbar | |
455 :type 'hook) | |
456 | |
457 (defcustom speedbar-verbosity-level 1 | |
458 "*Verbosity level of the speedbar. 0 means say nothing. | |
459 1 means medium level verbosity. 2 and higher are higher levels of | |
460 verbosity." | |
461 :group 'speedbar | |
462 :type 'integer) | |
463 | |
22735 | 464 (defvar speedbar-indicator-separator " " |
465 "String separating file text from indicator characters.") | |
466 | |
21650 | 467 (defcustom speedbar-vc-do-check t |
468 "*Non-nil check all files in speedbar to see if they have been checked out. | |
46286
6117ca314143
(speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
46282
diff
changeset
|
469 Any file checked out is marked with `speedbar-vc-indicator'." |
21650 | 470 :group 'speedbar-vc |
471 :type 'boolean) | |
472 | |
22735 | 473 (defvar speedbar-vc-indicator "*" |
21650 | 474 "Text used to mark files which are currently checked out. |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
475 Other version control systems can be added by examining the function |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
476 `speedbar-vc-directory-enable-hook' and `speedbar-vc-in-control-hook'.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
477 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
478 (defcustom speedbar-vc-directory-enable-hook nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
479 "*Return non-nil if the current directory should be checked for Version Control. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
480 Functions in this hook must accept one parameter which is the directory |
21650 | 481 being checked." |
482 :group 'speedbar-vc | |
483 :type 'hook) | |
484 | |
485 (defcustom speedbar-vc-in-control-hook nil | |
486 "*Return non-nil if the specified file is under Version Control. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
487 Functions in this hook must accept two parameters. The DIRECTORY of the |
21650 | 488 current file, and the FILENAME of the file being checked." |
489 :group 'speedbar-vc | |
490 :type 'hook) | |
491 | |
492 (defvar speedbar-vc-to-do-point nil | |
493 "Local variable maintaining the current version control check position.") | |
494 | |
22735 | 495 (defcustom speedbar-obj-do-check t |
496 "*Non-nil check all files in speedbar to see if they have an object file. | |
497 Any file checked out is marked with `speedbar-obj-indicator', and the | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
498 marking is based on `speedbar-obj-alist'" |
22735 | 499 :group 'speedbar-vc |
500 :type 'boolean) | |
501 | |
502 (defvar speedbar-obj-to-do-point nil | |
503 "Local variable maintaining the current version control check position.") | |
504 | |
505 (defvar speedbar-obj-indicator '("#" . "!") | |
506 "Text used to mark files that have a corresponding hidden object file. | |
507 The car is for an up-to-date object. The cdr is for an out of date object. | |
508 The expression `speedbar-obj-alist' defines who gets tagged.") | |
509 | |
510 (defvar speedbar-obj-alist | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
511 '(("\\.\\([cpC]\\|cpp\\|cc\\|cxx\\)$" . ".o") |
22735 | 512 ("\\.el$" . ".elc") |
513 ("\\.java$" . ".class") | |
514 ("\\.f\\(or\\|90\\|77\\)?$" . ".o") | |
515 ("\\.tex$" . ".dvi") | |
516 ("\\.texi$" . ".info")) | |
517 "Alist of file extensions, and their corresponding object file type.") | |
518 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
519 (defvar speedbar-ro-to-do-point nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
520 "Local variable maintaining the current read only check position.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
521 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
522 (defvar speedbar-object-read-only-indicator "%" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
523 "Indicator to append onto a line if that item is Read Only.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
524 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
525 ;; Note: Look for addition place to add indicator lists that |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
526 ;; use skip-chars instead of a regular expression. |
22735 | 527 (defvar speedbar-indicator-regex |
528 (concat (regexp-quote speedbar-indicator-separator) | |
529 "\\(" | |
530 (regexp-quote speedbar-vc-indicator) | |
531 "\\|" | |
532 (regexp-quote (car speedbar-obj-indicator)) | |
533 "\\|" | |
534 (regexp-quote (cdr speedbar-obj-indicator)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
535 "\\|" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
536 (regexp-quote speedbar-object-read-only-indicator) |
22735 | 537 "\\)*") |
538 "Regular expression used when identifying files. | |
539 Permits stripping of indicator characters from a line.") | |
540 | |
541 (defcustom speedbar-scanner-reset-hook nil | |
542 "*Hook called whenever generic scanners are reset. | |
543 Set this to implement your own scanning / rescan safe functions with | |
544 state data." | |
545 :group 'speedbar | |
546 :type 'hook) | |
547 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
548 (defvar speedbar-ignored-modes '(fundamental-mode) |
21650 | 549 "*List of major modes which speedbar will not switch directories for.") |
550 | |
551 (defun speedbar-extension-list-to-regex (extlist) | |
552 "Takes EXTLIST, a list of extensions and transforms it into regexp. | |
22735 | 553 All the preceding `.' are stripped for an optimized expression starting |
554 with `.' followed by extensions, followed by full-filenames." | |
21650 | 555 (let ((regex1 nil) (regex2 nil)) |
556 (while extlist | |
557 (if (= (string-to-char (car extlist)) ?.) | |
558 (setq regex1 (concat regex1 (if regex1 "\\|" "") | |
559 (substring (car extlist) 1))) | |
560 (setq regex2 (concat regex2 (if regex2 "\\|" "") (car extlist)))) | |
561 (setq extlist (cdr extlist))) | |
562 ;; concat all the sub-exressions together, making sure all types | |
563 ;; of parts exist during concatination. | |
564 (concat "\\(" | |
565 (if regex1 (concat "\\(\\.\\(" regex1 "\\)\\)") "") | |
566 (if (and regex1 regex2) "\\|" "") | |
567 (if regex2 (concat "\\(" regex2 "\\)") "") | |
568 "\\)$"))) | |
569 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
570 (defvar speedbar-ignored-directory-regexp nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
571 "Regular expression matching directorys speedbar will not switch to. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
572 Created from `speedbar-ignored-directory-expressions' with the function |
21650 | 573 `speedbar-extension-list-to-regex' (A misnamed function in this case.) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
574 Use the function `speedbar-add-ignored-directory-regexp', or customize the |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
575 variable `speedbar-ignored-directory-expressions' to modify this variable.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
576 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
577 (defcustom speedbar-ignored-directory-expressions |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
578 '("[/\\]logs?[/\\]\\'") |
21650 | 579 "*List of regular expressions matching directories speedbar will ignore. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
580 They should included directorys to directories which are notoriously very |
21650 | 581 large and take a long time to load in. Use the function |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
582 `speedbar-add-ignored-directory-regexp' to add new items to this list after |
21650 | 583 speedbar is loaded. You may place anything you like in this list |
584 before speedbar has been loaded." | |
585 :group 'speedbar | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
586 :type '(repeat (regexp :tag "Directory Regexp")) |
21650 | 587 :set (lambda (sym val) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
588 (setq speedbar-ignored-directory-expressions val |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
589 speedbar-ignored-directory-regexp |
21650 | 590 (speedbar-extension-list-to-regex val)))) |
591 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
592 (defcustom speedbar-directory-unshown-regexp "^\\(CVS\\|RCS\\|SCCS\\|\\..*\\)\\'" |
22735 | 593 "*Regular expression matching directories not to show in speedbar. |
594 They should include commonly existing directories which are not | |
595 useful, such as version control." | |
596 :group 'speedbar | |
597 :type 'string) | |
598 | |
21650 | 599 (defvar speedbar-file-unshown-regexp |
600 (let ((nstr "") (noext completion-ignored-extensions)) | |
601 (while noext | |
602 (setq nstr (concat nstr (regexp-quote (car noext)) "\\'" | |
603 (if (cdr noext) "\\|" "")) | |
604 noext (cdr noext))) | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
605 ;; backup refdir lockfile |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
606 (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#")) |
21650 | 607 "*Regexp matching files we don't want displayed in a speedbar buffer. |
608 It is generated from the variable `completion-ignored-extensions'") | |
609 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
610 (defvar speedbar-file-regexp nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
611 "Regular expression matching files we know how to expand. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
612 Created from `speedbar-supported-extension-expressions' with the |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
613 function `speedbar-extension-list-to-regex'") |
56762
85c0c238dbbf
(speedbar-file-regexp): Definition moved up.
Richard M. Stallman <rms@gnu.org>
parents:
56754
diff
changeset
|
614 |
21650 | 615 ;; this is dangerous to customize, because the defaults will probably |
616 ;; change in the future. | |
617 (defcustom speedbar-supported-extension-expressions | |
22735 | 618 (append '(".[ch]\\(\\+\\+\\|pp\\|c\\|h\\|xx\\)?" ".tex\\(i\\(nfo\\)?\\)?" |
619 ".el" ".emacs" ".l" ".lsp" ".p" ".java" ".f\\(90\\|77\\|or\\)?") | |
21650 | 620 (if speedbar-use-imenu-flag |
38377
308a2e8895e3
(speedbar-supported-extension-expressions): Add .g to the extension list,
Eli Zaretskii <eliz@gnu.org>
parents:
37891
diff
changeset
|
621 '(".ada" ".p[lm]" ".tcl" ".m" ".scm" ".pm" ".py" ".g" |
22735 | 622 ;; html is not supported by default, but an imenu tags package |
623 ;; is available. Also, html files are nice to be able to see. | |
624 ".s?html" | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
625 ".ma?k" "[Mm]akefile\\(\\.in\\)?"))) |
21650 | 626 "*List of regular expressions which will match files supported by tagging. |
627 Do not prefix the `.' char with a double \\ to quote it, as the period | |
628 will be stripped by a simplified optimizer when compiled into a | |
629 singular expression. This variable will be turned into | |
630 `speedbar-file-regexp' for use with speedbar. You should use the | |
631 function `speedbar-add-supported-extension' to add a new extension at | |
632 runtime, or use the configuration dialog to set it in your .emacs | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
633 file. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
634 If you add an extension to this list, and it does not appear, you may |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
635 need to also modify `completion-ignored-extension' which will also help |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
636 file completion." |
21650 | 637 :group 'speedbar |
638 :type '(repeat (regexp :tag "Extension Regexp")) | |
639 :set (lambda (sym val) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
640 (set 'speedbar-supported-extension-expressions val) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
641 (set 'speedbar-file-regexp (speedbar-extension-list-to-regex val)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
642 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
643 (setq speedbar-file-regexp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
644 (speedbar-extension-list-to-regex speedbar-supported-extension-expressions)) |
21650 | 645 |
646 (defun speedbar-add-supported-extension (extension) | |
647 "Add EXTENSION as a new supported extension for speedbar tagging. | |
648 This should start with a `.' if it is not a complete file name, and | |
649 the dot should NOT be quoted in with \\. Other regular expression | |
650 matchers are allowed however. EXTENSION may be a single string or a | |
651 list of strings." | |
44578
9c2b72b4b303
(speedbar-generic-item-info)
Pavel Janík <Pavel@Janik.cz>
parents:
44225
diff
changeset
|
652 (interactive "sExtension: ") |
21650 | 653 (if (not (listp extension)) (setq extension (list extension))) |
654 (while extension | |
655 (if (member (car extension) speedbar-supported-extension-expressions) | |
656 nil | |
657 (setq speedbar-supported-extension-expressions | |
658 (cons (car extension) speedbar-supported-extension-expressions))) | |
659 (setq extension (cdr extension))) | |
660 (setq speedbar-file-regexp (speedbar-extension-list-to-regex | |
661 speedbar-supported-extension-expressions))) | |
662 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
663 (defun speedbar-add-ignored-directory-regexp (directory-expression) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
664 "Add DIRECTORY-EXPRESSION as a new ignored directory for speedbar tracking. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
665 This function will modify `speedbar-ignored-directory-regexp' and add |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
666 DIRECTORY-EXPRESSION to `speedbar-ignored-directory-expressions'." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
667 (interactive "sDirectory regex: ") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
668 (if (not (listp directory-expression)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
669 (setq directory-expression (list directory-expression))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
670 (while directory-expression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
671 (if (member (car directory-expression) speedbar-ignored-directory-expressions) |
21650 | 672 nil |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
673 (setq speedbar-ignored-directory-expressions |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
674 (cons (car directory-expression) speedbar-ignored-directory-expressions))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
675 (setq directory-expression (cdr directory-expression))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
676 (setq speedbar-ignored-directory-regexp (speedbar-extension-list-to-regex |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
677 speedbar-ignored-directory-expressions))) |
21650 | 678 |
679 ;; If we don't have custom, then we set it here by hand. | |
680 (if (not (fboundp 'custom-declare-variable)) | |
681 (setq speedbar-file-regexp (speedbar-extension-list-to-regex | |
682 speedbar-supported-extension-expressions) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
683 speedbar-ignored-directory-regexp (speedbar-extension-list-to-regex |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
684 speedbar-ignored-directory-expressions))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
685 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
686 (defvar speedbar-update-flag dframe-have-timer-flag |
21650 | 687 "*Non-nil means to automatically update the display. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
688 When this is nil then speedbar will not follow the attached frame's directory. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
689 When speedbar is active, use: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
690 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
691 \\<speedbar-key-map> `\\[speedbar-toggle-updates]' |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
692 |
21650 | 693 to toggle this value.") |
694 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
695 (defvar speedbar-update-flag-disable nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
696 "Permanently disable changing of the update flag.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
697 |
21650 | 698 (defvar speedbar-syntax-table nil |
699 "Syntax-table used on the speedbar.") | |
700 | |
701 (if speedbar-syntax-table | |
702 nil | |
703 (setq speedbar-syntax-table (make-syntax-table)) | |
704 ;; turn off paren matching around here. | |
705 (modify-syntax-entry ?\' " " speedbar-syntax-table) | |
706 (modify-syntax-entry ?\" " " speedbar-syntax-table) | |
707 (modify-syntax-entry ?( " " speedbar-syntax-table) | |
708 (modify-syntax-entry ?) " " speedbar-syntax-table) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
709 (modify-syntax-entry ?{ " " speedbar-syntax-table) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
710 (modify-syntax-entry ?} " " speedbar-syntax-table) |
21650 | 711 (modify-syntax-entry ?[ " " speedbar-syntax-table) |
712 (modify-syntax-entry ?] " " speedbar-syntax-table)) | |
713 | |
714 (defvar speedbar-key-map nil | |
715 "Keymap used in speedbar buffer.") | |
716 | |
717 (if speedbar-key-map | |
718 nil | |
719 (setq speedbar-key-map (make-keymap)) | |
720 (suppress-keymap speedbar-key-map t) | |
721 | |
722 ;; control | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
723 (define-key speedbar-key-map "t" 'speedbar-toggle-updates) |
21650 | 724 (define-key speedbar-key-map "g" 'speedbar-refresh) |
725 | |
726 ;; navigation | |
727 (define-key speedbar-key-map "n" 'speedbar-next) | |
728 (define-key speedbar-key-map "p" 'speedbar-prev) | |
22735 | 729 (define-key speedbar-key-map "\M-n" 'speedbar-restricted-next) |
730 (define-key speedbar-key-map "\M-p" 'speedbar-restricted-prev) | |
731 (define-key speedbar-key-map "\C-\M-n" 'speedbar-forward-list) | |
732 (define-key speedbar-key-map "\C-\M-p" 'speedbar-backward-list) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
733 ;; These commands never seemed useful. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
734 ;; (define-key speedbar-key-map " " 'speedbar-scroll-up) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
735 ;; (define-key speedbar-key-map [delete] 'speedbar-scroll-down) |
21650 | 736 |
22735 | 737 ;; Short cuts I happen to find useful |
738 (define-key speedbar-key-map "r" | |
739 (lambda () (interactive) | |
740 (speedbar-change-initial-expansion-list | |
741 speedbar-previously-used-expansion-list-name))) | |
742 (define-key speedbar-key-map "b" | |
743 (lambda () (interactive) | |
744 (speedbar-change-initial-expansion-list "quick buffers"))) | |
745 (define-key speedbar-key-map "f" | |
746 (lambda () (interactive) | |
747 (speedbar-change-initial-expansion-list "files"))) | |
748 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
749 (dframe-update-keymap speedbar-key-map) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
750 ) |
22735 | 751 |
752 (defun speedbar-make-specialized-keymap () | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
753 "Create a keymap for use with a speedbar major or minor display mode. |
22735 | 754 This basically creates a sparse keymap, and makes it's parent be |
755 `speedbar-key-map'." | |
756 (let ((k (make-sparse-keymap))) | |
757 (set-keymap-parent k speedbar-key-map) | |
758 k)) | |
759 | |
760 (defvar speedbar-file-key-map nil | |
761 "Keymap used in speedbar buffer while files are displayed.") | |
762 | |
763 (if speedbar-file-key-map | |
764 nil | |
765 (setq speedbar-file-key-map (speedbar-make-specialized-keymap)) | |
766 | |
767 ;; Basic tree features | |
768 (define-key speedbar-file-key-map "e" 'speedbar-edit-line) | |
769 (define-key speedbar-file-key-map "\C-m" 'speedbar-edit-line) | |
770 (define-key speedbar-file-key-map "+" 'speedbar-expand-line) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
771 (define-key speedbar-file-key-map "=" 'speedbar-expand-line) |
22735 | 772 (define-key speedbar-file-key-map "-" 'speedbar-contract-line) |
773 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
774 (define-key speedbar-file-key-map "[" 'speedbar-expand-line-descendants) |
65949
0900c0c906d7
* speedbar.el (speedbar-file-key-map): Fix typo.
Chong Yidong <cyd@stupidchicken.com>
parents:
65809
diff
changeset
|
775 (define-key speedbar-file-key-map "]" 'speedbar-contract-line-descendants) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
776 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
777 (define-key speedbar-file-key-map " " 'speedbar-toggle-line-expansion) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
778 |
22735 | 779 ;; file based commands |
780 (define-key speedbar-file-key-map "U" 'speedbar-up-directory) | |
781 (define-key speedbar-file-key-map "I" 'speedbar-item-info) | |
782 (define-key speedbar-file-key-map "B" 'speedbar-item-byte-compile) | |
783 (define-key speedbar-file-key-map "L" 'speedbar-item-load) | |
784 (define-key speedbar-file-key-map "C" 'speedbar-item-copy) | |
785 (define-key speedbar-file-key-map "D" 'speedbar-item-delete) | |
786 (define-key speedbar-file-key-map "O" 'speedbar-item-object-delete) | |
787 (define-key speedbar-file-key-map "R" 'speedbar-item-rename) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
788 (define-key speedbar-file-key-map "M" 'speedbar-create-directory) |
22735 | 789 ) |
21650 | 790 |
791 (defvar speedbar-easymenu-definition-base | |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
792 (append |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
793 '("Speedbar" |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
794 ["Update" speedbar-refresh t] |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
795 ["Auto Update" speedbar-toggle-updates |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
796 :active (not speedbar-update-flag-disable) |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
797 :style toggle :selected speedbar-update-flag]) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
798 (if (and (or (fboundp 'defimage) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
799 (fboundp 'make-image-specifier)) |
29260
7f1b3013a136
(speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents:
29130
diff
changeset
|
800 (if (fboundp 'display-graphic-p) |
7f1b3013a136
(speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents:
29130
diff
changeset
|
801 (display-graphic-p) |
7f1b3013a136
(speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents:
29130
diff
changeset
|
802 window-system)) |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
803 (list |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
804 ["Use Images" speedbar-toggle-images |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
805 :style toggle :selected speedbar-use-images])) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
806 ) |
21650 | 807 "Base part of the speedbar menu.") |
808 | |
809 (defvar speedbar-easymenu-definition-special | |
810 '(["Edit Item On Line" speedbar-edit-line t] | |
811 ["Show All Files" speedbar-toggle-show-all-files | |
812 :style toggle :selected speedbar-show-unknown-files] | |
22735 | 813 ["Expand File Tags" speedbar-expand-line |
21650 | 814 (save-excursion (beginning-of-line) |
815 (looking-at "[0-9]+: *.\\+. "))] | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
816 ["Flush Cache & Expand" speedbar-flush-expand-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
817 (save-excursion (beginning-of-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
818 (looking-at "[0-9]+: *.\\+. "))] |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
819 ["Expand All Descendants" speedbar-expand-line-descendants |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
820 (save-excursion (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
821 (looking-at "[0-9]+: *.\\+. ")) ] |
22735 | 822 ["Contract File Tags" speedbar-contract-line |
21650 | 823 (save-excursion (beginning-of-line) |
824 (looking-at "[0-9]+: *.-. "))] | |
22735 | 825 ; ["Sort Tags" speedbar-toggle-sorting |
826 ; :style toggle :selected speedbar-sort-tags] | |
21650 | 827 "----" |
22735 | 828 ["File/Tag Information" speedbar-item-info t] |
21650 | 829 ["Load Lisp File" speedbar-item-load |
830 (save-excursion | |
831 (beginning-of-line) | |
22735 | 832 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\|$\\)"))] |
21650 | 833 ["Byte Compile File" speedbar-item-byte-compile |
834 (save-excursion | |
835 (beginning-of-line) | |
22735 | 836 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\|$\\)"))] |
837 ["Copy File" speedbar-item-copy | |
21650 | 838 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *\\["))] |
22735 | 839 ["Rename File" speedbar-item-rename |
840 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
841 ["Create Directory" speedbar-create-directory |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
842 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] |
22735 | 843 ["Delete File" speedbar-item-delete |
21650 | 844 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] |
22735 | 845 ["Delete Object" speedbar-item-object-delete |
846 (save-excursion (beginning-of-line) | |
847 (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))] | |
848 ) | |
21650 | 849 "Additional menu items while in file-mode.") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
850 |
21650 | 851 (defvar speedbar-easymenu-definition-trailer |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
852 (append |
22735 | 853 (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
854 (list ["Customize..." speedbar-customize t])) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
855 (list |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
856 ["Detach" speedbar-detach (and speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
857 (eq (selected-frame) speedbar-frame)) ] |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
858 ["Close" dframe-close-frame t] |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
859 ["Quit" delete-frame t] )) |
21650 | 860 "Menu items appearing at the end of the speedbar menu.") |
861 | |
862 (defvar speedbar-desired-buffer nil | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
863 "Non-nil when speedbar is showing buttons specific to a special mode. |
21650 | 864 In this case it is the originating buffer.") |
865 (defvar speedbar-buffer nil | |
866 "The buffer displaying the speedbar.") | |
867 (defvar speedbar-frame nil | |
868 "The frame displaying speedbar.") | |
869 (defvar speedbar-cached-frame nil | |
870 "The frame that was last created, then removed from the display.") | |
871 (defvar speedbar-full-text-cache nil | |
872 "The last open directory is saved in its entirety for ultra-fast switching.") | |
873 | |
874 (defvar speedbar-last-selected-file nil | |
875 "The last file which was selected in speedbar buffer.") | |
876 | |
877 (defvar speedbar-shown-directories nil | |
878 "Maintain list of directories simultaneously open in the current speedbar.") | |
879 | |
880 (defvar speedbar-directory-contents-alist nil | |
881 "An association list of directories and their contents. | |
882 Each sublist was returned by `speedbar-file-lists'. This list is | |
883 maintained to speed up the refresh rate when switching between | |
884 directories.") | |
885 | |
886 (defvar speedbar-power-click nil | |
887 "Never set this by hand. Value is t when S-mouse activity occurs.") | |
888 | |
889 | |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
890 ;;; Compatibility |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
891 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
892 (defalias 'speedbar-make-overlay |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
893 (if (featurep 'xemacs) 'make-extent 'make-overlay)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
894 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
895 (defalias 'speedbar-overlay-put |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
896 (if (featurep 'xemacs) 'set-extent-property 'overlay-put)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
897 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
898 (defalias 'speedbar-delete-overlay |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
899 (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
900 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
901 (defalias 'speedbar-mode-line-update |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
902 (if (featurep 'xemacs) 'redraw-modeline 'force-mode-line-update)) |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
903 |
21650 | 904 ;;; Mode definitions/ user commands |
905 ;; | |
906 | |
907 ;;;###autoload | |
908 (defalias 'speedbar 'speedbar-frame-mode) | |
909 ;;;###autoload | |
910 (defun speedbar-frame-mode (&optional arg) | |
911 "Enable or disable speedbar. Positive ARG means turn on, negative turn off. | |
912 nil means toggle. Once the speedbar frame is activated, a buffer in | |
913 `speedbar-mode' will be displayed. Currently, only one speedbar is | |
914 supported at a time. | |
915 `speedbar-before-popup-hook' is called before popping up the speedbar frame. | |
916 `speedbar-before-delete-hook' is called before the frame is deleted." | |
917 (interactive "P") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
918 ;; Get the buffer to play with |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
919 (if (not (buffer-live-p speedbar-buffer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
920 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
921 (setq speedbar-buffer (get-buffer-create " SPEEDBAR")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
922 (set-buffer speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
923 (speedbar-mode))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
924 ;; Do the frame thing |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
925 (dframe-frame-mode arg |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
926 'speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
927 'speedbar-cached-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
928 'speedbar-buffer |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
929 "Speedbar" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
930 #'speedbar-frame-mode |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
931 (if dframe-xemacsp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
932 (append speedbar-frame-plist |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
933 ;; This is a hack to get speedbar to iconfiy |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
934 ;; with the selected frame. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
935 (list 'parent (selected-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
936 speedbar-frame-parameters) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
937 speedbar-before-delete-hook |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
938 speedbar-before-popup-hook |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
939 speedbar-after-create-hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
940 ;; Start up the timer |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
941 (if (not speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
942 (speedbar-set-timer nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
943 (speedbar-reconfigure-keymaps) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
944 (speedbar-update-contents) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
945 (speedbar-set-timer dframe-update-speed) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
946 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
947 ;; Frame modifications |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
948 (set (make-local-variable 'dframe-delete-frame-function) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
949 'speedbar-handle-delete-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
950 ;; hscroll |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
951 (set (make-local-variable 'automatic-hscrolling) nil) ; Emacs 21 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
952 ;; reset the selection variable |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
953 (setq speedbar-last-selected-file nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
954 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
955 (defun speedbar-frame-reposition-smartly () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
956 "Reposition the speedbar frame to be next to the attached frame." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
957 (cond ((and dframe-xemacsp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
958 (or (member 'left speedbar-frame-plist) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
959 (member 'top speedbar-frame-plist))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
960 (dframe-reposition-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
961 speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
962 (dframe-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
963 (cons (car (cdr (member 'left speedbar-frame-plist))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
964 (car (cdr (member 'top speedbar-frame-plist))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
965 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
966 ((and (not dframe-xemacsp) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
967 (or (assoc 'left speedbar-frame-parameters) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
968 (assoc 'top speedbar-frame-parameters))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
969 ;; if left/top were specified in the parameters, pass them |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
970 ;; down to the reposition function |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
971 (dframe-reposition-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
972 speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
973 (dframe-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
974 (cons (cdr (assoc 'left speedbar-frame-parameters)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
975 (cdr (assoc 'top speedbar-frame-parameters)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
976 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
977 (t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
978 (dframe-reposition-frame speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
979 (dframe-attached-frame speedbar-frame) |
67227
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
980 speedbar-default-position)))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
981 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
982 (defun speedbar-detach () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
983 "Detach the current Speedbar from auto-updating. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
984 Doing this allows the creation of a second speedbar." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
985 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
986 (let ((buffer speedbar-buffer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
987 (dframe-detach 'speedbar-frame 'speedbar-cached-frame 'speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
988 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
989 (set-buffer buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
990 ;; Permanently disable auto-updating in this speedbar buffer. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
991 (set (make-local-variable 'speedbar-update-flag) nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
992 (set (make-local-variable 'speedbar-update-flag-disable) t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
993 ;; Make local copies of all the different variables to prevent |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
994 ;; funny stuff later... |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
995 ))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
996 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
997 (defsubst speedbar-current-frame () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
998 "Return the frame to use for speedbar based on current context." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
999 (dframe-current-frame 'speedbar-frame 'speedbar-mode)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1000 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1001 (defun speedbar-handle-delete-frame (e) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1002 "Handle a delete frame event E. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1003 If the deleted frame is the frame SPEEDBAR is attached to, |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1004 we need to delete speedbar also." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1005 (let ((frame-to-be-deleted (car (car (cdr e))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1006 (if (eq frame-to-be-deleted dframe-attached-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1007 (delete-frame speedbar-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1008 ) |
21650 | 1009 |
1010 ;;;###autoload | |
1011 (defun speedbar-get-focus () | |
1012 "Change frame focus to or from the speedbar frame. | |
1013 If the selected frame is not speedbar, then speedbar frame is | |
1014 selected. If the speedbar frame is active, then select the attached frame." | |
1015 (interactive) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1016 (speedbar-reset-scanners) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1017 (dframe-get-focus 'speedbar-frame 'speedbar-frame-mode |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1018 (lambda () (let ((speedbar-update-flag t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1019 (speedbar-timer-fn))))) |
22735 | 1020 |
21650 | 1021 (defmacro speedbar-frame-width () |
1022 "Return the width of the speedbar frame in characters. | |
1023 nil if it doesn't exist." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1024 '(window-width (get-buffer-window speedbar-buffer))) |
21650 | 1025 |
1026 (defun speedbar-mode () | |
1027 "Major mode for managing a display of directories and tags. | |
1028 \\<speedbar-key-map> | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1029 The first line represents the default directory of the speedbar frame. |
21650 | 1030 Each directory segment is a button which jumps speedbar's default |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1031 directory to that directory. Buttons are activated by clicking `\\[speedbar-click]'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1032 In some situations using `\\[dframe-power-click]' is a `power click' which will |
21650 | 1033 rescan cached items, or pop up new frames. |
1034 | |
1035 Each line starting with <+> represents a directory. Click on the <+> | |
1036 to insert the directory listing into the current tree. Click on the | |
1037 <-> to retract that list. Click on the directory name to go to that | |
1038 directory as the default. | |
1039 | |
1040 Each line starting with [+] is a file. If the variable | |
1041 `speedbar-show-unknown-files' is t, the lines starting with [?] are | |
1042 files which don't have imenu support, but are not expressly ignored. | |
1043 Files are completely ignored if they match `speedbar-file-unshown-regexp' | |
1044 which is generated from `completion-ignored-extensions'. | |
1045 | |
1046 Files with a `*' character after their name are files checked out of a | |
47286
4f937ab8ad22
(speedbar-mode): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
47267
diff
changeset
|
1047 version control system. (Currently only RCS is supported.) New |
21650 | 1048 version control systems can be added by examining the documentation |
47286
4f937ab8ad22
(speedbar-mode): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
47267
diff
changeset
|
1049 for `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p'. |
21650 | 1050 |
22735 | 1051 Files with a `#' or `!' character after them are source files that |
1052 have an object file associated with them. The `!' indicates that the | |
47267
8b5ff870e329
(speedbar-mode): Fix spacing.
Juanma Barranquero <lekktu@gmail.com>
parents:
46288
diff
changeset
|
1053 files is out of date. You can control what source/object associations |
22735 | 1054 exist through the variable `speedbar-obj-alist'. |
1055 | |
21650 | 1056 Click on the [+] to display a list of tags from that file. Click on |
1057 the [-] to retract the list. Click on the file name to edit the file | |
1058 in the attached frame. | |
1059 | |
1060 If you open tags, you might find a node starting with {+}, which is a | |
1061 category of tags. Click the {+} to expand the category. Jump-able | |
1062 tags start with >. Click the name of the tag to go to that position | |
1063 in the selected file. | |
1064 | |
1065 \\{speedbar-key-map}" | |
1066 ;; NOT interactive | |
1067 (save-excursion | |
1068 (kill-all-local-variables) | |
1069 (setq major-mode 'speedbar-mode) | |
1070 (setq mode-name "Speedbar") | |
1071 (set-syntax-table speedbar-syntax-table) | |
1072 (setq font-lock-keywords nil) ;; no font-locking please | |
1073 (setq truncate-lines t) | |
1074 (make-local-variable 'frame-title-format) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1075 (setq frame-title-format (concat "Speedbar " speedbar-version)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1076 (setq case-fold-search nil) |
23083
2dea437fe88a
(speedbar-with-writable): remove `toggle-read-only'.
Eric M. Ludlam <zappo@gnu.org>
parents:
23080
diff
changeset
|
1077 (toggle-read-only 1) |
21650 | 1078 (speedbar-set-mode-line-format) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1079 ;; Add in our dframe hooks. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1080 (if speedbar-track-mouse-flag |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1081 (setq dframe-track-mouse-function #'speedbar-track-mouse)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1082 (setq dframe-help-echo-function #'speedbar-item-info |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1083 dframe-mouse-click-function #'speedbar-click |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1084 dframe-mouse-position-function #'speedbar-position-cursor-on-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1085 (run-hooks 'speedbar-mode-hook)) |
21650 | 1086 speedbar-buffer) |
1087 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1088 (defmacro speedbar-message (fmt &rest args) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1089 "Like message, but for use in the speedbar frame. |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1090 Argument FMT is the format string, and ARGS are the arguments for message." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1091 `(dframe-message ,fmt ,@args)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1092 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1093 (defsubst speedbar-y-or-n-p (prompt &optional deleting) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1094 "Like `y-or-n-p', but for use in the speedbar frame. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1095 Argument PROMPT is the prompt to use. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1096 Optional argument DELETING means this is a query that will delete something. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1097 The variable `speedbar-query-confirmation-method' can cause this to |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1098 return true without a query." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1099 (or (and (not deleting) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1100 (eq speedbar-query-confirmation-method 'none-but-delete)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1101 (dframe-y-or-n-p prompt))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1102 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1103 (defsubst speedbar-select-attached-frame () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1104 "Select the frame attached to this speedbar." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1105 (dframe-select-attached-frame (speedbar-current-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1106 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1107 ;; Backwards compatibility |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1108 (defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1109 (defalias 'speedbar-maybee-jump-to-attached-frame 'dframe-maybee-jump-to-attached-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1110 |
21650 | 1111 (defun speedbar-set-mode-line-format () |
1112 "Set the format of the mode line based on the current speedbar environment. | |
1113 This gives visual indications of what is up. It EXPECTS the speedbar | |
1114 frame and window to be the currently active frame and window." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1115 (if (and (frame-live-p (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1116 (or (not dframe-xemacsp) |
56762
85c0c238dbbf
(speedbar-file-regexp): Definition moved up.
Richard M. Stallman <rms@gnu.org>
parents:
56754
diff
changeset
|
1117 (with-no-warnings |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1118 (specifier-instance has-modeline-p))) |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1119 speedbar-buffer) |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1120 (save-excursion |
21650 | 1121 (set-buffer speedbar-buffer) |
1122 (let* ((w (or (speedbar-frame-width) 20)) | |
1123 (p1 "<<") | |
1124 (p5 ">>") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1125 (p3 (if speedbar-update-flag "#" "!")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1126 (p35 (capitalize speedbar-initial-expansion-list-name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1127 (blank (- w (length p1) (length p3) (length p5) (length p35) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1128 (if line-number-mode 5 1))) |
21650 | 1129 (p2 (if (> blank 0) |
1130 (make-string (/ blank 2) ? ) | |
1131 "")) | |
1132 (p4 (if (> blank 0) | |
1133 (make-string (+ (/ blank 2) (% blank 2)) ? ) | |
1134 "")) | |
1135 (tf | |
1136 (if line-number-mode | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1137 (list (concat p1 p2 p3 " " p35) '(line-number-mode " %3l") |
21650 | 1138 (concat p4 p5)) |
1139 (list (concat p1 p2 p3 p4 p5))))) | |
1140 (if (not (equal mode-line-format tf)) | |
1141 (progn | |
1142 (setq mode-line-format tf) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1143 (speedbar-mode-line-update))))))) |
21650 | 1144 |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1145 (defvar speedbar-previous-menu nil |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1146 "The menu before the last `speedbar-reconfigure-keymaps' was called.") |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1147 |
22735 | 1148 (defun speedbar-reconfigure-keymaps () |
21650 | 1149 "Reconfigure the menu-bar in a speedbar frame. |
1150 Different menu items are displayed depending on the current display mode | |
1151 and the existence of packages." | |
22735 | 1152 (let ((md (append |
1153 speedbar-easymenu-definition-base | |
1154 (if speedbar-shown-directories | |
1155 ;; file display mode version | |
1156 (speedbar-initial-menu) | |
1157 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1158 (dframe-select-attached-frame speedbar-frame) |
22735 | 1159 (if (local-variable-p |
1160 'speedbar-easymenu-definition-special | |
1161 (current-buffer)) | |
1162 ;; If bound locally, we can use it | |
1163 speedbar-easymenu-definition-special))) | |
1164 ;; Dynamic menu stuff | |
1165 '("-") | |
1166 (list (cons "Displays" | |
1167 (let ((displays nil) | |
1168 (alist speedbar-initial-expansion-mode-alist)) | |
1169 (while alist | |
1170 (setq displays | |
1171 (cons | |
1172 (vector | |
1173 (capitalize (car (car alist))) | |
1174 (list | |
1175 'speedbar-change-initial-expansion-list | |
1176 (car (car alist))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1177 :style 'radio |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1178 :selected |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1179 `(string= ,(car (car alist)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1180 speedbar-initial-expansion-list-name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1181 ) |
22735 | 1182 displays)) |
1183 (setq alist (cdr alist))) | |
1184 displays))) | |
1185 ;; The trailer | |
1186 speedbar-easymenu-definition-trailer)) | |
1187 (localmap (save-excursion | |
1188 (let ((cf (selected-frame))) | |
1189 (prog2 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1190 (dframe-select-attached-frame speedbar-frame) |
22735 | 1191 (if (local-variable-p |
1192 'speedbar-special-mode-key-map | |
1193 (current-buffer)) | |
1194 speedbar-special-mode-key-map) | |
1195 (select-frame cf)))))) | |
1196 (save-excursion | |
1197 (set-buffer speedbar-buffer) | |
1198 (use-local-map (or localmap | |
1199 (speedbar-initial-keymap) | |
1200 ;; This creates a small keymap we can glom the | |
1201 ;; menu adjustments into. | |
1202 (speedbar-make-specialized-keymap))) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1203 ;; Delete the old menu if applicable. |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1204 (if speedbar-previous-menu (easy-menu-remove speedbar-previous-menu)) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1205 (setq speedbar-previous-menu md) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1206 ;; Now add the new menu |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1207 (if (not dframe-xemacsp) |
22735 | 1208 (easy-menu-define speedbar-menu-map (current-local-map) |
1209 "Speedbar menu" md) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1210 (easy-menu-add md (current-local-map)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1211 ;; XEmacs-specific: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1212 (if (fboundp 'set-buffer-menubar) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1213 (set-buffer-menubar (list md))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1214 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1215 (run-hooks 'speedbar-reconfigure-keymaps-hook))) |
21650 | 1216 |
1217 | |
1218 ;;; User Input stuff | |
1219 ;; | |
1220 (defun speedbar-customize () | |
1221 "Customize speedbar using the Custom package." | |
1222 (interactive) | |
1223 (let ((sf (selected-frame))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1224 (dframe-select-attached-frame speedbar-frame) |
21650 | 1225 (customize-group 'speedbar) |
1226 (select-frame sf)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1227 (dframe-maybee-jump-to-attached-frame)) |
21650 | 1228 |
22735 | 1229 (defun speedbar-track-mouse (event) |
1230 "For motion EVENT, display info about the current line." | |
1231 (if (not speedbar-track-mouse-flag) | |
1232 nil | |
1233 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1234 (save-window-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1235 (condition-case nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1236 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1237 (mouse-set-point event) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1238 (if (eq major-mode 'speedbar-mode) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1239 ;; XEmacs may let us get in here in other mode buffers. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1240 (speedbar-item-info))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1241 (t (speedbar-message nil))))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1242 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1243 (defun speedbar-show-info-under-mouse () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1244 "Call the info function for the line under the mouse. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1245 Optional EVENT is currently not used." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1246 (let ((pos (mouse-position))) ; we ignore event until I use it later. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1247 (if (equal (car pos) speedbar-frame) |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1248 (save-excursion |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1249 (save-window-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1250 (apply 'set-mouse-position pos) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1251 (speedbar-item-info)))))) |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1252 |
21650 | 1253 (defun speedbar-next (arg) |
1254 "Move to the next ARGth line in a speedbar buffer." | |
1255 (interactive "p") | |
1256 (forward-line (or arg 1)) | |
1257 (speedbar-item-info) | |
1258 (speedbar-position-cursor-on-line)) | |
1259 | |
1260 (defun speedbar-prev (arg) | |
1261 "Move to the previous ARGth line in a speedbar buffer." | |
1262 (interactive "p") | |
1263 (speedbar-next (if arg (- arg) -1))) | |
1264 | |
22735 | 1265 (defun speedbar-restricted-move (arg) |
1266 "Move to the next ARGth line in a speedbar buffer at the same depth. | |
1267 This means that movement is restricted to a subnode, and that siblings | |
1268 of intermediate nodes are skipped." | |
1269 (if (not (numberp arg)) (signal 'wrong-type-argument (list arg 'numberp))) | |
1270 ;; First find the extent for which we are allowed to move. | |
1271 (let ((depth (save-excursion (beginning-of-line) | |
1272 (if (looking-at "[0-9]+:") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1273 (string-to-number (match-string 0)) |
22735 | 1274 0))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1275 (crement (if (< arg 0) 1 -1)) ; decrement or increment |
22735 | 1276 (lastmatch (point))) |
1277 (while (/= arg 0) | |
1278 (forward-line (- crement)) | |
1279 (let ((subdepth (save-excursion (beginning-of-line) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1280 (if (looking-at "[0-9]+:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1281 (string-to-number (match-string 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1282 0)))) |
22735 | 1283 (cond ((or (< subdepth depth) |
1284 (progn (end-of-line) (eobp)) | |
1285 (progn (beginning-of-line) (bobp))) | |
1286 ;; We have reached the end of this block. | |
1287 (goto-char lastmatch) | |
1288 (setq arg 0) | |
1289 (error "End of sub-list")) | |
1290 ((= subdepth depth) | |
1291 (setq lastmatch (point) | |
1292 arg (+ arg crement)))))) | |
1293 (speedbar-position-cursor-on-line))) | |
1294 | |
1295 (defun speedbar-restricted-next (arg) | |
1296 "Move to the next ARGth line in a speedbar buffer at the same depth. | |
1297 This means that movement is restricted to a subnode, and that siblings | |
1298 of intermediate nodes are skipped." | |
1299 (interactive "p") | |
1300 (speedbar-restricted-move (or arg 1)) | |
1301 (speedbar-item-info)) | |
1302 | |
1303 (defun speedbar-restricted-prev (arg) | |
1304 "Move to the previous ARGth line in a speedbar buffer at the same depth. | |
1305 This means that movement is restricted to a subnode, and that siblings | |
1306 of intermediate nodes are skipped." | |
1307 (interactive "p") | |
1308 (speedbar-restricted-move (if arg (- arg) -1)) | |
1309 (speedbar-item-info)) | |
1310 | |
1311 (defun speedbar-navigate-list (arg) | |
1312 "Move across ARG groups of similarly typed items in speedbar. | |
1313 Stop on the first line of the next type of item, or on the last or first item | |
1314 if we reach a buffer boundary." | |
1315 (interactive "p") | |
1316 (beginning-of-line) | |
1317 (if (looking-at "[0-9]+: *[[<{][-+?][]>}] ") | |
1318 (let ((str (regexp-quote (match-string 0)))) | |
1319 (while (looking-at str) | |
1320 (speedbar-restricted-move arg) | |
1321 (beginning-of-line)))) | |
1322 (speedbar-position-cursor-on-line)) | |
1323 | |
1324 (defun speedbar-forward-list () | |
1325 "Move forward over the current list. | |
1326 A LIST in speedbar is a group of similarly typed items, such as directories, | |
1327 files, or the directory button." | |
1328 (interactive) | |
1329 (speedbar-navigate-list 1) | |
1330 (speedbar-item-info)) | |
1331 | |
1332 (defun speedbar-backward-list () | |
1333 "Move backward over the current list. | |
1334 A LIST in speedbar is a group of similarly typed items, such as directories, | |
1335 files, or the directory button." | |
1336 (interactive) | |
1337 (speedbar-navigate-list -1) | |
1338 (speedbar-item-info)) | |
1339 | |
21650 | 1340 (defun speedbar-scroll-up (&optional arg) |
1341 "Page down one screen-full of the speedbar, or ARG lines." | |
1342 (interactive "P") | |
1343 (scroll-up arg) | |
1344 (speedbar-position-cursor-on-line)) | |
1345 | |
1346 (defun speedbar-scroll-down (&optional arg) | |
1347 "Page up one screen-full of the speedbar, or ARG lines." | |
1348 (interactive "P") | |
1349 (scroll-down arg) | |
1350 (speedbar-position-cursor-on-line)) | |
1351 | |
1352 (defun speedbar-up-directory () | |
1353 "Keyboard accelerator for moving the default directory up one. | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
1354 Assumes that the current buffer is the speedbar buffer." |
21650 | 1355 (interactive) |
1356 (setq default-directory (expand-file-name (concat default-directory "../"))) | |
1357 (speedbar-update-contents)) | |
1358 | |
1359 ;;; Speedbar file activity (aka creeping featurism) | |
1360 ;; | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1361 (defun speedbar-refresh (&optional arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1362 "Refresh the current speedbar display, disposing of any cached data. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1363 Argument ARG represents to force a refresh past any caches that may exist." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1364 (interactive "P") |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1365 (let ((dl speedbar-shown-directories) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1366 (dframe-power-click arg) |
47627
33bcb75e91e8
(speedbar-refresh): Simply bind deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents:
47286
diff
changeset
|
1367 deactivate-mark) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1368 ;; We need to hack something so this works in detached frames. |
21650 | 1369 (while dl |
1370 (adelete 'speedbar-directory-contents-alist (car dl)) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1371 (setq dl (cdr dl))) |
22906
adfc04c48002
Updated refresh messages to clear themselves.
Eric M. Ludlam <zappo@gnu.org>
parents:
22893
diff
changeset
|
1372 (if (<= 1 speedbar-verbosity-level) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1373 (speedbar-message "Refreshing speedbar...")) |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1374 (speedbar-update-contents) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1375 (speedbar-stealthy-updates) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1376 ;; Reset the timer in case it got really hosed for some reason... |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1377 (speedbar-set-timer dframe-update-speed) |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1378 (if (<= 1 speedbar-verbosity-level) |
47627
33bcb75e91e8
(speedbar-refresh): Simply bind deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents:
47286
diff
changeset
|
1379 (speedbar-message "Refreshing speedbar...done")))) |
21650 | 1380 |
1381 (defun speedbar-item-load () | |
22735 | 1382 "Load the item under the cursor or mouse if it is a Lisp file." |
21650 | 1383 (interactive) |
1384 (let ((f (speedbar-line-file))) | |
1385 (if (and (file-exists-p f) (string-match "\\.el\\'" f)) | |
1386 (if (and (file-exists-p (concat f "c")) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1387 (speedbar-y-or-n-p (format "Load %sc? " f))) |
21650 | 1388 ;; If the compiled version exists, load that instead... |
1389 (load-file (concat f "c")) | |
1390 (load-file f)) | |
22735 | 1391 (error "Not a loadable file")))) |
21650 | 1392 |
1393 (defun speedbar-item-byte-compile () | |
22735 | 1394 "Byte compile the item under the cursor or mouse if it is a Lisp file." |
21650 | 1395 (interactive) |
1396 (let ((f (speedbar-line-file)) | |
1397 (sf (selected-frame))) | |
1398 (if (and (file-exists-p f) (string-match "\\.el\\'" f)) | |
1399 (progn | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1400 (dframe-select-attached-frame speedbar-frame) |
21650 | 1401 (byte-compile-file f nil) |
22735 | 1402 (select-frame sf) |
1403 (speedbar-reset-scanners))) | |
21650 | 1404 )) |
1405 | |
1406 (defun speedbar-mouse-item-info (event) | |
1407 "Provide information about what the user clicked on. | |
1408 This should be bound to a mouse EVENT." | |
1409 (interactive "e") | |
1410 (mouse-set-point event) | |
1411 (speedbar-item-info)) | |
1412 | |
22735 | 1413 (defun speedbar-generic-item-info () |
44578
9c2b72b4b303
(speedbar-generic-item-info)
Pavel Janík <Pavel@Janik.cz>
parents:
44225
diff
changeset
|
1414 "Attempt to derive, and then display information about this line item. |
22735 | 1415 File style information is displayed with `speedbar-item-info'." |
1416 (save-excursion | |
1417 (beginning-of-line) | |
1418 ;; Skip invisible number info. | |
1419 (if (looking-at "\\([0-9]+\\):") (goto-char (match-end 0))) | |
1420 ;; Skip items in "folder" type text characters. | |
1421 (if (looking-at "\\s-*[[<({].[]>)}] ") (goto-char (match-end 0))) | |
1422 ;; Get the text | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1423 (speedbar-message "Text: %s" (buffer-substring-no-properties |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1424 (point) (progn (end-of-line) (point)))))) |
22735 | 1425 |
21650 | 1426 (defun speedbar-item-info () |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1427 "Display info in the mini-buffer about the button the mouse is over. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1428 This function can be replaced in `speedbar-mode-functions-list' as |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
1429 `speedbar-item-info'." |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1430 (interactive) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1431 (let (message-log-max) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1432 (funcall (or (speedbar-fetch-replacement-function 'speedbar-item-info) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1433 'speedbar-generic-item-info)))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1434 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1435 (defun speedbar-item-info-file-helper (&optional filename) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1436 "Display info about a file that is on the current line. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1437 nil if not applicable. If FILENAME, then use that instead of reading |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1438 it from the speedbar buffer." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1439 (let* ((item (or filename (speedbar-line-file))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1440 (attr (if item (file-attributes item) nil))) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1441 (if (and item attr) (speedbar-message "%s %-6d %s" (nth 8 attr) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1442 (nth 7 attr) item) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1443 nil))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1444 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1445 (defun speedbar-item-info-tag-helper () |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1446 "Display info about a tag that is on the current line. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1447 nil if not applicable." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1448 (save-excursion |
24321
0e5b7bb19ddc
(speedbar-item-info-tag-helper): Scan the whole line.
Richard M. Stallman <rms@gnu.org>
parents:
24232
diff
changeset
|
1449 (beginning-of-line) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1450 (if (re-search-forward " [-+=]?> \\([^\n]+\\)" |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1451 (save-excursion(end-of-line)(point)) t) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1452 (let* ((tag (match-string 1)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1453 (attr (speedbar-line-token)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1454 (item nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1455 (semantic-tagged (if (fboundp 'semantic-tag-p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1456 (semantic-tag-p attr)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1457 (if semantic-tagged |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1458 (with-no-warnings |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1459 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1460 (when (and (semantic-tag-overlay attr) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1461 (semantic-tag-buffer attr)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1462 (set-buffer (semantic-tag-buffer attr))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1463 (speedbar-message |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1464 (funcall semantic-sb-info-format-tag-function attr) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1465 ))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1466 (looking-at "\\([0-9]+\\):") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1467 (setq item (file-name-nondirectory (speedbar-line-directory))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1468 (speedbar-message "Tag: %s in %s" tag item))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1469 (if (re-search-forward "{[+-]} \\([^\n]+\\)$" |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1470 (save-excursion(end-of-line)(point)) t) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1471 (speedbar-message "Group of tags \"%s\"" (match-string 1)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1472 (if (re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1473 (let* ((detailtext (match-string 1)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1474 (detail (or (speedbar-line-token) detailtext)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1475 (parent (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1476 (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1477 (let ((dep (if (looking-at "[0-9]+:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1478 (1- (string-to-number (match-string 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1479 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1480 (re-search-backward (concat "^" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1481 (int-to-string dep) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1482 ":") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1483 nil t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1484 (if (looking-at "[0-9]+: +[-+=>]> \\([^\n]+\\)$") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1485 (speedbar-line-token) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1486 nil)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1487 (if (featurep 'semantic) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1488 (with-no-warnings |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1489 (if (semantic-tag-p detail) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1490 (speedbar-message |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1491 (funcall semantic-sb-info-format-tag-function detail parent)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1492 (if parent |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1493 (speedbar-message "Detail: %s of tag %s" detail |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1494 (if (semantic-tag-p parent) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1495 (semantic-format-tag-name parent nil t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1496 parent)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1497 (speedbar-message "Detail: %s" detail)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1498 ;; Not using `semantic': |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1499 (if parent |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1500 (speedbar-message "Detail: %s of tag %s" detail parent) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1501 (speedbar-message "Detail: %s" detail)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1502 nil))))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1503 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1504 (defun speedbar-files-item-info () |
21650 | 1505 "Display info in the mini-buffer about the button the mouse is over." |
1506 (if (not speedbar-shown-directories) | |
22735 | 1507 (speedbar-generic-item-info) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1508 (or (speedbar-item-info-file-helper) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1509 (speedbar-item-info-tag-helper) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1510 (speedbar-generic-item-info)))) |
21650 | 1511 |
1512 (defun speedbar-item-copy () | |
1513 "Copy the item under the cursor. | |
1514 Files can be copied to new names or places." | |
1515 (interactive) | |
1516 (let ((f (speedbar-line-file))) | |
22735 | 1517 (if (not f) (error "Not a file")) |
21650 | 1518 (if (file-directory-p f) |
22735 | 1519 (error "Cannot copy directory") |
21650 | 1520 (let* ((rt (read-file-name (format "Copy %s to: " |
1521 (file-name-nondirectory f)) | |
1522 (file-name-directory f))) | |
1523 (refresh (member (expand-file-name (file-name-directory rt)) | |
1524 speedbar-shown-directories))) | |
1525 ;; Create the right file name part | |
1526 (if (file-directory-p rt) | |
1527 (setq rt | |
1528 (concat (expand-file-name rt) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1529 (if (string-match "[/\\]$" rt) "" "/") |
21650 | 1530 (file-name-nondirectory f)))) |
1531 (if (or (not (file-exists-p rt)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1532 (speedbar-y-or-n-p (format "Overwrite %s with %s? " rt f) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1533 t)) |
21650 | 1534 (progn |
1535 (copy-file f rt t t) | |
1536 ;; refresh display if the new place is currently displayed. | |
1537 (if refresh | |
1538 (progn | |
1539 (speedbar-refresh) | |
1540 (if (not (speedbar-goto-this-file rt)) | |
1541 (speedbar-goto-this-file f)))) | |
1542 )))))) | |
1543 | |
1544 (defun speedbar-item-rename () | |
1545 "Rename the item under the cursor or mouse. | |
1546 Files can be renamed to new names or moved to new directories." | |
1547 (interactive) | |
1548 (let ((f (speedbar-line-file))) | |
1549 (if f | |
1550 (let* ((rt (read-file-name (format "Rename %s to: " | |
1551 (file-name-nondirectory f)) | |
1552 (file-name-directory f))) | |
1553 (refresh (member (expand-file-name (file-name-directory rt)) | |
1554 speedbar-shown-directories))) | |
1555 ;; Create the right file name part | |
1556 (if (file-directory-p rt) | |
1557 (setq rt | |
1558 (concat (expand-file-name rt) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1559 (if (string-match "[/\\]\\'" rt) "" "/") |
21650 | 1560 (file-name-nondirectory f)))) |
1561 (if (or (not (file-exists-p rt)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1562 (speedbar-y-or-n-p (format "Overwrite %s with %s? " rt f) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1563 t)) |
21650 | 1564 (progn |
1565 (rename-file f rt t) | |
1566 ;; refresh display if the new place is currently displayed. | |
1567 (if refresh | |
1568 (progn | |
1569 (speedbar-refresh) | |
1570 (speedbar-goto-this-file rt) | |
1571 ))))) | |
22735 | 1572 (error "Not a file")))) |
21650 | 1573 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1574 (defun speedbar-create-directory () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1575 "Create a directory in speedbar." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1576 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1577 (let ((f (speedbar-line-file))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1578 (if f |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1579 (let* ((basedir (file-name-directory f)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1580 (nd (read-file-name "Create directory: " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1581 basedir))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1582 ;; Make the directory |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1583 (make-directory nd t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1584 (speedbar-refresh) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1585 (speedbar-goto-this-file nd) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1586 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1587 (error "Not a file")))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1588 |
21650 | 1589 (defun speedbar-item-delete () |
1590 "Delete the item under the cursor. Files are removed from disk." | |
1591 (interactive) | |
1592 (let ((f (speedbar-line-file))) | |
22735 | 1593 (if (not f) (error "Not a file")) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1594 (if (speedbar-y-or-n-p (format "Delete %s? " f) t) |
21650 | 1595 (progn |
1596 (if (file-directory-p f) | |
1597 (delete-directory f) | |
1598 (delete-file f)) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1599 (speedbar-message "Okie dokie..") |
21650 | 1600 (let ((p (point))) |
1601 (speedbar-refresh) | |
1602 (goto-char p)) | |
1603 )) | |
1604 )) | |
1605 | |
22735 | 1606 (defun speedbar-item-object-delete () |
1607 "Delete the object associated from the item under the cursor. | |
1608 The file is removed from disk. The object is determined from the | |
1609 variable `speedbar-obj-alist'." | |
1610 (interactive) | |
1611 (let* ((f (speedbar-line-file)) | |
1612 (obj nil) | |
1613 (oa speedbar-obj-alist)) | |
1614 (if (not f) (error "Not a file")) | |
1615 (while (and oa (not (string-match (car (car oa)) f))) | |
1616 (setq oa (cdr oa))) | |
1617 (setq obj (concat (file-name-sans-extension f) (cdr (car oa)))) | |
1618 (if (and oa (file-exists-p obj) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1619 (speedbar-y-or-n-p (format "Delete %s? " obj) t)) |
22735 | 1620 (progn |
1621 (delete-file obj) | |
1622 (speedbar-reset-scanners))))) | |
1623 | |
21650 | 1624 (defun speedbar-enable-update () |
1625 "Enable automatic updating in speedbar via timers." | |
1626 (interactive) | |
1627 (setq speedbar-update-flag t) | |
1628 (speedbar-set-mode-line-format) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1629 (speedbar-set-timer dframe-update-speed)) |
21650 | 1630 |
1631 (defun speedbar-disable-update () | |
1632 "Disable automatic updating and stop consuming resources." | |
1633 (interactive) | |
1634 (setq speedbar-update-flag nil) | |
1635 (speedbar-set-mode-line-format) | |
1636 (speedbar-set-timer nil)) | |
1637 | |
1638 (defun speedbar-toggle-updates () | |
1639 "Toggle automatic update for the speedbar frame." | |
1640 (interactive) | |
1641 (if speedbar-update-flag | |
1642 (speedbar-disable-update) | |
1643 (speedbar-enable-update))) | |
1644 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1645 (defun speedbar-toggle-images () |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1646 "Toggle use of images in the speedbar frame. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1647 Images are not available in Emacs 20 or earlier." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1648 (interactive) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1649 (setq speedbar-use-images (not speedbar-use-images)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1650 (speedbar-refresh)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1651 |
21650 | 1652 (defun speedbar-toggle-sorting () |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1653 "Toggle tag sorting." |
21650 | 1654 (interactive) |
1655 (setq speedbar-sort-tags (not speedbar-sort-tags))) | |
1656 | |
1657 (defun speedbar-toggle-show-all-files () | |
1658 "Toggle display of files speedbar can not tag." | |
1659 (interactive) | |
1660 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files)) | |
1661 (speedbar-refresh)) | |
1662 | |
1663 (defmacro speedbar-with-writable (&rest forms) | |
1664 "Allow the buffer to be writable and evaluate FORMS." | |
1665 (list 'let '((inhibit-read-only t)) | |
1666 (cons 'progn forms))) | |
1667 (put 'speedbar-with-writable 'lisp-indent-function 0) | |
1668 | |
1669 (defun speedbar-insert-button (text face mouse function | |
1670 &optional token prevline) | |
1671 "Insert TEXT as the next logical speedbar button. | |
1672 FACE is the face to put on the button, MOUSE is the highlight face to use. | |
1673 When the user clicks on TEXT, FUNCTION is called with the TOKEN parameter. | |
1674 This function assumes that the current buffer is the speedbar buffer. | |
1675 If PREVLINE, then put this button on the previous line. | |
1676 | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
1677 This is a convenience function for special modes that create their own |
21650 | 1678 specialized speedbar displays." |
1679 (goto-char (point-max)) | |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1680 (let ((start (point))) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1681 (if (/= (current-column) 0) (insert "\n")) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1682 (put-text-property start (point) 'invisible nil)) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1683 (if prevline (progn (delete-char -1) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1684 (insert " ") ;back up if desired... |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1685 (put-text-property (1- (point)) (point) 'invisible nil))) |
21650 | 1686 (let ((start (point))) |
1687 (insert text) | |
1688 (speedbar-make-button start (point) face mouse function token)) | |
1689 (let ((start (point))) | |
1690 (insert "\n") | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1691 (add-text-properties |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1692 start (point) '(face nil invisible nil mouse-face nil)))) |
21650 | 1693 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1694 (defun speedbar-insert-separator (text) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1695 "Insert a separation label of TEXT. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1696 Separators are not active, have no labels, depth, or actions." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1697 (if speedbar-use-images |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1698 (let ((start (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1699 (insert "//") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1700 (speedbar-insert-image-button-maybe start 2))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1701 (let ((start (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1702 (insert text "\n") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1703 (speedbar-make-button start (point) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1704 'speedbar-separator-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1705 nil nil nil))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1706 |
21650 | 1707 (defun speedbar-make-button (start end face mouse function &optional token) |
1708 "Create a button from START to END, with FACE as the display face. | |
1709 MOUSE is the mouse face. When this button is clicked on FUNCTION | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1710 will be run with the TOKEN parameter (any Lisp object)" |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1711 (add-text-properties |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1712 start end `(face ,face mouse-face ,mouse invisible nil |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1713 speedbar-text ,(buffer-substring-no-properties start end))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1714 (if speedbar-use-tool-tips-flag |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1715 (put-text-property start end 'help-echo #'dframe-help-echo)) |
21650 | 1716 (if function (put-text-property start end 'speedbar-function function)) |
1717 (if token (put-text-property start end 'speedbar-token token)) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1718 ;; So far the only text we have is less that 3 chars. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1719 (if (<= (- end start) 3) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1720 (speedbar-insert-image-button-maybe start (- end start))) |
21650 | 1721 ) |
1722 | |
22735 | 1723 ;;; Initial Expansion list management |
1724 ;; | |
1725 (defun speedbar-initial-expansion-list () | |
1726 "Return the current default expansion list. | |
1727 This is based on `speedbar-initial-expansion-list-name' referencing | |
1728 `speedbar-initial-expansion-mode-alist'." | |
1729 ;; cdr1 - name, cdr2 - menu | |
1730 (cdr (cdr (cdr (assoc speedbar-initial-expansion-list-name | |
1731 speedbar-initial-expansion-mode-alist))))) | |
1732 | |
1733 (defun speedbar-initial-menu () | |
1734 "Return the current default menu data. | |
1735 This is based on `speedbar-initial-expansion-list-name' referencing | |
1736 `speedbar-initial-expansion-mode-alist'." | |
1737 (symbol-value | |
1738 (car (cdr (assoc speedbar-initial-expansion-list-name | |
1739 speedbar-initial-expansion-mode-alist))))) | |
1740 | |
1741 (defun speedbar-initial-keymap () | |
1742 "Return the current default menu data. | |
1743 This is based on `speedbar-initial-expansion-list-name' referencing | |
1744 `speedbar-initial-expansion-mode-alist'." | |
1745 (symbol-value | |
1746 (car (cdr (cdr (assoc speedbar-initial-expansion-list-name | |
1747 speedbar-initial-expansion-mode-alist)))))) | |
1748 | |
1749 (defun speedbar-initial-stealthy-functions () | |
1750 "Return a list of functions to call stealthily. | |
1751 This is based on `speedbar-initial-expansion-list-name' referencing | |
1752 `speedbar-stealthy-function-list'." | |
1753 (cdr (assoc speedbar-initial-expansion-list-name | |
1754 speedbar-stealthy-function-list))) | |
1755 | |
1756 (defun speedbar-add-expansion-list (new-list) | |
1757 "Add NEW-LIST to the list of expansion lists." | |
1758 (add-to-list 'speedbar-initial-expansion-mode-alist new-list)) | |
1759 | |
1760 (defun speedbar-change-initial-expansion-list (new-default) | |
1761 "Change speedbar's default expansion list to NEW-DEFAULT." | |
1762 (interactive | |
1763 (list | |
1764 (completing-read (format "Speedbar Mode (default %s): " | |
1765 speedbar-previously-used-expansion-list-name) | |
1766 speedbar-initial-expansion-mode-alist | |
1767 nil t "" nil | |
1768 speedbar-previously-used-expansion-list-name))) | |
1769 (setq speedbar-previously-used-expansion-list-name | |
1770 speedbar-initial-expansion-list-name | |
1771 speedbar-initial-expansion-list-name new-default) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1772 (if (and (speedbar-current-frame) (frame-live-p (speedbar-current-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1773 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1774 (speedbar-refresh) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1775 (speedbar-reconfigure-keymaps)))) |
22735 | 1776 |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1777 (defun speedbar-fetch-replacement-function (function) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1778 "Return a current mode specific replacement for function, or nil. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1779 Scans `speedbar-mode-functions-list' first for the current mode, then |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1780 for FUNCTION." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1781 (cdr (assoc function |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1782 (cdr (assoc speedbar-initial-expansion-list-name |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1783 speedbar-mode-functions-list))))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1784 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1785 (defun speedbar-add-mode-functions-list (new-list) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1786 "Add NEW-LIST to the list of mode functions. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1787 See `speedbar-mode-functions-list' for details." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1788 (add-to-list 'speedbar-mode-functions-list new-list)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1789 |
22735 | 1790 |
1791 ;;; Special speedbar display management | |
1792 ;; | |
1793 (defun speedbar-maybe-add-localized-support (buffer) | |
1794 "Quick check function called on BUFFERs by the speedbar timer function. | |
1795 Maintains the value of local variables which control speedbars use | |
1796 of the special mode functions." | |
1797 (or speedbar-special-mode-expansion-list | |
1798 (speedbar-add-localized-speedbar-support buffer))) | |
1799 | |
1800 (defun speedbar-add-localized-speedbar-support (buffer) | |
1801 "Add localized speedbar support to BUFFER's mode if it is available." | |
1802 (interactive "bBuffer: ") | |
1803 (if (stringp buffer) (setq buffer (get-buffer buffer))) | |
1804 (if (not (buffer-live-p buffer)) | |
1805 nil | |
1806 (save-excursion | |
1807 (set-buffer buffer) | |
1808 (save-match-data | |
1809 (let ((ms (symbol-name major-mode)) v) | |
1810 (if (not (string-match "-mode$" ms)) | |
1811 nil ;; do nothing to broken mode | |
1812 (setq ms (substring ms 0 (match-beginning 0))) | |
1813 (setq v (intern-soft (concat ms "-speedbar-buttons"))) | |
1814 (make-local-variable 'speedbar-special-mode-expansion-list) | |
1815 (if (not v) | |
1816 (setq speedbar-special-mode-expansion-list t) | |
1817 ;; If it is autoloaded, we need to load it now so that | |
1818 ;; we have access to the varialbe -speedbar-menu-items. | |
1819 ;; Is this XEmacs safe? | |
1820 (let ((sf (symbol-function v))) | |
1821 (if (and (listp sf) (eq (car sf) 'autoload)) | |
1822 (load-library (car (cdr sf))))) | |
1823 (setq speedbar-special-mode-expansion-list (list v)) | |
1824 (setq v (intern-soft (concat ms "-speedbar-key-map"))) | |
1825 (if (not v) | |
1826 nil ;; don't add special keymap | |
1827 (make-local-variable 'speedbar-special-mode-key-map) | |
1828 (setq speedbar-special-mode-key-map | |
1829 (symbol-value v))) | |
1830 (setq v (intern-soft (concat ms "-speedbar-menu-items"))) | |
1831 (if (not v) | |
1832 nil ;; don't add special menus | |
1833 (make-local-variable 'speedbar-easymenu-definition-special) | |
1834 (setq speedbar-easymenu-definition-special | |
1835 (symbol-value v))) | |
1836 ))))))) | |
1837 | |
1838 (defun speedbar-remove-localized-speedbar-support (buffer) | |
1839 "Remove any traces that BUFFER supports speedbar in a specialized way." | |
1840 (save-excursion | |
1841 (set-buffer buffer) | |
1842 (kill-local-variable 'speedbar-special-mode-expansion-list) | |
1843 (kill-local-variable 'speedbar-special-mode-key-map) | |
1844 (kill-local-variable 'speedbar-easymenu-definition-special))) | |
1845 | |
21650 | 1846 ;;; File button management |
1847 ;; | |
1848 (defun speedbar-file-lists (directory) | |
1849 "Create file lists for DIRECTORY. | |
1850 The car is the list of directories, the cdr is list of files not | |
1851 matching ignored headers. Cache any directory files found in | |
1852 `speedbar-directory-contents-alist' and use that cache before scanning | |
46286
6117ca314143
(speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
46282
diff
changeset
|
1853 the file-system." |
21650 | 1854 (setq directory (expand-file-name directory)) |
1855 ;; If in powerclick mode, then the directory we are getting | |
1856 ;; should be rescanned. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1857 (if dframe-power-click |
21650 | 1858 (adelete 'speedbar-directory-contents-alist directory)) |
1859 ;; find the directory, either in the cache, or build it. | |
1860 (or (cdr-safe (assoc directory speedbar-directory-contents-alist)) | |
1861 (let ((default-directory directory) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1862 (dir (directory-files directory nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1863 (dirs nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1864 (files nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1865 (while dir |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1866 (if (not |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1867 (or (string-match speedbar-file-unshown-regexp (car dir)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1868 (string-match speedbar-directory-unshown-regexp (car dir)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1869 (if (file-directory-p (car dir)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1870 (setq dirs (cons (car dir) dirs)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1871 (setq files (cons (car dir) files)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1872 (setq dir (cdr dir))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1873 (let ((nl (cons (nreverse dirs) (list (nreverse files))))) |
21650 | 1874 (aput 'speedbar-directory-contents-alist directory nl) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1875 nl)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1876 )) |
21650 | 1877 |
1878 (defun speedbar-directory-buttons (directory index) | |
1879 "Insert a single button group at point for DIRECTORY. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1880 Each directory directory part is a different button. If part of the directory |
21650 | 1881 matches the user directory ~, then it is replaced with a ~. |
1882 INDEX is not used, but is required by the caller." | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1883 (let* ((tilde (expand-file-name "~/")) |
21650 | 1884 (dd (expand-file-name directory)) |
1885 (junk (string-match (regexp-quote tilde) dd)) | |
1886 (displayme (if junk | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1887 (concat "~/" (substring dd (match-end 0))) |
21650 | 1888 dd)) |
1889 (p (point))) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1890 (if (string-match "^~[/\\]?\\'" displayme) (setq displayme tilde)) |
21650 | 1891 (insert displayme) |
1892 (save-excursion | |
1893 (goto-char p) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1894 (while (re-search-forward "\\([^/\\]+\\)[/\\]" nil t) |
21650 | 1895 (speedbar-make-button (match-beginning 1) (match-end 1) |
1896 'speedbar-directory-face | |
1897 'speedbar-highlight-face | |
1898 'speedbar-directory-buttons-follow | |
25432
07df7c764669
(speedbar-directory-buttons): Recognize
Richard M. Stallman <rms@gnu.org>
parents:
24809
diff
changeset
|
1899 (if (and (= (match-beginning 1) p) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1900 (not (char-equal (char-after (+ p 1)) ?:))) |
21650 | 1901 (expand-file-name "~/") ;the tilde |
1902 (buffer-substring-no-properties | |
1903 p (match-end 0))))) | |
1904 ;; Nuke the beginning of the directory if it's too long... | |
1905 (cond ((eq speedbar-directory-button-trim-method 'span) | |
1906 (beginning-of-line) | |
1907 (let ((ww (or (speedbar-frame-width) 20))) | |
1908 (move-to-column ww nil) | |
1909 (while (>= (current-column) ww) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1910 (re-search-backward "[/\\]" nil t) |
21650 | 1911 (if (<= (current-column) 2) |
1912 (progn | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1913 (re-search-forward "[/\\]" nil t) |
21650 | 1914 (if (< (current-column) 4) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1915 (re-search-forward "[/\\]" nil t)) |
21650 | 1916 (forward-char -1))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1917 (if (looking-at "[/\\]?$") |
21650 | 1918 (beginning-of-line) |
1919 (insert "/...\n ") | |
1920 (move-to-column ww nil))))) | |
1921 ((eq speedbar-directory-button-trim-method 'trim) | |
1922 (end-of-line) | |
1923 (let ((ww (or (speedbar-frame-width) 20)) | |
1924 (tl (current-column))) | |
1925 (if (< ww tl) | |
1926 (progn | |
1927 (move-to-column (- tl ww)) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1928 (if (re-search-backward "[/\\]" nil t) |
21650 | 1929 (progn |
1930 (delete-region (point-min) (point)) | |
1931 (insert "$") | |
1932 ))))))) | |
1933 ) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1934 (if (string-match "\\`[/\\][^/\\]+[/\\]\\'" displayme) |
21650 | 1935 (progn |
1936 (insert " ") | |
1937 (let ((p (point))) | |
1938 (insert "<root>") | |
1939 (speedbar-make-button p (point) | |
1940 'speedbar-directory-face | |
1941 'speedbar-highlight-face | |
1942 'speedbar-directory-buttons-follow | |
1943 "/")))) | |
1944 (end-of-line) | |
1945 (insert-char ?\n 1 nil))) | |
1946 | |
1947 (defun speedbar-make-tag-line (exp-button-type | |
1948 exp-button-char exp-button-function | |
1949 exp-button-data | |
1950 tag-button tag-button-function tag-button-data | |
1951 tag-button-face depth) | |
1952 "Create a tag line with EXP-BUTTON-TYPE for the small expansion button. | |
1953 This is the button that expands or contracts a node (if applicable), | |
1954 and EXP-BUTTON-CHAR the character in it (+, -, ?, etc). EXP-BUTTON-FUNCTION | |
1955 is the function to call if it's clicked on. Button types are | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1956 'bracket, 'angle, 'curly, 'expandtag, 'statictag, t, or nil. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1957 EXP-BUTTON-DATA is extra data attached to the text forming the expansion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1958 button. |
21650 | 1959 |
1960 Next, TAG-BUTTON is the text of the tag. TAG-BUTTON-FUNCTION is the | |
1961 function to call if clicked on, and TAG-BUTTON-DATA is the data to | |
1962 attach to the text field (such a tag positioning, etc). | |
1963 TAG-BUTTON-FACE is a face used for this type of tag. | |
1964 | |
1965 Lastly, DEPTH shows the depth of expansion. | |
1966 | |
1967 This function assumes that the cursor is in the speedbar window at the | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
1968 position to insert a new item, and that the new item will end with a CR." |
21650 | 1969 (let ((start (point)) |
1970 (end (progn | |
1971 (insert (int-to-string depth) ":") | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1972 (point))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1973 (depthspacesize (* depth speedbar-indentation-width))) |
21650 | 1974 (put-text-property start end 'invisible t) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1975 (insert-char ? depthspacesize nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1976 (put-text-property (- (point) depthspacesize) (point) 'invisible nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1977 (let* ((exp-button (cond ((eq exp-button-type 'bracket) "[%c]") |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1978 ((eq exp-button-type 'angle) "<%c>") |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1979 ((eq exp-button-type 'curly) "{%c}") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1980 ((eq exp-button-type 'expandtag) " %c>") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1981 ((eq exp-button-type 'statictag) " =>") |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1982 (t ">"))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1983 (buttxt (format exp-button exp-button-char)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1984 (start (point)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1985 (end (progn (insert buttxt) (point))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1986 (bf (if (and exp-button-type (not (eq exp-button-type 'statictag))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1987 'speedbar-button-face nil)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1988 (mf (if exp-button-function 'speedbar-highlight-face nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1989 ) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1990 (speedbar-make-button start end bf mf exp-button-function exp-button-data) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1991 (if speedbar-hide-button-brackets-flag |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1992 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1993 (put-text-property start (1+ start) 'invisible t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1994 (put-text-property end (1- end) 'invisible t))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1995 ) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1996 (insert-char ? 1 nil) |
21650 | 1997 (put-text-property (1- (point)) (point) 'invisible nil) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1998 (let ((start (point)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1999 (end (progn (insert tag-button) (point)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2000 (insert-char ?\n 1 nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2001 (put-text-property (1- (point)) (point) 'invisible nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2002 (speedbar-make-button start end tag-button-face |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2003 (if tag-button-function 'speedbar-highlight-face nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2004 tag-button-function tag-button-data)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2005 )) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2006 |
21650 | 2007 (defun speedbar-change-expand-button-char (char) |
2008 "Change the expansion button character to CHAR for the current line." | |
2009 (save-excursion | |
2010 (beginning-of-line) | |
2011 (if (re-search-forward ":\\s-*.\\([-+?]\\)" (save-excursion (end-of-line) | |
2012 (point)) t) | |
2013 (speedbar-with-writable | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2014 (goto-char (match-end 1)) |
22735 | 2015 (insert-char char 1 t) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2016 (forward-char -1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2017 (delete-char -1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2018 ;;(put-text-property (point) (1- (point)) 'invisible nil) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2019 ;; make sure we fix the image on the text here. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2020 (speedbar-insert-image-button-maybe (- (point) 1) 3))))) |
21650 | 2021 |
2022 | |
2023 ;;; Build button lists | |
2024 ;; | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2025 (defun speedbar-insert-files-at-point (files level) |
21650 | 2026 "Insert list of FILES starting at point, and indenting all files to LEVEL. |
2027 Tag expandable items with a +, otherwise a ?. Don't highlight ? as we | |
2028 don't know how to manage them. The input parameter FILES is a cons | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
2029 cell of the form ( 'DIRLIST . 'FILELIST )." |
21650 | 2030 ;; Start inserting all the directories |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2031 (let ((dirs (car files))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2032 (while dirs |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2033 (speedbar-make-tag-line 'angle ?+ 'speedbar-dired (car dirs) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2034 (car dirs) 'speedbar-dir-follow nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2035 'speedbar-directory-face level) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2036 (setq dirs (cdr dirs)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2037 (let ((lst (car (cdr files))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2038 (case-fold-search t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2039 (while lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2040 (let* ((known (string-match speedbar-file-regexp (car lst))) |
21650 | 2041 (expchar (if known ?+ ??)) |
2042 (fn (if known 'speedbar-tag-file nil))) | |
2043 (if (or speedbar-show-unknown-files (/= expchar ??)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2044 (speedbar-make-tag-line 'bracket expchar fn (car lst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2045 (car lst) 'speedbar-find-file nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2046 'speedbar-file-face level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2047 (setq lst (cdr lst))))) |
21650 | 2048 |
2049 (defun speedbar-default-directory-list (directory index) | |
2050 "Insert files for DIRECTORY with level INDEX at point." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2051 (speedbar-insert-files-at-point |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2052 (speedbar-file-lists directory) index) |
21650 | 2053 (speedbar-reset-scanners) |
2054 (if (= index 0) | |
2055 ;; If the shown files variable has extra directories, then | |
2056 ;; it is our responsibility to redraw them all | |
2057 ;; Luckilly, the nature of inserting items into this list means | |
2058 ;; that by reversing it, we can easilly go in the right order | |
2059 (let ((sf (cdr (reverse speedbar-shown-directories)))) | |
2060 (setq speedbar-shown-directories | |
2061 (list (expand-file-name default-directory))) | |
2062 ;; exand them all as we find them | |
2063 (while sf | |
2064 (if (speedbar-goto-this-file (car sf)) | |
2065 (progn | |
2066 (beginning-of-line) | |
2067 (if (looking-at "[0-9]+:[ ]*<") | |
2068 (progn | |
2069 (goto-char (match-end 0)) | |
44225
e47fc6bb028d
(speedbar-default-directory-list): Made robust against deleted directories.
Richard M. Stallman <rms@gnu.org>
parents:
42456
diff
changeset
|
2070 (speedbar-do-function-pointer))))) |
e47fc6bb028d
(speedbar-default-directory-list): Made robust against deleted directories.
Richard M. Stallman <rms@gnu.org>
parents:
42456
diff
changeset
|
2071 (setq sf (cdr sf))) |
21650 | 2072 ))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2073 ;;; Generic List support |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2074 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2075 ;; Generic lists are hierarchies of tags which we may need to permute |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2076 ;; in order to make it look nice. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2077 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2078 ;; A generic list is of the form: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2079 ;; ( ("name" . marker-or-number) <-- one tag at this level |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2080 ;; ("name" ("name" . mon) ("name" . mon) ) <-- one group of tags |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2081 ;; ("name" mon ("name" . mon) ) <-- group w/ a position and tags |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2082 (defun speedbar-generic-list-group-p (sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2083 "Non-nil if SUBLST is a group. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2084 Groups may optionally contain a position." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2085 (and (stringp (car-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2086 (or (and (listp (cdr-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2087 (or (speedbar-generic-list-tag-p (car-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2088 (speedbar-generic-list-group-p (car-safe (cdr-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2089 ))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2090 (and (number-or-marker-p (car-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2091 (listp (cdr-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2092 (speedbar-generic-list-tag-p |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2093 (car-safe (cdr-safe (cdr-safe sublst))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2094 ))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2095 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2096 (defun speedbar-generic-list-positioned-group-p (sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2097 "Non-nil of SUBLST is a group with a position." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2098 (and (stringp (car-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2099 (number-or-marker-p (car-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2100 (listp (cdr-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2101 (let ((rest (car-safe (cdr-safe (cdr-safe sublst))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2102 (or (speedbar-generic-list-tag-p rest) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2103 (speedbar-generic-list-group-p rest) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2104 (speedbar-generic-list-positioned-group-p rest) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2105 )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2106 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2107 (defun speedbar-generic-list-tag-p (sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2108 "Non nil if SUBLST is a tag." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2109 (and (stringp (car-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2110 (or (and (number-or-marker-p (cdr-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2111 (not (cdr-safe (cdr-safe sublst)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2112 ;; For semantic/bovine items, this is needed |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2113 (symbolp (car-safe (cdr-safe sublst)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2114 )) |
21650 | 2115 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2116 (defun speedbar-sort-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2117 "Sort all elements of tag hierarchy LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2118 (sort (copy-alist lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2119 (lambda (a b) (string< (car a) (car b))))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2120 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2121 (defun speedbar-try-completion (string alist) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2122 "A wrapper for `try-completion'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2123 Passes STRING and ALIST to `try-completion' if ALIST |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2124 passes some tests." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2125 (if (and (listp alist) (not (null alist)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2126 (listp (car alist)) (stringp (car (car alist)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2127 (try-completion string alist) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2128 nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2129 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2130 (defun speedbar-prefix-group-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2131 "Prefix group names for tag hierarchy LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2132 (let ((newlst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2133 (sublst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2134 (work-list nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2135 (junk-list nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2136 (short-group-list nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2137 (short-start-name nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2138 (short-end-name nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2139 (num-shorts-grouped 0) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2140 (bins (make-vector 256 nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2141 (diff-idx 0)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2142 (if (<= (length lst) speedbar-tag-regroup-maximum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2143 ;; Do nothing. Too short to bother with. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2144 lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2145 ;; Break out sub-lists |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2146 (while lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2147 (if (speedbar-generic-list-group-p (car-safe lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2148 (setq newlst (cons (car lst) newlst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2149 (setq sublst (cons (car lst) sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2150 (setq lst (cdr lst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2151 ;; Reverse newlst because it was made backwards. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2152 ;; Sublist doesn't need reversing because the act |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2153 ;; of binning things will reverse it for us. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2154 (setq newlst (nreverse newlst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2155 sublst sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2156 ;; Now, first find out how long our list is. Never let a |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2157 ;; list get-shorter than our minimum. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2158 (if (<= (length sublst) speedbar-tag-split-minimum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2159 (setq work-list sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2160 (setq diff-idx (length (speedbar-try-completion "" sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2161 ;; Sort the whole list into bins. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2162 (while sublst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2163 (let ((e (car sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2164 (s (car (car sublst)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2165 (cond ((<= (length s) diff-idx) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2166 ;; 0 storage bin for shorty. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2167 (aset bins 0 (cons e (aref bins 0)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2168 (t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2169 ;; stuff into a bin based on ascii value at diff |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2170 (aset bins (aref s diff-idx) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2171 (cons e (aref bins (aref s diff-idx))))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2172 (setq sublst (cdr sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2173 ;; Go through all our bins Stick singles into our |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2174 ;; junk-list, everything else as sublsts in work-list. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2175 ;; If two neighboring lists are both small, make a grouped |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2176 ;; group combinding those two sub-lists. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2177 (setq diff-idx 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2178 (while (> 256 diff-idx) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2179 ;; The bins contents are currently in forward order. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2180 (let ((l (aref bins diff-idx))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2181 (if l |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2182 (let ((tmp (cons (speedbar-try-completion "" l) l))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2183 (if (or (> (length l) speedbar-tag-regroup-maximum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2184 (> (+ (length l) (length short-group-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2185 speedbar-tag-split-minimum-length)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2186 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2187 ;; We have reached a longer list, so we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2188 ;; must finish off a grouped group. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2189 (cond |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2190 ((and short-group-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2191 (= (length short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2192 num-shorts-grouped)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2193 ;; All singles? Junk list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2194 (setq junk-list (append (nreverse short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2195 junk-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2196 ((= num-shorts-grouped 1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2197 ;; Only one short group? Just stick it in |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2198 ;; there by itself. Make a group, and find |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2199 ;; a subexpression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2200 (let ((subexpression (speedbar-try-completion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2201 "" short-group-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2202 (if (< (length subexpression) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2203 speedbar-tag-group-name-minimum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2204 (setq subexpression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2205 (concat short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2206 " (" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2207 (substring |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2208 (car (car short-group-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2209 (length short-start-name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2210 ")"))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2211 (setq work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2212 (cons (cons subexpression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2213 short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2214 work-list )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2215 (short-group-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2216 ;; Multiple groups to be named in a special |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2217 ;; way by displaying the range over which we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2218 ;; have grouped them. |
22735 | 2219 (setq work-list |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2220 (cons (cons (concat short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2221 " to " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2222 short-end-name) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2223 short-group-list) |
22735 | 2224 work-list)))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2225 ;; Reset short group list information every time. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2226 (setq short-group-list nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2227 short-start-name nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2228 short-end-name nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2229 num-shorts-grouped 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2230 ;; Ok, now that we cleaned up the short-group-list, |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2231 ;; we can deal with this new list, to decide if it |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2232 ;; should go on one of these sub-lists or not. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2233 (if (< (length l) speedbar-tag-regroup-maximum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2234 (setq short-group-list (append l short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2235 num-shorts-grouped (1+ num-shorts-grouped) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2236 short-end-name (car tmp) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2237 short-start-name (if short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2238 short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2239 (car tmp))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2240 (setq work-list (cons tmp work-list)))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2241 (setq diff-idx (1+ diff-idx)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2242 ;; Did we run out of things? Drop our new list onto the end. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2243 (cond |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2244 ((and short-group-list (= (length short-group-list) num-shorts-grouped)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2245 ;; All singles? Junk list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2246 (setq junk-list (append short-group-list junk-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2247 ((= num-shorts-grouped 1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2248 ;; Only one short group? Just stick it in |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2249 ;; there by itself. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2250 (setq work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2251 (cons (cons (speedbar-try-completion "" short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2252 short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2253 work-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2254 (short-group-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2255 ;; Multiple groups to be named in a special |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2256 ;; way by displaying the range over which we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2257 ;; have grouped them. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2258 (setq work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2259 (cons (cons (concat short-start-name " to " short-end-name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2260 short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2261 work-list)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2262 ;; Reverse the work list nreversed when consing. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2263 (setq work-list (nreverse work-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2264 ;; Now, stick our new list onto the end of |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2265 (if work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2266 (if junk-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2267 (append newlst work-list junk-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2268 (append newlst work-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2269 (append newlst junk-list))))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2270 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2271 (defun speedbar-trim-words-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2272 "Trim all words in a tag hierarchy. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2273 Base trimming information on word separators, and group names. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2274 Argument LST is the list of tags to trim." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2275 (let ((newlst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2276 (sublst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2277 (trim-prefix nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2278 (trim-chars 0) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2279 (trimlst nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2280 (while lst |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2281 (if (speedbar-generic-list-group-p (car-safe lst)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2282 (setq newlst (cons (car lst) newlst)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2283 (setq sublst (cons (car lst) sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2284 (setq lst (cdr lst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2285 ;; Get the prefix to trim by. Make sure that we don't trim |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2286 ;; off silly pieces, only complete understandable words. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2287 (setq trim-prefix (speedbar-try-completion "" sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2288 newlst (nreverse newlst)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2289 (if (or (= (length sublst) 1) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2290 (not trim-prefix) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2291 (not (string-match "\\(\\w+\\W+\\)+" trim-prefix))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2292 (append newlst (nreverse sublst)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2293 (setq trim-prefix (substring trim-prefix (match-beginning 0) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2294 (match-end 0))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2295 (setq trim-chars (length trim-prefix)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2296 (while sublst |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2297 (setq trimlst (cons |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2298 (cons (substring (car (car sublst)) trim-chars) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2299 (cdr (car sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2300 trimlst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2301 sublst (cdr sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2302 ;; Put the lists together |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2303 (append newlst trimlst)))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2304 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2305 (defun speedbar-simple-group-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2306 "Create a simple 'Tags' group with orphaned tags. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2307 Argument LST is the list of tags to sort into groups." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2308 (let ((newlst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2309 (sublst nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2310 (while lst |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2311 (if (speedbar-generic-list-group-p (car-safe lst)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2312 (setq newlst (cons (car lst) newlst)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2313 (setq sublst (cons (car lst) sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2314 (setq lst (cdr lst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2315 (if (not newlst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2316 (nreverse sublst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2317 (setq newlst (cons (cons "Tags" (nreverse sublst)) newlst)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2318 (nreverse newlst)))) |
22735 | 2319 |
2320 (defun speedbar-create-tag-hierarchy (lst) | |
2321 "Adjust the tag hierarchy in LST, and return it. | |
2322 This uses `speedbar-tag-hierarchy-method' to determine how to adjust | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2323 the list." |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2324 (let* ((f (save-excursion |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2325 (forward-line -1) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2326 (or (speedbar-line-file) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2327 (speedbar-line-directory)))) |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2328 (methods (if (get-file-buffer f) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2329 (save-excursion (set-buffer (get-file-buffer f)) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2330 speedbar-tag-hierarchy-method) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2331 speedbar-tag-hierarchy-method)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2332 (lst (if (fboundp 'copy-tree) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2333 (copy-tree lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2334 lst))) |
22735 | 2335 (while methods |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2336 (setq lst (funcall (car methods) lst) |
22735 | 2337 methods (cdr methods))) |
2338 lst)) | |
2339 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2340 (defvar speedbar-generic-list-group-expand-button-type 'curly |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2341 "The type of button created for groups of tags. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2342 Good values for this are `curly' and `expandtag'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2343 Make buffer local for your mode.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2344 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2345 (defvar speedbar-generic-list-tag-button-type nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2346 "The type of button created for tags in generic lists. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2347 Good values for this are nil and `statictag'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2348 Make buffer local for your mode.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2349 |
21650 | 2350 (defun speedbar-insert-generic-list (level lst expand-fun find-fun) |
2351 "At LEVEL, insert a generic multi-level alist LST. | |
2352 Associations with lists get {+} tags (to expand into more nodes) and | |
2353 those with positions just get a > as the indicator. {+} buttons will | |
2354 have the function EXPAND-FUN and the token is the CDR list. The token | |
2355 name will have the function FIND-FUN and not token." | |
2356 ;; Remove imenu rescan button | |
2357 (if (string= (car (car lst)) "*Rescan*") | |
2358 (setq lst (cdr lst))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2359 ;; Get, and set up variables that define how we treat these tags. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2360 (let ((f (save-excursion (forward-line -1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2361 (or (speedbar-line-file) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2362 (speedbar-line-directory)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2363 expand-button tag-button) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2364 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2365 (if (get-file-buffer f) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2366 (set-buffer (get-file-buffer f))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2367 (setq expand-button speedbar-generic-list-group-expand-button-type |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2368 tag-button speedbar-generic-list-tag-button-type)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2369 ;; Adjust the list. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2370 (setq lst (speedbar-create-tag-hierarchy lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2371 ;; insert the parts |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2372 (while lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2373 (cond ((null (car-safe lst)) nil) ;this would be a separator |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2374 ((speedbar-generic-list-tag-p (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2375 (speedbar-make-tag-line tag-button |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2376 nil nil nil ;no expand button data |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2377 (car (car lst)) ;button name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2378 find-fun ;function |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2379 (cdr (car lst)) ;token is position |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2380 'speedbar-tag-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2381 (1+ level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2382 ((speedbar-generic-list-positioned-group-p (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2383 (speedbar-make-tag-line expand-button |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2384 ?+ expand-fun (cdr (cdr (car lst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2385 (car (car lst)) ;button name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2386 find-fun ;function |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2387 (car (cdr (car lst))) ;token is posn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2388 'speedbar-tag-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2389 (1+ level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2390 ((speedbar-generic-list-group-p (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2391 (speedbar-make-tag-line expand-button |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2392 ?+ expand-fun (cdr (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2393 (car (car lst)) ;button name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2394 nil nil 'speedbar-tag-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2395 (1+ level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2396 (t (speedbar-message "speedbar-insert-generic-list: malformed list!") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2397 )) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2398 (setq lst (cdr lst))))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2399 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2400 (defun speedbar-insert-imenu-list (indent lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2401 "At level INDENT, insert the imenu generated LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2402 (speedbar-insert-generic-list indent lst |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2403 'speedbar-tag-expand |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2404 'speedbar-tag-find)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2405 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2406 (defun speedbar-insert-etags-list (indent lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2407 "At level INDENT, insert the etags generated LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2408 (speedbar-insert-generic-list indent lst |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2409 'speedbar-tag-expand |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2410 'speedbar-tag-find)) |
21650 | 2411 |
2412 ;;; Timed functions | |
2413 ;; | |
2414 (defun speedbar-update-contents () | |
2415 "Generically update the contents of the speedbar buffer." | |
2416 (interactive) | |
2417 ;; Set the current special buffer | |
2418 (setq speedbar-desired-buffer nil) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2419 |
22735 | 2420 ;; Check for special modes |
2421 (speedbar-maybe-add-localized-support (current-buffer)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2422 |
22735 | 2423 ;; Choose the correct method of doodling. |
21650 | 2424 (if (and speedbar-mode-specific-contents-flag |
22735 | 2425 (listp speedbar-special-mode-expansion-list) |
21650 | 2426 speedbar-special-mode-expansion-list |
2427 (local-variable-p | |
2428 'speedbar-special-mode-expansion-list | |
2429 (current-buffer))) | |
2430 ;;(eq (get major-mode 'mode-class 'special))) | |
2431 (speedbar-update-special-contents) | |
2432 (speedbar-update-directory-contents))) | |
2433 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2434 (defun speedbar-update-localized-contents () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2435 "Update the contents of the speedbar buffer for the current situation." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2436 ;; Due to the historical growth of speedbar, we need to do something |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2437 ;; special for "files" mode. Too bad. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2438 (let ((name speedbar-initial-expansion-list-name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2439 (funclst (speedbar-initial-expansion-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2440 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2441 (if (string= name "files") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2442 ;; Do all the files type work. It still goes through the |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2443 ;; expansion list stuff. :( |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2444 (if (or (member (expand-file-name default-directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2445 speedbar-shown-directories) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2446 (and speedbar-ignored-directory-regexp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2447 (string-match |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2448 speedbar-ignored-directory-regexp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2449 (expand-file-name default-directory)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2450 nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2451 (if (<= 1 speedbar-verbosity-level) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2452 (speedbar-message "Updating speedbar to: %s..." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2453 default-directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2454 (speedbar-update-directory-contents) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2455 (if (<= 1 speedbar-verbosity-level) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2456 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2457 (speedbar-message "Updating speedbar to: %s...done" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2458 default-directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2459 (speedbar-message nil)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2460 ;; Else, we can do a short cut. No text cache. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2461 (let ((cbd (expand-file-name default-directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2462 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2463 (set-buffer speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2464 (speedbar-with-writable |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2465 (erase-buffer) |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2466 (dolist (func funclst) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2467 (setq default-directory cbd) |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2468 (funcall func cbd 0)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2469 (speedbar-reconfigure-keymaps) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2470 (goto-char (point-min))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2471 )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2472 |
21650 | 2473 (defun speedbar-update-directory-contents () |
2474 "Update the contents of the speedbar buffer based on the current directory." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2475 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2476 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2477 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2478 (let ((cbd (expand-file-name default-directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2479 cbd-parent |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2480 (funclst (speedbar-initial-expansion-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2481 (cache speedbar-full-text-cache) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2482 ;; disable stealth during update |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2483 (speedbar-stealthy-function-list nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2484 (use-cache nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2485 (expand-local nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2486 ;; Because there is a bug I can't find just yet |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2487 (inhibit-quit nil)) |
21650 | 2488 (set-buffer speedbar-buffer) |
2489 ;; If we are updating contents to where we are, then this is | |
2490 ;; really a request to update existing contents, so we must be | |
2491 ;; careful with our text cache! | |
2492 (if (member cbd speedbar-shown-directories) | |
22735 | 2493 (progn |
2494 (setq cache nil) | |
2495 ;; If the current directory is not the last element in the dir | |
2496 ;; list, then we ALSO need to zap the list of expanded directories | |
2497 (if (/= (length (member cbd speedbar-shown-directories)) 1) | |
2498 (setq speedbar-shown-directories (list cbd)))) | |
21650 | 2499 |
2500 ;; Build cbd-parent, and see if THAT is in the current shown | |
2501 ;; directories. First, go through pains to get the parent directory | |
2502 (if (and speedbar-smart-directory-expand-flag | |
2503 (save-match-data | |
2504 (setq cbd-parent cbd) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2505 (if (string-match "[/\\]$" cbd-parent) |
22735 | 2506 (setq cbd-parent (substring cbd-parent 0 |
2507 (match-beginning 0)))) | |
21650 | 2508 (setq cbd-parent (file-name-directory cbd-parent))) |
2509 (member cbd-parent speedbar-shown-directories)) | |
2510 (setq expand-local t) | |
2511 | |
2512 ;; If this directory is NOT in the current list of available | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2513 ;; directorys, then use the cache, and set the cache to our new |
21650 | 2514 ;; value. Make sure to unhighlight the current file, or if we |
2515 ;; come back to this directory, it might be a different file | |
2516 ;; and then we get a mess! | |
2517 (if (> (point-max) 1) | |
2518 (progn | |
2519 (speedbar-clear-current-file) | |
2520 (setq speedbar-full-text-cache | |
2521 (cons speedbar-shown-directories (buffer-string))))) | |
2522 | |
2523 ;; Check if our new directory is in the list of directories | |
2524 ;; shown in the text-cache | |
2525 (if (member cbd (car cache)) | |
2526 (setq speedbar-shown-directories (car cache) | |
2527 use-cache t) | |
2528 ;; default the shown directories to this list... | |
2529 (setq speedbar-shown-directories (list cbd))) | |
2530 )) | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2531 (if (not expand-local) (setq speedbar-last-selected-file nil)) |
21650 | 2532 (speedbar-with-writable |
2533 (if (and expand-local | |
2534 ;; Find this directory as a speedbar node. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2535 (speedbar-directory-line cbd)) |
21650 | 2536 ;; Open it. |
2537 (speedbar-expand-line) | |
2538 (erase-buffer) | |
2539 (cond (use-cache | |
2540 (setq default-directory | |
2541 (nth (1- (length speedbar-shown-directories)) | |
2542 speedbar-shown-directories)) | |
2543 (insert (cdr cache))) | |
2544 (t | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2545 (dolist (func funclst) |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2546 (setq default-directory cbd) |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2547 (funcall func cbd 0))))) |
21650 | 2548 (goto-char (point-min))))) |
22735 | 2549 (speedbar-reconfigure-keymaps)) |
21650 | 2550 |
2551 (defun speedbar-update-special-contents () | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
2552 "Use the mode-specific variable to fill in the speedbar buffer. |
21650 | 2553 This should only be used by modes classified as special." |
2554 (let ((funclst speedbar-special-mode-expansion-list) | |
2555 (specialbuff (current-buffer))) | |
2556 (save-excursion | |
2557 (setq speedbar-desired-buffer specialbuff) | |
2558 (set-buffer speedbar-buffer) | |
2559 ;; If we are leaving a directory, cache it. | |
2560 (if (not speedbar-shown-directories) | |
2561 ;; Do nothing | |
2562 nil | |
2563 ;; Clean up directory maintenance stuff | |
2564 (speedbar-clear-current-file) | |
2565 (setq speedbar-full-text-cache | |
2566 (cons speedbar-shown-directories (buffer-string)) | |
2567 speedbar-shown-directories nil)) | |
2568 ;; Now fill in the buffer with our newly found specialized list. | |
2569 (speedbar-with-writable | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2570 (dolist (func funclst) |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2571 ;; We do not erase the buffer because these functions may |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2572 ;; decide NOT to update themselves. |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2573 (funcall func specialbuff))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2574 |
21650 | 2575 (goto-char (point-min)))) |
22735 | 2576 (speedbar-reconfigure-keymaps)) |
21650 | 2577 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2578 (defun speedbar-set-timer (timeout) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2579 "Set up the speedbar timer with TIMEOUT. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2580 Uses `dframe-set-timer'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2581 Also resets scanner functions." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2582 (dframe-set-timer timeout 'speedbar-timer-fn 'speedbar-update-flag) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2583 ;; Apply a revert hook that will reset the scanners. We attach to revert |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2584 ;; because most reverts occur during VC state change, and this lets our |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2585 ;; VC scanner fix itself. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2586 (if timeout |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2587 (add-hook 'after-revert-hook 'speedbar-reset-scanners) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2588 (remove-hook 'after-revert-hook 'speedbar-reset-scanners)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2589 ;; change this if it changed for some reason |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2590 (speedbar-set-mode-line-format)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2591 |
21650 | 2592 (defun speedbar-timer-fn () |
22735 | 2593 "Run whenever Emacs is idle to update the speedbar item." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2594 (if (or (not (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2595 (not (frame-live-p (speedbar-current-frame)))) |
21650 | 2596 (speedbar-set-timer nil) |
2597 ;; Save all the match data so that we don't mess up executing fns | |
2598 (save-match-data | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2599 ;; Only do stuff if the frame is visible, not an icon, and if |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2600 ;; it is currently flagged to do something. |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2601 (if (and speedbar-update-flag |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2602 (speedbar-current-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2603 (frame-visible-p (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2604 (not (eq (frame-visible-p (speedbar-current-frame)) 'icon))) |
21650 | 2605 (let ((af (selected-frame))) |
2606 (save-window-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2607 (dframe-select-attached-frame speedbar-frame) |
21650 | 2608 ;; make sure we at least choose a window to |
2609 ;; get a good directory from | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2610 (if (window-minibuffer-p (selected-window)) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2611 nil |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2612 ;; Check for special modes |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2613 (speedbar-maybe-add-localized-support (current-buffer)) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2614 ;; Update for special mode all the time! |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2615 (if (and speedbar-mode-specific-contents-flag |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2616 (listp speedbar-special-mode-expansion-list) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2617 speedbar-special-mode-expansion-list |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2618 (local-variable-p |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2619 'speedbar-special-mode-expansion-list |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2620 (current-buffer))) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2621 ;;(eq (get major-mode 'mode-class 'special))) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2622 (progn |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2623 (if (<= 2 speedbar-verbosity-level) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2624 (speedbar-message |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2625 "Updating speedbar to special mode: %s..." |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2626 major-mode)) |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2627 (speedbar-update-special-contents) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2628 (if (<= 2 speedbar-verbosity-level) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2629 (progn |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2630 (speedbar-message |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2631 "Updating speedbar to special mode: %s...done" |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2632 major-mode) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2633 (speedbar-message nil)))) |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2634 ;; Update all the contents if directories change! |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2635 (if (or (member major-mode speedbar-ignored-modes) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2636 (eq af (speedbar-current-frame)) |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2637 (not (buffer-file-name))) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2638 nil |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2639 (speedbar-update-localized-contents) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2640 )) |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2641 (select-frame af))) |
21650 | 2642 ;; Now run stealthy updates of time-consuming items |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2643 (speedbar-stealthy-updates))))) |
21650 | 2644 (run-hooks 'speedbar-timer-hook)) |
2645 | |
2646 | |
2647 ;;; Stealthy activities | |
2648 ;; | |
22735 | 2649 (defvar speedbar-stealthy-update-recurse nil |
2650 "Recursion avoidance variable for stealthy update.") | |
2651 | |
21650 | 2652 (defun speedbar-stealthy-updates () |
2653 "For a given speedbar, run all items in the stealthy function list. | |
2654 Each item returns t if it completes successfully, or nil if | |
2655 interrupted by the user." | |
22735 | 2656 (if (not speedbar-stealthy-update-recurse) |
2657 (let ((l (speedbar-initial-stealthy-functions)) | |
2658 (speedbar-stealthy-update-recurse t)) | |
2659 (unwind-protect | |
23085
46deaf6e62a9
(speedbar-stealthy-updates): Do all updates w/ the the buffer writable.
Eric M. Ludlam <zappo@gnu.org>
parents:
23084
diff
changeset
|
2660 (speedbar-with-writable |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2661 (while (and l (funcall (car l))) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2662 ;;(sit-for 0) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2663 (setq l (cdr l)))) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2664 ;;(speedbar-message "Exit with %S" (car l)) |
22735 | 2665 )))) |
21650 | 2666 |
2667 (defun speedbar-reset-scanners () | |
2668 "Reset any variables used by functions in the stealthy list as state. | |
2669 If new functions are added, their state needs to be updated here." | |
22735 | 2670 (setq speedbar-vc-to-do-point t |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2671 speedbar-obj-to-do-point t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2672 speedbar-ro-to-do-point t) |
21650 | 2673 (run-hooks 'speedbar-scanner-reset-hook) |
2674 ) | |
2675 | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2676 (defun speedbar-find-selected-file (file) |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
2677 "Go to the line where FILE is." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2678 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2679 (set-buffer speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2680 |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2681 (goto-char (point-min)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2682 (let ((m nil)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2683 (while (and (setq m (re-search-forward |
37891
2fec97b8ea55
(speedbar-find-selected-file): RE-quote the filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37180
diff
changeset
|
2684 (concat " \\(" (regexp-quote (file-name-nondirectory file)) |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2685 "\\)\\(" speedbar-indicator-regex "\\)?\n") |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2686 nil t)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2687 (not (string= file |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2688 (concat |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2689 (speedbar-line-directory |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2690 (save-excursion |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2691 (goto-char (match-beginning 0)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2692 (beginning-of-line) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2693 (save-match-data |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2694 (looking-at "[0-9]+:") |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2695 (string-to-number (match-string 0))))) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2696 (match-string 1)))))) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2697 (if m |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2698 (progn |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2699 (goto-char (match-beginning 1)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2700 (match-string 1))))) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2701 |
21650 | 2702 (defun speedbar-clear-current-file () |
2703 "Locate the file thought to be current, and remove its highlighting." | |
2704 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2705 ;;(set-buffer speedbar-buffer) |
21650 | 2706 (if speedbar-last-selected-file |
2707 (speedbar-with-writable | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2708 (if (speedbar-find-selected-file speedbar-last-selected-file) |
21650 | 2709 (put-text-property (match-beginning 1) |
2710 (match-end 1) | |
2711 'face | |
2712 'speedbar-file-face)))))) | |
2713 | |
2714 (defun speedbar-update-current-file () | |
2715 "Find the current file, and update our visuals to indicate its name. | |
2716 This is specific to file names. If the file name doesn't show up, but | |
2717 it should be in the list, then the directory cache needs to be | |
2718 updated." | |
2719 (let* ((lastf (selected-frame)) | |
2720 (newcfd (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2721 (dframe-select-attached-frame speedbar-frame) |
21650 | 2722 (let ((rf (if (buffer-file-name) |
2723 (buffer-file-name) | |
2724 nil))) | |
2725 (select-frame lastf) | |
2726 rf))) | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2727 (newcf (if newcfd newcfd)) |
21650 | 2728 (lastb (current-buffer)) |
22735 | 2729 (sucf-recursive (boundp 'sucf-recursive)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2730 (case-fold-search t)) |
21650 | 2731 (if (and newcf |
2732 ;; check here, that way we won't refresh to newcf until | |
2733 ;; its been written, thus saving ourselves some time | |
2734 (file-exists-p newcf) | |
2735 (not (string= newcf speedbar-last-selected-file))) | |
2736 (progn | |
2737 ;; It is important to select the frame, otherwise the window | |
2738 ;; we want the cursor to move in will not be updated by the | |
2739 ;; search-forward command. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2740 (select-frame (speedbar-current-frame)) |
21650 | 2741 ;; Remove the old file... |
2742 (speedbar-clear-current-file) | |
2743 ;; now highlight the new one. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2744 ;; (set-buffer speedbar-buffer) |
21650 | 2745 (speedbar-with-writable |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2746 (if (speedbar-find-selected-file newcf) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2747 ;; put the property on it |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2748 (put-text-property (match-beginning 1) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2749 (match-end 1) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2750 'face |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2751 'speedbar-selected-face) |
21650 | 2752 ;; Oops, it's not in the list. Should it be? |
2753 (if (and (string-match speedbar-file-regexp newcf) | |
2754 (string= (file-name-directory newcfd) | |
2755 (expand-file-name default-directory))) | |
2756 ;; yes, it is (we will ignore unknowns for now...) | |
2757 (progn | |
2758 (speedbar-refresh) | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2759 (if (speedbar-find-selected-file newcf) |
21650 | 2760 ;; put the property on it |
2761 (put-text-property (match-beginning 1) | |
2762 (match-end 1) | |
2763 'face | |
2764 'speedbar-selected-face))) | |
2765 ;; if it's not in there now, whatever... | |
2766 )) | |
2767 (setq speedbar-last-selected-file newcf)) | |
2768 (if (not sucf-recursive) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
2769 (progn |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2770 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2771 ;;Sat Dec 15 2001 12:40 AM (burton@openprivacy.org): this |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2772 ;;doesn't need to be in. We don't want to recenter when we are |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2773 ;;updating files. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2774 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2775 ;;(speedbar-center-buffer-smartly) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2776 |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
2777 (speedbar-position-cursor-on-line) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
2778 )) |
21650 | 2779 (set-buffer lastb) |
2780 (select-frame lastf) | |
2781 ))) | |
2782 ;; return that we are done with this activity. | |
2783 t) | |
2784 | |
22735 | 2785 (defun speedbar-add-indicator (indicator-string &optional replace-this) |
2786 "Add INDICATOR-STRING to the end of this speedbar line. | |
2787 If INDICATOR-STRING is space, and REPLACE-THIS is a character, then | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
2788 the existing indicator is removed. If there is already an |
22735 | 2789 indicator, then do not add a space." |
2790 (beginning-of-line) | |
2791 ;; The nature of the beast: Assume we are in "the right place" | |
2792 (end-of-line) | |
2793 (skip-chars-backward (concat " " speedbar-vc-indicator | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2794 speedbar-object-read-only-indicator |
22735 | 2795 (car speedbar-obj-indicator) |
2796 (cdr speedbar-obj-indicator))) | |
2797 (if (and (not (looking-at speedbar-indicator-regex)) | |
2798 (not (string= indicator-string " "))) | |
2799 (insert speedbar-indicator-separator)) | |
2800 (speedbar-with-writable | |
2801 (save-excursion | |
2802 (if (and replace-this | |
2803 (re-search-forward replace-this (save-excursion (end-of-line) | |
2804 (point)) | |
2805 t)) | |
2806 (delete-region (match-beginning 0) (match-end 0)))) | |
2807 (end-of-line) | |
2808 (if (not (string= " " indicator-string)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2809 (let ((start (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2810 (insert indicator-string) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2811 (speedbar-insert-image-button-maybe start (length indicator-string)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2812 )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2813 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2814 (defun speedbar-check-read-only () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2815 "Scan all the files in a directory, and for each see if it is read only." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2816 ;; Check for to-do to be reset. If reset but no RCS is available |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2817 ;; then set to nil (do nothing) otherwise, start at the beginning |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2818 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2819 (if speedbar-buffer (set-buffer speedbar-buffer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2820 (if (eq speedbar-ro-to-do-point t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2821 (setq speedbar-ro-to-do-point 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2822 (if (numberp speedbar-ro-to-do-point) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2823 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2824 (goto-char speedbar-ro-to-do-point) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2825 (while (and (not (input-pending-p)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2826 (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+-\?][]>] " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2827 nil t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2828 (setq speedbar-ro-to-do-point (point)) |
65780
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2829 (let ((f (speedbar-line-file))) |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2830 (if f |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2831 (if (not (file-writable-p f)) |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2832 (speedbar-add-indicator |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2833 speedbar-object-read-only-indicator |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2834 (regexp-quote speedbar-object-read-only-indicator)) |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2835 (speedbar-add-indicator |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2836 " " (regexp-quote |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2837 speedbar-object-read-only-indicator)))))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2838 (if (input-pending-p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2839 ;; return that we are incomplete |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2840 nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2841 ;; we are done, set to-do to nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2842 (setq speedbar-ro-to-do-point nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2843 ;; and return t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2844 t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2845 t))) |
22735 | 2846 |
2847 ;; Load efs/ange-ftp only if compiling to remove byte-compiler warnings. | |
21650 | 2848 ;; Steven L Baur <steve@xemacs.org> said this was important: |
22735 | 2849 (eval-when-compile (or (featurep 'xemacs) |
2850 (condition-case () (require 'efs) | |
2851 (error (require 'ange-ftp))))) | |
21650 | 2852 |
2853 (defun speedbar-check-vc () | |
2854 "Scan all files in a directory, and for each see if it's checked out. | |
2855 See `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p' for how | |
2856 to add more types of version control systems." | |
2857 ;; Check for to-do to be reset. If reset but no RCS is available | |
2858 ;; then set to nil (do nothing) otherwise, start at the beginning | |
2859 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2860 (if speedbar-buffer (set-buffer speedbar-buffer)) |
21650 | 2861 (if (and speedbar-vc-do-check (eq speedbar-vc-to-do-point t) |
2862 (speedbar-vc-check-dir-p default-directory) | |
22735 | 2863 (not (or (and (featurep 'ange-ftp) |
2864 (string-match | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2865 (car (symbol-value |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2866 (if dframe-xemacsp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2867 'ange-ftp-directory-format |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2868 'ange-ftp-name-format))) |
22735 | 2869 (expand-file-name default-directory))) |
2870 ;; efs support: Bob Weiner | |
2871 (and (featurep 'efs) | |
2872 (string-match | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2873 (let ((reg (symbol-value 'efs-directory-regexp))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2874 (if (stringp reg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2875 reg |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2876 (car reg))) |
22735 | 2877 (expand-file-name default-directory)))))) |
21650 | 2878 (setq speedbar-vc-to-do-point 0)) |
2879 (if (numberp speedbar-vc-to-do-point) | |
2880 (progn | |
2881 (goto-char speedbar-vc-to-do-point) | |
2882 (while (and (not (input-pending-p)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2883 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-?]\\] " |
21650 | 2884 nil t)) |
2885 (setq speedbar-vc-to-do-point (point)) | |
2886 (if (speedbar-check-vc-this-line (match-string 1)) | |
22735 | 2887 (speedbar-add-indicator speedbar-vc-indicator |
2888 (regexp-quote speedbar-vc-indicator)) | |
2889 (speedbar-add-indicator " " | |
2890 (regexp-quote speedbar-vc-indicator)))) | |
21650 | 2891 (if (input-pending-p) |
2892 ;; return that we are incomplete | |
2893 nil | |
2894 ;; we are done, set to-do to nil | |
2895 (setq speedbar-vc-to-do-point nil) | |
2896 ;; and return t | |
2897 t)) | |
2898 t))) | |
2899 | |
2900 (defun speedbar-check-vc-this-line (depth) | |
2901 "Return t if the file on this line is check of of a version control system. | |
2902 Parameter DEPTH is a string with the current depth of indentation of | |
2903 the file being checked." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2904 (let* ((d (string-to-number depth)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2905 (f (speedbar-line-directory d)) |
21650 | 2906 (fn (buffer-substring-no-properties |
2907 ;; Skip-chars: thanks ptype@dra.hmg.gb | |
2908 (point) (progn | |
2909 (skip-chars-forward "^ " | |
2910 (save-excursion (end-of-line) | |
2911 (point))) | |
2912 (point)))) | |
2913 (fulln (concat f fn))) | |
2914 (if (<= 2 speedbar-verbosity-level) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2915 (speedbar-message "Speedbar vc check...%s" fulln)) |
21650 | 2916 (and (file-writable-p fulln) |
2917 (speedbar-this-file-in-vc f fn)))) | |
2918 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2919 (defun speedbar-vc-check-dir-p (directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2920 "Return t if we should bother checking DIRECTORY for version control files. |
21650 | 2921 This can be overloaded to add new types of version control systems." |
2922 (or | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2923 ;; Local CVS available in Emacs 21 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2924 (and (fboundp 'vc-state) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2925 (file-exists-p (concat directory "CVS/"))) |
21650 | 2926 ;; Local RCS |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2927 (file-exists-p (concat directory "RCS/")) |
21650 | 2928 ;; Local SCCS |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2929 (file-exists-p (concat directory "SCCS/")) |
21650 | 2930 ;; Remote SCCS project |
2931 (let ((proj-dir (getenv "PROJECTDIR"))) | |
2932 (if proj-dir | |
2933 (file-exists-p (concat proj-dir "/SCCS")) | |
2934 nil)) | |
2935 ;; User extension | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2936 (run-hook-with-args-until-success 'speedbar-vc-directory-enable-hook |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2937 directory) |
21650 | 2938 )) |
2939 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2940 (defun speedbar-this-file-in-vc (directory name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2941 "Check to see if the file in DIRECTORY with NAME is in a version control system. |
21650 | 2942 You can add new VC systems by overriding this function. You can |
2943 optimize this function by overriding it and only doing those checks | |
2944 that will occur on your system." | |
2945 (or | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2946 (if (fboundp 'vc-state) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2947 ;; Emacs 21 handles VC state in a nice way. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2948 (condition-case nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2949 (let ((state (vc-state (concat directory name)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2950 (not (or (eq 'up-to-date state) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2951 (null state)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2952 ;; An error means not in a VC system |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2953 (error nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2954 (or |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2955 ;; RCS file name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2956 (file-exists-p (concat directory "RCS/" name ",v")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2957 (file-exists-p (concat directory "RCS/" name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2958 ;; Local SCCS file name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2959 (file-exists-p (concat directory "SCCS/s." name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2960 ;; Remote SCCS file name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2961 (let ((proj-dir (getenv "PROJECTDIR"))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2962 (if proj-dir |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2963 (file-exists-p (concat proj-dir "/SCCS/s." name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2964 nil)))) |
21650 | 2965 ;; User extension |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2966 (run-hook-with-args 'speedbar-vc-in-control-hook directory name) |
21650 | 2967 )) |
22735 | 2968 |
2969 ;; Objet File scanning | |
2970 (defun speedbar-check-objects () | |
2971 "Scan all files in a directory, and for each see if there is an object. | |
2972 See `speedbar-check-obj-this-line' and `speedbar-obj-alist' for how | |
2973 to add more object types." | |
2974 ;; Check for to-do to be reset. If reset but no RCS is available | |
2975 ;; then set to nil (do nothing) otherwise, start at the beginning | |
2976 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2977 (if speedbar-buffer (set-buffer speedbar-buffer)) |
22735 | 2978 (if (and speedbar-obj-do-check (eq speedbar-obj-to-do-point t)) |
2979 (setq speedbar-obj-to-do-point 0)) | |
2980 (if (numberp speedbar-obj-to-do-point) | |
2981 (progn | |
2982 (goto-char speedbar-obj-to-do-point) | |
2983 (while (and (not (input-pending-p)) | |
2984 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-]\\] " | |
2985 nil t)) | |
2986 (setq speedbar-obj-to-do-point (point)) | |
2987 (let ((ind (speedbar-check-obj-this-line (match-string 1)))) | |
2988 (if (not ind) (setq ind " ")) | |
2989 (speedbar-add-indicator ind (concat | |
2990 (car speedbar-obj-indicator) | |
2991 "\\|" | |
2992 (cdr speedbar-obj-indicator))))) | |
2993 (if (input-pending-p) | |
2994 ;; return that we are incomplete | |
2995 nil | |
2996 ;; we are done, set to-do to nil | |
2997 (setq speedbar-obj-to-do-point nil) | |
2998 ;; and return t | |
2999 t)) | |
3000 t))) | |
3001 | |
3002 (defun speedbar-check-obj-this-line (depth) | |
3003 "Return t if the file on this line has an associated object. | |
3004 Parameter DEPTH is a string with the current depth of indentation of | |
3005 the file being checked." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3006 (let* ((d (string-to-number depth)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3007 (f (speedbar-line-directory d)) |
22735 | 3008 (fn (buffer-substring-no-properties |
3009 ;; Skip-chars: thanks ptype@dra.hmg.gb | |
3010 (point) (progn | |
3011 (skip-chars-forward "^ " | |
3012 (save-excursion (end-of-line) | |
3013 (point))) | |
3014 (point)))) | |
3015 (fulln (concat f fn))) | |
3016 (if (<= 2 speedbar-verbosity-level) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3017 (speedbar-message "Speedbar obj check...%s" fulln)) |
22735 | 3018 (let ((oa speedbar-obj-alist)) |
3019 (while (and oa (not (string-match (car (car oa)) fulln))) | |
3020 (setq oa (cdr oa))) | |
3021 (if (not (and oa (file-exists-p (concat (file-name-sans-extension fulln) | |
3022 (cdr (car oa)))))) | |
3023 nil | |
3024 ;; Find out if the object is out of date or not. | |
3025 (let ((date1 (nth 5 (file-attributes fulln))) | |
3026 (date2 (nth 5 (file-attributes (concat | |
3027 (file-name-sans-extension fulln) | |
3028 (cdr (car oa))))))) | |
3029 (if (or (< (car date1) (car date2)) | |
3030 (and (= (car date1) (car date2)) | |
3031 (< (nth 1 date1) (nth 1 date2)))) | |
3032 (car speedbar-obj-indicator) | |
3033 (cdr speedbar-obj-indicator))))))) | |
21650 | 3034 |
3035 ;;; Clicking Activity | |
3036 ;; | |
3037 (defun speedbar-position-cursor-on-line () | |
3038 "Position the cursor on a line." | |
3039 (let ((oldpos (point))) | |
3040 (beginning-of-line) | |
3041 (if (looking-at "[0-9]+:\\s-*..?.? ") | |
3042 (goto-char (1- (match-end 0))) | |
3043 (goto-char oldpos)))) | |
3044 | |
3045 (defun speedbar-click (e) | |
3046 "Activate any speedbar buttons where the mouse is clicked. | |
3047 This must be bound to a mouse event. A button is any location of text | |
3048 with a mouse face that has a text property called `speedbar-function'. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3049 Argument E is the click event." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3050 ;; Backward compatibility let statement. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3051 (let ((speedbar-power-click dframe-power-click)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3052 (speedbar-do-function-pointer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3053 (dframe-quick-mouse e)) |
21650 | 3054 |
3055 (defun speedbar-do-function-pointer () | |
3056 "Look under the cursor and examine the text properties. | |
3057 From this extract the file/tag name, token, indentation level and call | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3058 a function if appropriate." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3059 (let* ((speedbar-frame (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3060 (fn (get-text-property (point) 'speedbar-function)) |
21650 | 3061 (tok (get-text-property (point) 'speedbar-token)) |
3062 ;; The 1-,+ is safe because scaning starts AFTER the point | |
3063 ;; specified. This lets the search include the character the | |
3064 ;; cursor is on. | |
3065 (tp (previous-single-property-change | |
3066 (1+ (point)) 'speedbar-function)) | |
3067 (np (next-single-property-change | |
3068 (point) 'speedbar-function)) | |
3069 (txt (buffer-substring-no-properties (or tp (point-min)) | |
3070 (or np (point-max)))) | |
3071 (dent (save-excursion (beginning-of-line) | |
3072 (string-to-number | |
3073 (if (looking-at "[0-9]+") | |
3074 (buffer-substring-no-properties | |
3075 (match-beginning 0) (match-end 0)) | |
3076 "0"))))) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3077 ;;(speedbar-message "%S:%S:%S:%s" fn tok txt dent) |
21650 | 3078 (and fn (funcall fn txt tok dent))) |
3079 (speedbar-position-cursor-on-line)) | |
3080 | |
3081 ;;; Reading info from the speedbar buffer | |
3082 ;; | |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3083 (defun speedbar-line-text (&optional p) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3084 "Retrieve the text after prefix junk for the current line. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3085 Optional argument P is where to start the search from." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3086 (save-excursion |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3087 (if p (goto-char p)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3088 (beginning-of-line) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3089 (if (looking-at (concat |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3090 "\\([0-9]+\\): *[[<{]?[-+?= ][]>}@()|] \\([^ \n]+\\)")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3091 (get-text-property (match-beginning 2) 'speedbar-text) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3092 nil))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3093 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3094 (defun speedbar-line-token (&optional p) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3095 "Retrieve the token information after the prefix junk for the current line. |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3096 Optional argument P is where to start the search from." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3097 (save-excursion |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3098 (if p (goto-char p)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3099 (beginning-of-line) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3100 (if (looking-at (concat |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3101 "\\([0-9]+\\): *[[<{]?[-+?= ][]>}@()|] \\([^ \n]+\\)\\(" |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3102 speedbar-indicator-regex "\\)?")) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3103 (progn |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3104 (goto-char (match-beginning 2)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3105 (get-text-property (point) 'speedbar-token)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3106 nil))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3107 |
21650 | 3108 (defun speedbar-line-file (&optional p) |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3109 "Retrieve the file or whatever from the line at point P. |
21650 | 3110 The return value is a string representing the file. If it is a |
3111 directory, then it is the directory name." | |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3112 (save-match-data |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3113 (save-restriction |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3114 (widen) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3115 (let ((f (speedbar-line-text p))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3116 (if f |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3117 (let* ((depth (string-to-number (match-string 1))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3118 (directory (speedbar-line-directory depth))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3119 (if (file-exists-p (concat directory f)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3120 (concat directory f) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3121 nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3122 nil))))) |
21650 | 3123 |
3124 (defun speedbar-goto-this-file (file) | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3125 "If FILE is displayed, go to this line and return t. |
21650 | 3126 Otherwise do not move and return nil." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3127 (let ((directory (substring (file-name-directory (expand-file-name file)) |
21650 | 3128 (length (expand-file-name default-directory)))) |
3129 (dest (point))) | |
3130 (save-match-data | |
3131 (goto-char (point-min)) | |
3132 ;; scan all the directories | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3133 (while (and directory (not (eq directory t))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3134 (if (string-match "^[/\\]?\\([^/\\]+\\)" directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3135 (let ((pp (match-string 1 directory))) |
21650 | 3136 (if (save-match-data |
3137 (re-search-forward (concat "> " (regexp-quote pp) "$") | |
3138 nil t)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3139 (setq directory (substring directory (match-end 1))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3140 (setq directory nil))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3141 (setq directory t))) |
21650 | 3142 ;; find the file part |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3143 (if (or (not directory) (string= (file-name-nondirectory file) "")) |
21650 | 3144 ;; only had a dir part |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3145 (if directory |
21650 | 3146 (progn |
3147 (speedbar-position-cursor-on-line) | |
3148 t) | |
3149 (goto-char dest) nil) | |
3150 ;; find the file part | |
3151 (let ((nd (file-name-nondirectory file))) | |
3152 (if (re-search-forward | |
3153 (concat "] \\(" (regexp-quote nd) | |
22735 | 3154 "\\)\\(" speedbar-indicator-regex "\\)$") |
21650 | 3155 nil t) |
3156 (progn | |
3157 (speedbar-position-cursor-on-line) | |
3158 t) | |
3159 (goto-char dest) | |
3160 nil)))))) | |
3161 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3162 (defun speedbar-line-directory (&optional depth) |
65809
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
3163 "Retrieve the directory name associated with the current line. |
21650 | 3164 This may require traversing backwards from DEPTH and combining the default |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3165 directory with these items. This function is replaceable in |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3166 `speedbar-mode-functions-list' as `speedbar-line-directory'." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3167 (save-restriction |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3168 (widen) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3169 (let ((rf (speedbar-fetch-replacement-function 'speedbar-line-directory))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3170 (if rf (funcall rf depth) default-directory)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3171 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3172 (defun speedbar-files-line-directory (&optional depth) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3173 "Retrieve the directoryname associated with the current line. |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3174 This may require traversing backwards from DEPTH and combining the default |
21650 | 3175 directory with these items." |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3176 (save-excursion |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3177 (save-match-data |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3178 (if (not depth) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3179 (progn |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3180 (beginning-of-line) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3181 (looking-at "^\\([0-9]+\\):") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3182 (setq depth (string-to-number (match-string 1))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3183 (let ((directory nil)) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3184 (setq depth (1- depth)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3185 (while (/= depth -1) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3186 (if (not (re-search-backward (format "^%d:" depth) nil t)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3187 (error "Error building filename of tag") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3188 (cond ((looking-at "[0-9]+:\\s-*<->\\s-+\\([^\n]+\\)") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3189 (setq directory (concat (speedbar-line-text) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3190 "/" |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3191 directory))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3192 ((looking-at "[0-9]+:\\s-*[-]\\s-+\\([^\n]+\\)") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3193 ;; This is the start of our directory. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3194 (setq directory (speedbar-line-text))))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3195 (setq depth (1- depth))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3196 (if (and directory |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3197 (string-match (concat speedbar-indicator-regex "$") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3198 directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3199 (setq directory (substring directory 0 (match-beginning 0)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3200 (concat default-directory directory))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3201 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3202 (defun speedbar-directory-line (directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3203 "Position the cursor on the line specified by DIRECTORY." |
21650 | 3204 (save-match-data |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3205 (if (string-match "[/\\]$" directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3206 (setq directory (substring directory 0 (match-beginning 0)))) |
21650 | 3207 (let ((nomatch t) (depth 0) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3208 (fname (file-name-nondirectory directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3209 (pname (file-name-directory directory))) |
21650 | 3210 (if (not (member pname speedbar-shown-directories)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3211 (error "Internal Error: File %s not shown in speedbar" directory)) |
21650 | 3212 (goto-char (point-min)) |
3213 (while (and nomatch | |
3214 (re-search-forward | |
3215 (concat "[]>] \\(" (regexp-quote fname) | |
22735 | 3216 "\\)\\(" speedbar-indicator-regex "\\)?$") |
21650 | 3217 nil t)) |
3218 (beginning-of-line) | |
3219 (looking-at "\\([0-9]+\\):") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3220 (setq depth (string-to-number (match-string 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3221 nomatch (not (string= pname (speedbar-line-directory depth)))) |
21650 | 3222 (end-of-line)) |
3223 (beginning-of-line) | |
3224 (not nomatch)))) | |
3225 | |
3226 (defun speedbar-edit-line () | |
3227 "Edit whatever tag or file is on the current speedbar line." | |
3228 (interactive) | |
3229 (or (save-excursion | |
3230 (beginning-of-line) | |
3231 ;; If this fails, then it is a non-standard click, and as such, | |
3232 ;; perfectly allowed. | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
3233 (if (re-search-forward "[]>?}] [^ ]" |
21650 | 3234 (save-excursion (end-of-line) (point)) |
3235 t) | |
53487
25ff62ff164d
(speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
3236 (progn |
25ff62ff164d
(speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
3237 (forward-char -1) |
25ff62ff164d
(speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
3238 (speedbar-do-function-pointer)) |
21650 | 3239 nil)) |
3240 (speedbar-do-function-pointer))) | |
3241 | |
28925
89a795d90175
(speedbar-recenter): Typo, and fix logic.
Eric M. Ludlam <zappo@gnu.org>
parents:
28902
diff
changeset
|
3242 (defun speedbar-expand-line (&optional arg) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3243 "Expand the line under the cursor. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3244 With universal argument ARG, flush cached data." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3245 (interactive "P") |
21650 | 3246 (beginning-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3247 (let* ((dframe-power-click arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3248 (speedbar-power-click arg)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3249 (condition-case nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3250 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3251 (re-search-forward ":\\s-*.\\+. " |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3252 (save-excursion (end-of-line) (point))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3253 (forward-char -2) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3254 (speedbar-do-function-pointer)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3255 (error (speedbar-position-cursor-on-line))))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3256 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3257 (defun speedbar-flush-expand-line () |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3258 "Expand the line under the cursor and flush any cached information." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3259 (interactive) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3260 (speedbar-expand-line 1)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3261 |
21650 | 3262 (defun speedbar-contract-line () |
3263 "Contract the line under the cursor." | |
3264 (interactive) | |
3265 (beginning-of-line) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3266 (condition-case nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3267 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3268 (re-search-forward ":\\s-*.-. " |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3269 (save-excursion (end-of-line) (point))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3270 (forward-char -2) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3271 (speedbar-do-function-pointer)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3272 (error (speedbar-position-cursor-on-line)))) |
21650 | 3273 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3274 (defun speedbar-toggle-line-expansion () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3275 "Contract or expand the line under the cursor." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3276 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3277 (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3278 (condition-case nil |
21650 | 3279 (progn |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3280 (re-search-forward ":\\s-*.[-+]. " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3281 (save-excursion (end-of-line) (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3282 (forward-char -2) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3283 (speedbar-do-function-pointer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3284 (error (speedbar-position-cursor-on-line)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3285 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3286 (defun speedbar-expand-line-descendants (&optional arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3287 "Expand the line under the cursor and all descendants. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3288 Optional argument ARG indicates that any cache should be flushed." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3289 (interactive "P") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3290 (speedbar-expand-line arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3291 ;; Now, inside the area expaded here, expand all subnodes of |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3292 ;; the same descendant type. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3293 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3294 (speedbar-next 1) ;; Move into the list. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3295 (let ((err nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3296 (while (not err) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3297 (condition-case nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3298 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3299 (speedbar-expand-line-descendants arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3300 (speedbar-restricted-next 1)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3301 (error (setq err t)))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3302 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3303 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3304 (defun speedbar-contract-line-descendants () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3305 "Expand the line under the cursor and all descendants." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3306 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3307 (speedbar-contract-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3308 ;; Don't need to do anything else since all descendants are |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3309 ;; hidden by default anyway. Yay! It's easy. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3310 ) |
21650 | 3311 |
3312 (defun speedbar-find-file (text token indent) | |
3313 "Speedbar click handler for filenames. | |
3314 TEXT, the file will be displayed in the attached frame. | |
3315 TOKEN is unused, but required by the click handler. INDENT is the | |
3316 current indentation level." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3317 (let ((cdd (speedbar-line-directory indent))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3318 ;; Run before visiting file hook here. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3319 (let ((f (selected-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3320 (dframe-select-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3321 (run-hooks 'speedbar-before-visiting-file-hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3322 (select-frame f)) |
21650 | 3323 (speedbar-find-file-in-frame (concat cdd text)) |
3324 (speedbar-stealthy-updates) | |
3325 (run-hooks 'speedbar-visiting-file-hook) | |
3326 ;; Reset the timer with a new timeout when cliking a file | |
3327 ;; in case the user was navigating directories, we can cancel | |
3328 ;; that other timer. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3329 (speedbar-set-timer dframe-update-speed)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3330 (dframe-maybee-jump-to-attached-frame)) |
21650 | 3331 |
3332 (defun speedbar-dir-follow (text token indent) | |
3333 "Speedbar click handler for directory names. | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3334 Clicking a directory will cause the speedbar to list files in |
21650 | 3335 the subdirectory TEXT. TOKEN is an unused requirement. The |
3336 subdirectory chosen will be at INDENT level." | |
3337 (setq default-directory | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3338 (concat (expand-file-name (concat (speedbar-line-directory indent) text)) |
21650 | 3339 "/")) |
3340 ;; Because we leave speedbar as the current buffer, | |
3341 ;; update contents will change directory without | |
22735 | 3342 ;; having to touch the attached frame. Turn off smart expand just |
3343 ;; in case. | |
3344 (let ((speedbar-smart-directory-expand-flag nil)) | |
3345 (speedbar-update-contents)) | |
21650 | 3346 (speedbar-set-timer speedbar-navigating-speed) |
3347 (setq speedbar-last-selected-file nil) | |
3348 (speedbar-stealthy-updates)) | |
3349 | |
3350 (defun speedbar-delete-subblock (indent) | |
3351 "Delete text from point to indentation level INDENT or greater. | |
3352 Handles end-of-sublist smartly." | |
3353 (speedbar-with-writable | |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3354 (save-excursion |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3355 (end-of-line) (forward-char 1) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3356 (let ((start (point))) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3357 (while (and (looking-at "^\\([0-9]+\\):") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3358 (> (string-to-number (match-string 1)) indent) |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3359 (not (eobp))) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3360 (forward-line 1) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3361 (beginning-of-line)) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3362 (delete-region start (point)))))) |
21650 | 3363 |
3364 (defun speedbar-dired (text token indent) | |
3365 "Speedbar click handler for directory expand button. | |
3366 Clicking this button expands or contracts a directory. TEXT is the | |
3367 button clicked which has either a + or -. TOKEN is the directory to be | |
3368 expanded. INDENT is the current indentation level." | |
3369 (cond ((string-match "+" text) ;we have to expand this dir | |
3370 (setq speedbar-shown-directories | |
3371 (cons (expand-file-name | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3372 (concat (speedbar-line-directory indent) token "/")) |
21650 | 3373 speedbar-shown-directories)) |
3374 (speedbar-change-expand-button-char ?-) | |
3375 (speedbar-reset-scanners) | |
3376 (save-excursion | |
3377 (end-of-line) (forward-char 1) | |
3378 (speedbar-with-writable | |
3379 (speedbar-default-directory-list | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3380 (concat (speedbar-line-directory indent) token "/") |
21650 | 3381 (1+ indent))))) |
3382 ((string-match "-" text) ;we have to contract this node | |
3383 (speedbar-reset-scanners) | |
3384 (let ((oldl speedbar-shown-directories) | |
3385 (newl nil) | |
3386 (td (expand-file-name | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3387 (concat (speedbar-line-directory indent) token)))) |
21650 | 3388 (while oldl |
3389 (if (not (string-match (concat "^" (regexp-quote td)) (car oldl))) | |
3390 (setq newl (cons (car oldl) newl))) | |
3391 (setq oldl (cdr oldl))) | |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3392 (setq speedbar-shown-directories (nreverse newl))) |
21650 | 3393 (speedbar-change-expand-button-char ?+) |
3394 (speedbar-delete-subblock indent) | |
3395 ) | |
22735 | 3396 (t (error "Ooops... not sure what to do"))) |
21650 | 3397 (speedbar-center-buffer-smartly) |
3398 (save-excursion (speedbar-stealthy-updates))) | |
3399 | |
3400 (defun speedbar-directory-buttons-follow (text token indent) | |
3401 "Speedbar click handler for default directory buttons. | |
3402 TEXT is the button clicked on. TOKEN is the directory to follow. | |
3403 INDENT is the current indentation level and is unused." | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
3404 (if (string-match "^[A-z]:$" token) |
48716
376c832d1ca7
(speedbar-directory-buttons-follow): Don't use directory-sep-char.
Richard M. Stallman <rms@gnu.org>
parents:
48686
diff
changeset
|
3405 (setq default-directory (concat token "/")) |
22735 | 3406 (setq default-directory token)) |
21650 | 3407 ;; Because we leave speedbar as the current buffer, |
3408 ;; update contents will change directory without | |
3409 ;; having to touch the attached frame. | |
3410 (speedbar-update-contents) | |
3411 (speedbar-set-timer speedbar-navigating-speed)) | |
3412 | |
3413 (defun speedbar-tag-file (text token indent) | |
3414 "The cursor is on a selected line. Expand the tags in the specified file. | |
3415 The parameter TEXT and TOKEN are required, where TEXT is the button | |
3416 clicked, and TOKEN is the file to expand. INDENT is the current | |
3417 indentation level." | |
3418 (cond ((string-match "+" text) ;we have to expand this file | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3419 (let* ((fn (expand-file-name (concat (speedbar-line-directory indent) |
21650 | 3420 token))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3421 (mode nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3422 (lst (speedbar-fetch-dynamic-tags fn))) |
21650 | 3423 ;; if no list, then remove expando button |
3424 (if (not lst) | |
3425 (speedbar-change-expand-button-char ??) | |
3426 (speedbar-change-expand-button-char ?-) | |
3427 (speedbar-with-writable | |
3428 (save-excursion | |
3429 (end-of-line) (forward-char 1) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3430 (funcall (car lst) indent (cdr lst))))))) |
21650 | 3431 ((string-match "-" text) ;we have to contract this node |
3432 (speedbar-change-expand-button-char ?+) | |
3433 (speedbar-delete-subblock indent)) | |
22735 | 3434 (t (error "Ooops... not sure what to do"))) |
21650 | 3435 (speedbar-center-buffer-smartly)) |
3436 | |
3437 (defun speedbar-tag-find (text token indent) | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3438 "For the tag TEXT in a file TOKEN, go to that position. |
21650 | 3439 INDENT is the current indentation level." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3440 (let ((file (speedbar-line-directory indent))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3441 (let ((f (selected-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3442 (dframe-select-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3443 (run-hooks 'speedbar-before-visiting-tag-hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3444 (select-frame f)) |
21650 | 3445 (speedbar-find-file-in-frame file) |
3446 (save-excursion (speedbar-stealthy-updates)) | |
3447 ;; Reset the timer with a new timeout when cliking a file | |
3448 ;; in case the user was navigating directories, we can cancel | |
3449 ;; that other timer. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3450 (speedbar-set-timer dframe-update-speed) |
21650 | 3451 (goto-char token) |
3452 (run-hooks 'speedbar-visiting-tag-hook) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3453 (dframe-maybee-jump-to-attached-frame) |
21650 | 3454 )) |
3455 | |
3456 (defun speedbar-tag-expand (text token indent) | |
3457 "Expand a tag sublist. Imenu will return sub-lists of specialized tag types. | |
3458 Etags does not support this feature. TEXT will be the button | |
3459 string. TOKEN will be the list, and INDENT is the current indentation | |
3460 level." | |
3461 (cond ((string-match "+" text) ;we have to expand this file | |
3462 (speedbar-change-expand-button-char ?-) | |
3463 (speedbar-with-writable | |
3464 (save-excursion | |
3465 (end-of-line) (forward-char 1) | |
22735 | 3466 (speedbar-insert-generic-list indent token 'speedbar-tag-expand |
21650 | 3467 'speedbar-tag-find)))) |
3468 ((string-match "-" text) ;we have to contract this node | |
3469 (speedbar-change-expand-button-char ?+) | |
3470 (speedbar-delete-subblock indent)) | |
22735 | 3471 (t (error "Ooops... not sure what to do"))) |
21650 | 3472 (speedbar-center-buffer-smartly)) |
3473 | |
3474 ;;; Loading files into the attached frame. | |
3475 ;; | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3476 (defcustom speedbar-select-frame-method 'attached |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3477 "*Specify how to select a frame for displaying a file. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3478 A value of 'attached means to use the attached frame (the frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3479 that speedbar was started from.) A number such as 1 or -1 means to |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3480 pass that number to `other-frame' while selecting a frame from speedbar." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3481 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3482 :type 'sexp) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3483 |
21650 | 3484 (defun speedbar-find-file-in-frame (file) |
3485 "This will load FILE into the speedbar attached frame. | |
3486 If the file is being displayed in a different frame already, then raise that | |
3487 frame instead." | |
3488 (let* ((buff (find-file-noselect file)) | |
3489 (bwin (get-buffer-window buff 0))) | |
3490 (if bwin | |
3491 (progn | |
3492 (select-window bwin) | |
3493 (raise-frame (window-frame bwin))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3494 (if dframe-power-click |
21650 | 3495 (let ((pop-up-frames t)) (select-window (display-buffer buff))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3496 (if (numberp speedbar-select-frame-method) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3497 (other-frame speedbar-select-frame-method) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3498 (dframe-select-attached-frame speedbar-frame)) |
21650 | 3499 (switch-to-buffer buff)))) |
22735 | 3500 ) |
21650 | 3501 |
3502 ;;; Centering Utility | |
3503 ;; | |
3504 (defun speedbar-center-buffer-smartly () | |
3505 "Recenter a speedbar buffer so the current indentation level is all visible. | |
3506 This assumes that the cursor is on a file, or tag of a file which the user is | |
3507 interested in." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3508 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3509 (save-selected-window |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3510 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3511 (select-window (get-buffer-window speedbar-buffer t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3512 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3513 (set-buffer speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3514 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3515 (if (<= (count-lines (point-min) (point-max)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3516 (1- (window-height (selected-window)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3517 ;; whole buffer fits |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3518 (let ((cp (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3519 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3520 (goto-char (point-min)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3521 (recenter 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3522 (goto-char cp)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3523 ;; too big |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3524 (let (depth start end exp p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3525 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3526 (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3527 (setq depth (if (looking-at "[0-9]+") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3528 (string-to-number (buffer-substring-no-properties |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3529 (match-beginning 0) (match-end 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3530 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3531 (setq exp (format "^%d:" depth))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3532 (save-excursion |
21650 | 3533 (end-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3534 (if (re-search-backward exp nil t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3535 (setq start (point)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3536 (setq start (point-min))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3537 (save-excursion ;Not sure about this part. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3538 (end-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3539 (setq p (point)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3540 (while (and (not (re-search-forward exp nil t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3541 (>= depth 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3542 (setq depth (1- depth)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3543 (setq exp (format "^%d:" depth))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3544 (if (/= (point) p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3545 (setq end (point)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3546 (setq end (point-max))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3547 ;; Now work out the details of centering |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3548 (let ((nl (count-lines start end)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3549 (wl (1- (window-height (selected-window)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3550 (cp (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3551 (if (> nl wl) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3552 ;; We can't fit it all, so just center on cursor |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3553 (progn (goto-char start) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3554 (recenter 1)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3555 ;; we can fit everything on the screen, but... |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3556 (if (and (pos-visible-in-window-p start (selected-window)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3557 (pos-visible-in-window-p end (selected-window))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3558 ;; we are all set! |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3559 nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3560 ;; we need to do something... |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3561 (goto-char start) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3562 (let ((newcent (/ (- (window-height (selected-window)) nl) 2)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3563 (lte (count-lines start (point-max)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3564 (if (and (< (+ newcent lte) (window-height (selected-window))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3565 (> (- (window-height (selected-window)) lte 1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3566 newcent)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3567 (setq newcent (- (window-height (selected-window)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3568 lte 1))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3569 (recenter newcent)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3570 (goto-char cp)))))) |
21650 | 3571 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3572 ;;; Tag Management -- List of expanders: |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3573 ;; |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3574 (defun speedbar-fetch-dynamic-tags (file) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3575 "Return a list of tags generated dynamically from FILE. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3576 This uses the entries in `speedbar-dynamic-tags-function-list' |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3577 to find the proper tags. It is up to each of those individual |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3578 functions to do caching and flushing if appropriate." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3579 (save-excursion |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3580 ;; If a file is in memory, switch to that buffer. This allows |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3581 ;; us to use the local variable. If the file is on disk, we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3582 ;; can try a few of the defaults that can get tags without |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3583 ;; opening the file. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3584 (if (get-file-buffer file) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3585 (set-buffer (get-file-buffer file))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3586 ;; If there is a buffer-local value of |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3587 ;; speedbar-dynamic-tags-function-list, it will now be available. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3588 (let ((dtf speedbar-dynamic-tags-function-list) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3589 (ret t)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3590 (while (and (eq ret t) dtf) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3591 (setq ret |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3592 (if (fboundp (car (car dtf))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3593 (funcall (car (car dtf)) file) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3594 t)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3595 (if (eq ret t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3596 (setq dtf (cdr dtf)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3597 (if (eq ret t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3598 ;; No valid tag list, return nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3599 nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3600 ;; We have some tags. Return the list with the insert fn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3601 ;; prepended |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3602 (cons (cdr (car dtf)) ret))))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3603 |
21650 | 3604 ;;; Tag Management -- Imenu |
3605 ;; | |
3606 (if (not speedbar-use-imenu-flag) | |
3607 | |
3608 nil | |
3609 | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
3610 (eval-when-compile (condition-case nil (require 'imenu) (error nil))) |
21650 | 3611 |
3612 (defun speedbar-fetch-dynamic-imenu (file) | |
3613 "Load FILE into a buffer, and generate tags using Imenu. | |
3614 Returns the tag list, or t for an error." | |
3615 ;; Load this AND compile it in | |
3616 (require 'imenu) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3617 (set-buffer (find-file-noselect file)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3618 (if dframe-power-click (setq imenu--index-alist nil)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3619 (condition-case nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3620 (let ((index-alist (imenu--make-index-alist t))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3621 (if speedbar-sort-tags |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3622 (sort (copy-alist index-alist) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3623 (lambda (a b) (string< (car a) (car b)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3624 index-alist)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3625 (error t))) |
21650 | 3626 ) |
3627 | |
3628 ;;; Tag Management -- etags (old XEmacs compatibility part) | |
3629 ;; | |
3630 (defvar speedbar-fetch-etags-parse-list | |
3631 '(;; Note that java has the same parse-group as c | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3632 ("\\.\\([cChH]\\|c\\+\\+\\|cpp\\|cc\\|hh\\|java\\|cxx\\|hxx\\)\\'" . |
21650 | 3633 speedbar-parse-c-or-c++tag) |
3634 ("^\\.emacs$\\|.\\(el\\|l\\|lsp\\)\\'" . | |
3635 "def[^i]+\\s-+\\(\\(\\w\\|[-_]\\)+\\)\\s-*\C-?") | |
22735 | 3636 ; ("\\.\\([fF]\\|for\\|FOR\\|77\\|90\\)\\'" . |
3637 ; speedbar-parse-fortran77-tag) | |
21650 | 3638 ("\\.tex\\'" . speedbar-parse-tex-string) |
3639 ("\\.p\\'" . | |
3640 "\\(\\(FUNCTION\\|function\\|PROCEDURE\\|procedure\\)\\s-+\\([a-zA-Z0-9_.:]+\\)\\)\\s-*(?^?") | |
3641 ) | |
3642 "Associations of file extensions and expressions for extracting tags. | |
3643 To add a new file type, you would want to add a new association to the | |
3644 list, where the car is the file match, and the cdr is the way to | |
3645 extract an element from the tags output. If the output is complex, | |
3646 use a function symbol instead of regexp. The function should expect | |
3647 to be at the beginning of a line in the etags buffer. | |
3648 | |
3649 This variable is ignored if `speedbar-use-imenu-flag' is non-nil.") | |
3650 | |
3651 (defvar speedbar-fetch-etags-command "etags" | |
3652 "*Command used to create an etags file. | |
3653 | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3654 This variable is ignored if `speedbar-use-imenu-flag' is t.") |
21650 | 3655 |
3656 (defvar speedbar-fetch-etags-arguments '("-D" "-I" "-o" "-") | |
3657 "*List of arguments to use with `speedbar-fetch-etags-command'. | |
3658 This creates an etags output buffer. Use `speedbar-toggle-etags' to | |
3659 modify this list conveniently. | |
3660 | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3661 This variable is ignored if `speedbar-use-imenu-flag' is t.") |
21650 | 3662 |
3663 (defun speedbar-toggle-etags (flag) | |
3664 "Toggle FLAG in `speedbar-fetch-etags-arguments'. | |
3665 FLAG then becomes a member of etags command line arguments. If flag | |
3666 is \"sort\", then toggle the value of `speedbar-sort-tags'. If its | |
3667 value is \"show\" then toggle the value of | |
3668 `speedbar-show-unknown-files'. | |
3669 | |
3670 This function is a convenience function for XEmacs menu created by | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3671 Farzin Guilak <farzin@protocol.com>." |
21650 | 3672 (interactive) |
3673 (cond | |
3674 ((equal flag "sort") | |
3675 (setq speedbar-sort-tags (not speedbar-sort-tags))) | |
3676 ((equal flag "show") | |
3677 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files))) | |
3678 ((or (equal flag "-C") | |
3679 (equal flag "-S") | |
3680 (equal flag "-D")) | |
3681 (if (member flag speedbar-fetch-etags-arguments) | |
3682 (setq speedbar-fetch-etags-arguments | |
3683 (delete flag speedbar-fetch-etags-arguments)) | |
3684 (add-to-list 'speedbar-fetch-etags-arguments flag))) | |
3685 (t nil))) | |
3686 | |
3687 (defun speedbar-fetch-dynamic-etags (file) | |
3688 "For FILE, run etags and create a list of symbols extracted. | |
3689 Each symbol will be associated with its line position in FILE." | |
3690 (let ((newlist nil)) | |
3691 (unwind-protect | |
3692 (save-excursion | |
3693 (if (get-buffer "*etags tmp*") | |
3694 (kill-buffer "*etags tmp*")) ;kill to clean it up | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3695 (if (<= 1 speedbar-verbosity-level) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3696 (speedbar-message "Fetching etags...")) |
21650 | 3697 (set-buffer (get-buffer-create "*etags tmp*")) |
3698 (apply 'call-process speedbar-fetch-etags-command nil | |
3699 (current-buffer) nil | |
3700 (append speedbar-fetch-etags-arguments (list file))) | |
3701 (goto-char (point-min)) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3702 (if (<= 1 speedbar-verbosity-level) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3703 (speedbar-message "Fetching etags...")) |
21650 | 3704 (let ((expr |
3705 (let ((exprlst speedbar-fetch-etags-parse-list) | |
3706 (ans nil)) | |
3707 (while (and (not ans) exprlst) | |
3708 (if (string-match (car (car exprlst)) file) | |
3709 (setq ans (car exprlst))) | |
3710 (setq exprlst (cdr exprlst))) | |
3711 (cdr ans)))) | |
3712 (if expr | |
3713 (let (tnl) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3714 (set-buffer (get-buffer-create "*etags tmp*")) |
21650 | 3715 (while (not (save-excursion (end-of-line) (eobp))) |
3716 (save-excursion | |
3717 (setq tnl (speedbar-extract-one-symbol expr))) | |
3718 (if tnl (setq newlist (cons tnl newlist))) | |
3719 (forward-line 1))) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3720 (speedbar-message |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3721 "Sorry, no support for a file of that extension")))) |
21650 | 3722 ) |
3723 (if speedbar-sort-tags | |
3724 (sort newlist (lambda (a b) (string< (car a) (car b)))) | |
3725 (reverse newlist)))) | |
3726 | |
3727 ;; This bit donated by Farzin Guilak <farzin@protocol.com> but I'm not | |
3728 ;; sure it's needed with the different sorting method. | |
3729 ;; | |
3730 ;(defun speedbar-clean-etags() | |
3731 ; "Removes spaces before the ^? character, and removes `#define', | |
3732 ;return types, etc. preceding tags. This ensures that the sort operation | |
3733 ;works on the tags, not the return types." | |
3734 ; (save-excursion | |
3735 ; (goto-char (point-min)) | |
3736 ; (while | |
3737 ; (re-search-forward "(?[ \t](?\C-?" nil t) | |
3738 ; (replace-match "\C-?" nil nil)) | |
3739 ; (goto-char (point-min)) | |
3740 ; (while | |
3741 ; (re-search-forward "\\(.*[ \t]+\\)\\([^ \t\n]+.*\C-?\\)" nil t) | |
3742 ; (delete-region (match-beginning 1) (match-end 1))))) | |
3743 | |
3744 (defun speedbar-extract-one-symbol (expr) | |
22735 | 3745 "At point, return nil, or one alist in the form: (SYMBOL . POSITION) |
21650 | 3746 The line should contain output from etags. Parse the output using the |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3747 regular expression EXPR." |
21650 | 3748 (let* ((sym (if (stringp expr) |
3749 (if (save-excursion | |
3750 (re-search-forward expr (save-excursion | |
3751 (end-of-line) | |
3752 (point)) t)) | |
3753 (buffer-substring-no-properties (match-beginning 1) | |
3754 (match-end 1))) | |
3755 (funcall expr))) | |
3756 (pos (let ((j (re-search-forward "[\C-?\C-a]\\([0-9]+\\),\\([0-9]+\\)" | |
3757 (save-excursion | |
3758 (end-of-line) | |
3759 (point)) | |
3760 t))) | |
3761 (if (and j sym) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3762 (1+ (string-to-number (buffer-substring-no-properties |
21650 | 3763 (match-beginning 2) |
3764 (match-end 2)))) | |
3765 0)))) | |
3766 (if (/= pos 0) | |
3767 (cons sym pos) | |
3768 nil))) | |
3769 | |
3770 (defun speedbar-parse-c-or-c++tag () | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3771 "Parse a C or C++ tag, which tends to be a little complex." |
21650 | 3772 (save-excursion |
3773 (let ((bound (save-excursion (end-of-line) (point)))) | |
3774 (cond ((re-search-forward "\C-?\\([^\C-a]+\\)\C-a" bound t) | |
3775 (buffer-substring-no-properties (match-beginning 1) | |
3776 (match-end 1))) | |
3777 ((re-search-forward "\\<\\([^ \t]+\\)\\s-+new(" bound t) | |
3778 (buffer-substring-no-properties (match-beginning 1) | |
3779 (match-end 1))) | |
3780 ((re-search-forward "\\<\\([^ \t(]+\\)\\s-*(\C-?" bound t) | |
3781 (buffer-substring-no-properties (match-beginning 1) | |
3782 (match-end 1))) | |
3783 (t nil)) | |
3784 ))) | |
3785 | |
3786 (defun speedbar-parse-tex-string () | |
3787 "Parse a Tex string. Only find data which is relevant." | |
3788 (save-excursion | |
3789 (let ((bound (save-excursion (end-of-line) (point)))) | |
3790 (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t) | |
3791 (buffer-substring-no-properties (match-beginning 0) | |
3792 (match-end 0))) | |
3793 (t nil))))) | |
3794 | |
3795 | |
22735 | 3796 ;;; BUFFER DISPLAY mode. |
3797 ;; | |
3798 (defvar speedbar-buffers-key-map nil | |
3799 "Keymap used when in the buffers display mode.") | |
3800 | |
3801 (if speedbar-buffers-key-map | |
3802 nil | |
3803 (setq speedbar-buffers-key-map (speedbar-make-specialized-keymap)) | |
3804 | |
3805 ;; Basic tree features | |
3806 (define-key speedbar-buffers-key-map "e" 'speedbar-edit-line) | |
3807 (define-key speedbar-buffers-key-map "\C-m" 'speedbar-edit-line) | |
3808 (define-key speedbar-buffers-key-map "+" 'speedbar-expand-line) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3809 (define-key speedbar-buffers-key-map "=" 'speedbar-expand-line) |
22735 | 3810 (define-key speedbar-buffers-key-map "-" 'speedbar-contract-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3811 (define-key speedbar-buffers-key-map " " 'speedbar-toggle-line-expansion) |
22735 | 3812 |
3813 ;; Buffer specific keybindings | |
3814 (define-key speedbar-buffers-key-map "k" 'speedbar-buffer-kill-buffer) | |
3815 (define-key speedbar-buffers-key-map "r" 'speedbar-buffer-revert-buffer) | |
3816 | |
3817 ) | |
3818 | |
3819 (defvar speedbar-buffer-easymenu-definition | |
3820 '(["Jump to buffer" speedbar-edit-line t] | |
3821 ["Expand File Tags" speedbar-expand-line | |
3822 (save-excursion (beginning-of-line) | |
3823 (looking-at "[0-9]+: *.\\+. "))] | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3824 ["Flush Cache & Expand" speedbar-flush-expand-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3825 (save-excursion (beginning-of-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3826 (looking-at "[0-9]+: *.\\+. "))] |
22735 | 3827 ["Contract File Tags" speedbar-contract-line |
3828 (save-excursion (beginning-of-line) | |
3829 (looking-at "[0-9]+: *.-. "))] | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
3830 "----" |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3831 ["Kill Buffer" speedbar-buffer-kill-buffer |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3832 (save-excursion (beginning-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3833 (looking-at "[0-9]+: *.[-+?]. "))] |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3834 ["Revert Buffer" speedbar-buffer-revert-buffer |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3835 (save-excursion (beginning-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3836 (looking-at "[0-9]+: *.[-+?]. "))] |
22735 | 3837 ) |
3838 "Menu item elements shown when displaying a buffer list.") | |
3839 | |
3840 (defun speedbar-buffer-buttons (directory zero) | |
3841 "Create speedbar buttons based on the buffers currently loaded. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3842 DIRECTORY is the directory to the currently active buffer, and ZERO is 0." |
22735 | 3843 (speedbar-buffer-buttons-engine nil)) |
3844 | |
3845 (defun speedbar-buffer-buttons-temp (directory zero) | |
3846 "Create speedbar buttons based on the buffers currently loaded. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3847 DIRECTORY is the directory to the currently active buffer, and ZERO is 0." |
22735 | 3848 (speedbar-buffer-buttons-engine t)) |
3849 | |
3850 (defun speedbar-buffer-buttons-engine (temp) | |
3851 "Create speedbar buffer buttons. | |
3852 If TEMP is non-nil, then clicking on a buffer restores the previous display." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3853 (speedbar-insert-separator "Active Buffers:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3854 (let ((bl (buffer-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3855 (case-fold-search t)) |
22735 | 3856 (while bl |
3857 (if (string-match "^[ *]" (buffer-name (car bl))) | |
3858 nil | |
3859 (let* ((known (string-match speedbar-file-regexp | |
3860 (buffer-name (car bl)))) | |
3861 (expchar (if known ?+ ??)) | |
3862 (fn (if known 'speedbar-tag-file nil)) | |
3863 (fname (save-excursion (set-buffer (car bl)) | |
3864 (buffer-file-name)))) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3865 (speedbar-make-tag-line 'bracket expchar fn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3866 (if fname (file-name-nondirectory fname)) |
22735 | 3867 (buffer-name (car bl)) |
3868 'speedbar-buffer-click temp | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3869 'speedbar-file-face 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3870 (speedbar-buffers-tail-notes (car bl)))) |
22735 | 3871 (setq bl (cdr bl))) |
3872 (setq bl (buffer-list)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3873 (speedbar-insert-separator "Scratch Buffers:") |
22735 | 3874 (while bl |
3875 (if (not (string-match "^\\*" (buffer-name (car bl)))) | |
3876 nil | |
3877 (if (eq (car bl) speedbar-buffer) | |
3878 nil | |
3879 (speedbar-make-tag-line 'bracket ?? nil nil | |
3880 (buffer-name (car bl)) | |
3881 'speedbar-buffer-click temp | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3882 'speedbar-file-face 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3883 (speedbar-buffers-tail-notes (car bl)))) |
22735 | 3884 (setq bl (cdr bl))) |
3885 (setq bl (buffer-list)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3886 ;;(speedbar-insert-separator "Hidden Buffers:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3887 ;;(while bl |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3888 ;; (if (not (string-match "^ " (buffer-name (car bl)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3889 ;; nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3890 ;; (if (eq (car bl) speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3891 ;; nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3892 ;; (speedbar-make-tag-line 'bracket ?? nil nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3893 ;; (buffer-name (car bl)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3894 ;; 'speedbar-buffer-click temp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3895 ;; 'speedbar-file-face 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3896 ;; (speedbar-buffers-tail-notes (car bl)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3897 ;; (setq bl (cdr bl))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3898 )) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3899 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3900 (defun speedbar-buffers-tail-notes (buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3901 "Add a note to the end of the last tag line. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3902 Argument BUFFER is the buffer being tested." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3903 (let (mod ro) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3904 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3905 (set-buffer buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3906 (setq mod (buffer-modified-p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3907 ro buffer-read-only)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3908 (if ro (speedbar-insert-button "%" nil nil nil nil t)))) |
22735 | 3909 |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3910 (defun speedbar-buffers-item-info () |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3911 "Display information about the current buffer on the current line." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3912 (or (speedbar-item-info-tag-helper) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3913 (let* ((item (speedbar-line-text)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3914 (buffer (if item (get-buffer item) nil))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3915 (and buffer |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3916 (speedbar-message "%s%s %S %d %s" |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3917 (if (buffer-modified-p buffer) "* " "") |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3918 item |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3919 (save-excursion (set-buffer buffer) major-mode) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3920 (save-excursion (set-buffer buffer) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3921 (buffer-size)) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3922 (or (buffer-file-name buffer) "<No file>")))))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3923 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3924 (defun speedbar-buffers-line-directory (&optional depth) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3925 "Fetch the full directory to the file (buffer) specified on the current line. |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3926 Optional argument DEPTH specifies the current depth of the back search." |
36047
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3927 (save-excursion |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3928 (end-of-line) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3929 (let ((start (point))) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3930 ;; Buffers are always at level 0 |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3931 (if (not (re-search-backward "^0:" nil t)) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3932 nil |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3933 (let* ((bn (speedbar-line-text)) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3934 (buffer (if bn (get-buffer bn)))) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3935 (if buffer |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3936 (if (save-excursion |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3937 (end-of-line) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3938 (eq start (point))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3939 (or (save-excursion (set-buffer buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3940 default-directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3941 "") |
36047
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3942 (buffer-file-name buffer)))))))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3943 |
22735 | 3944 (defun speedbar-buffer-click (text token indent) |
3945 "When the users clicks on a buffer-button in speedbar. | |
3946 TEXT is the buffer's name, TOKEN and INDENT are unused." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3947 (if dframe-power-click |
22735 | 3948 (let ((pop-up-frames t)) (select-window (display-buffer text))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3949 (dframe-select-attached-frame speedbar-frame) |
22735 | 3950 (switch-to-buffer text) |
3951 (if token (speedbar-change-initial-expansion-list | |
3952 speedbar-previously-used-expansion-list-name)))) | |
3953 | |
3954 (defun speedbar-buffer-kill-buffer () | |
3955 "Kill the buffer the cursor is on in the speedbar buffer." | |
3956 (interactive) | |
3957 (or (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3958 (let ((text (speedbar-line-text))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3959 (if (and (get-buffer text) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3960 (speedbar-y-or-n-p (format "Kill buffer %s? " text))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3961 (kill-buffer text)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3962 (speedbar-refresh))))) |
22735 | 3963 |
3964 (defun speedbar-buffer-revert-buffer () | |
3965 "Revert the buffer the cursor is on in the speedbar buffer." | |
3966 (interactive) | |
3967 (save-excursion | |
3968 (beginning-of-line) | |
3969 ;; If this fails, then it is a non-standard click, and as such, | |
3970 ;; perfectly allowed | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
3971 (if (re-search-forward "[]>?}] [^ ]" |
22735 | 3972 (save-excursion (end-of-line) (point)) |
3973 t) | |
3974 (let ((text (progn | |
3975 (forward-char -1) | |
3976 (buffer-substring (point) (save-excursion | |
3977 (end-of-line) | |
3978 (point)))))) | |
3979 (if (get-buffer text) | |
3980 (progn | |
3981 (set-buffer text) | |
3982 (revert-buffer t))))))) | |
3983 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3984 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3985 ;;; Useful hook values and such. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3986 ;; |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3987 (defvar speedbar-highlight-one-tag-line nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3988 "Overlay used for highlighting the most recently jumped to tag line.") |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3989 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3990 (defun speedbar-highlight-one-tag-line () |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3991 "Highlight the current line, unhighlighting a previously jumped to line." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3992 (speedbar-unhighlight-one-tag-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3993 (setq speedbar-highlight-one-tag-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3994 (speedbar-make-overlay (save-excursion (beginning-of-line) (point)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3995 (save-excursion (end-of-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3996 (forward-char 1) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3997 (point)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3998 (speedbar-overlay-put speedbar-highlight-one-tag-line 'face |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3999 'speedbar-highlight-face) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4000 (add-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4001 ) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4002 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4003 (defun speedbar-unhighlight-one-tag-line () |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
4004 "Unhighlight the currently highlighted line." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4005 (if speedbar-highlight-one-tag-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4006 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4007 (speedbar-delete-overlay speedbar-highlight-one-tag-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4008 (setq speedbar-highlight-one-tag-line nil))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4009 (remove-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4010 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4011 (defun speedbar-recenter-to-top () |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4012 "Recenter the current buffer so POINT is on the top of the window." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4013 (recenter 1)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4014 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4015 (defun speedbar-recenter () |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4016 "Recenter the current buffer so POINT is in the center of the window." |
28925
89a795d90175
(speedbar-recenter): Typo, and fix logic.
Eric M. Ludlam <zappo@gnu.org>
parents:
28902
diff
changeset
|
4017 (recenter (/ (window-height (selected-window)) 2))) |
22735 | 4018 |
4019 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4020 ;;; Color loading section. |
21650 | 4021 ;; |
4022 (defface speedbar-button-face '((((class color) (background light)) | |
4023 (:foreground "green4")) | |
4024 (((class color) (background dark)) | |
4025 (:foreground "green3"))) | |
4026 "Face used for +/- buttons." | |
4027 :group 'speedbar-faces) | |
4028 | |
4029 (defface speedbar-file-face '((((class color) (background light)) | |
4030 (:foreground "cyan4")) | |
4031 (((class color) (background dark)) | |
4032 (:foreground "cyan")) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4033 (t (:bold t))) |
21650 | 4034 "Face used for file names." |
4035 :group 'speedbar-faces) | |
4036 | |
4037 (defface speedbar-directory-face '((((class color) (background light)) | |
4038 (:foreground "blue4")) | |
4039 (((class color) (background dark)) | |
4040 (:foreground "light blue"))) | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
4041 "Face used for directory names." |
21650 | 4042 :group 'speedbar-faces) |
4043 (defface speedbar-tag-face '((((class color) (background light)) | |
4044 (:foreground "brown")) | |
4045 (((class color) (background dark)) | |
4046 (:foreground "yellow"))) | |
4047 "Face used for displaying tags." | |
4048 :group 'speedbar-faces) | |
4049 | |
4050 (defface speedbar-selected-face '((((class color) (background light)) | |
4051 (:foreground "red" :underline t)) | |
4052 (((class color) (background dark)) | |
4053 (:foreground "red" :underline t)) | |
4054 (t (:underline t))) | |
4055 "Face used to underline the file in the active window." | |
4056 :group 'speedbar-faces) | |
4057 | |
4058 (defface speedbar-highlight-face '((((class color) (background light)) | |
4059 (:background "green")) | |
4060 (((class color) (background dark)) | |
4061 (:background "sea green")) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4062 (((class grayscale monochrome) |
21650 | 4063 (background light)) |
4064 (:background "black")) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4065 (((class grayscale monochrome) |
21650 | 4066 (background dark)) |
4067 (:background "white"))) | |
4068 "Face used for highlighting buttons with the mouse." | |
4069 :group 'speedbar-faces) | |
4070 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4071 (defface speedbar-separator-face '((((class color) (background light)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4072 (:background "blue" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4073 :foreground "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4074 :overline "gray")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4075 (((class color) (background dark)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4076 (:background "blue" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4077 :foreground "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4078 :overline "gray")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4079 (((class grayscale monochrome) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4080 (background light)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4081 (:background "black" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4082 :foreground "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4083 :overline "white")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4084 (((class grayscale monochrome) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4085 (background dark)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4086 (:background "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4087 :foreground "black" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4088 :overline "black"))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4089 "Face used for separator labes in a display." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4090 :group 'speedbar-faces) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4091 |
21650 | 4092 ;; some edebug hooks |
4093 (add-hook 'edebug-setup-hook | |
4094 (lambda () | |
4095 (def-edebug-spec speedbar-with-writable def-body))) | |
4096 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4097 ;; Fix a font lock problem for some versions of Emacs |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4098 (if (boundp 'font-lock-global-modes) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4099 (if (listp font-lock-global-modes) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4100 (add-to-list 'font-lock-global-modes '(not speedbar-mode)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4101 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4102 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4103 |
65809
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4104 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4105 ;;; Obsolete variables and functions |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4106 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4107 (define-obsolete-variable-alias |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4108 'speedbar-ignored-path-regexp 'speedbar-ignored-directory-regexp) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4109 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4110 (define-obsolete-variable-alias 'speedbar-ignored-path-expressions |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4111 'speedbar-ignored-directory-expressions) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4112 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4113 (define-obsolete-function-alias 'speedbar-add-ignored-path-regexp |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4114 'speedbar-add-ignored-directory-regexp) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4115 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4116 (define-obsolete-function-alias 'speedbar-line-path |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4117 'speedbar-line-directory) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4118 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4119 (define-obsolete-function-alias 'speedbar-buffers-line-path |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4120 'speedbar-buffers-line-directory) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4121 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4122 (define-obsolete-function-alias 'speedbar-path-line |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4123 'speedbar-directory-line) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4124 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4125 (define-obsolete-function-alias 'speedbar-buffers-line-path |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4126 'speedbar-buffers-line-directory) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4127 |
21650 | 4128 (provide 'speedbar) |
4129 | |
4130 ;; run load-time hooks | |
4131 (run-hooks 'speedbar-load-hook) | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
4132 |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
4133 ;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5 |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
4134 ;;; speedbar ends here |