Mercurial > emacs
annotate lisp/speedbar.el @ 103367:8fb6a5d3b48d
(compose-gstring-for-terminal): For zero-width
characters of Unicode category `Cf', simply replace it with SPC.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 10 Jun 2009 00:34:19 +0000 |
parents | 50624469b15a |
children | ea67ac46d172 |
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 |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
67227
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
100908 | 4 ;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
22735 | 5 |
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> | |
7 ;; Keywords: file, tags, tools | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
8 |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
9 (defvar speedbar-version "1.0" |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
10 "The current version of speedbar.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
11 (defvar speedbar-incompatible-version "0.14beta4" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
12 "This version of speedbar is incompatible with this version. |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
13 Due to massive API changes (removing the use of the word PATH) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
14 this version is not backward compatible to 0.14 or earlier.") |
22735 | 15 |
21650 | 16 ;; This file is part of GNU Emacs. |
22735 | 17 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94321
diff
changeset
|
18 ;; GNU Emacs is free software: you can redistribute it and/or modify |
21650 | 19 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94321
diff
changeset
|
20 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94321
diff
changeset
|
21 ;; (at your option) any later version. |
22735 | 22 |
21650 | 23 ;; GNU Emacs is distributed in the hope that it will be useful, |
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 ;; GNU General Public License for more details. | |
22735 | 27 |
21650 | 28 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94321
diff
changeset
|
29 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
21650 | 30 |
31 ;;; Commentary: | |
32 ;; | |
33 ;; 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
|
34 ;; 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
|
35 ;; to display that file location. |
21650 | 36 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
37 ;;; Customizing and Developing for speedbar |
21650 | 38 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
39 ;; Please see the speedbar manual for informaion. |
21650 | 40 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
41 ;;; Notes: |
21650 | 42 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
43 ;; 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
|
44 ;; 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
|
45 ;; 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
|
46 ;; 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
|
47 ;; refreshed. |
21650 | 48 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
49 ;; AUC-TEX users: The imenu tags for AUC-TEX mode don't work very |
21650 | 50 ;; well. Use the imenu keywords from tex-mode.el for better results. |
51 ;; | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
52 ;; 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
|
53 ;; 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
|
54 ;; 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
|
55 ;; http://www.dina.kvl.dk/~abraham/custom/ |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
56 ;; custom is available in all versions of Emacs version 20 or better. |
22735 | 57 ;; |
69197
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
58 ;;; Developing for speedbar |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
59 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
60 ;; Adding a speedbar specialized display mode: |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
61 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
62 ;; Speedbar can be configured to create a special display for certain |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
63 ;; modes that do not display traditional file/tag data. Rmail, Info, |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
64 ;; and the debugger are examples. These modes can, however, benefit |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
65 ;; from a speedbar style display in their own way. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
66 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
67 ;; If your `major-mode' is `foo-mode', the only requirement is to |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
68 ;; create a function called `foo-speedbar-buttons' which takes one |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
69 ;; argument, BUFFER. BUFFER will be the buffer speedbar wants filled. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
70 ;; In `foo-speedbar-buttons' there are several functions that make |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
71 ;; building a speedbar display easy. See the documentation for |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
72 ;; `speedbar-with-writable' (needed because the buffer is usually |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
73 ;; read-only) `speedbar-make-tag-line', `speedbar-insert-button', and |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
74 ;; `speedbar-insert-generic-list'. If you use |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
75 ;; `speedbar-insert-generic-list', also read the doc for |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
76 ;; `speedbar-tag-hierarchy-method' in case you wish to override it. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
77 ;; The macro `speedbar-with-attached-buffer' brings you back to the |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
78 ;; buffer speedbar is displaying for. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
79 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
80 ;; For those functions that make buttons, the "function" should be a |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
81 ;; symbol that is the function to call when clicked on. The "token" |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
82 ;; is extra data you can pass along. The "function" must take three |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
83 ;; parameters. They are (TEXT TOKEN INDENT). TEXT is the text of the |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
84 ;; button clicked on. TOKEN is the data passed in when you create the |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
85 ;; button. INDENT is an indentation level, or 0. You can store |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
86 ;; indentation levels with `speedbar-make-tag-line' which creates a |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
87 ;; line with an expander (eg. [+]) and a text button. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
88 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
89 ;; Some useful functions when writing expand functions, and click |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
90 ;; functions are `speedbar-change-expand-button-char', |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
91 ;; `speedbar-delete-subblock', and `speedbar-center-buffer-smartly'. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
92 ;; The variable `speedbar-power-click' is set to t in your functions |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
93 ;; when the user shift-clicks. This is an indication of anything from |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
94 ;; refreshing cached data to making a buffer appear in a new frame. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
95 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
96 ;; If you wish to add to the default speedbar menu for the case of |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
97 ;; `foo-mode', create a variable `foo-speedbar-menu-items'. This |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
98 ;; should be a list compatible with the `easymenu' package. It will |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
99 ;; be spliced into the main menu. (Available with click-mouse-3). If |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
100 ;; you wish to have extra key bindings in your special mode, create a |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
101 ;; variable `foo-speedbar-key-map'. Instead of using `make-keymap', |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
102 ;; or `make-sparse-keymap', use the function |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
103 ;; `speedbar-make-specialized-keymap'. This lets you inherit all of |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
104 ;; speedbar's default bindings with low overhead. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
105 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
106 ;; Adding a speedbar top-level display mode: |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
107 ;; |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
108 ;; Unlike the specialized modes, there are no name requirements, |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
109 ;; however the methods for writing a button display, menu, and keymap |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
110 ;; are the same. Once you create these items, you can call the |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
111 ;; function `speedbar-add-expansion-list'. It takes one parameter |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
112 ;; which is a list element of the form (NAME MENU KEYMAP &rest |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
113 ;; BUTTON-FUNCTIONS). NAME is a string that will show up in the |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
114 ;; Displays menu item. MENU is a symbol containing the menu items to |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
115 ;; splice in. KEYMAP is a symbol holding the keymap to use, and |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
116 ;; BUTTON-FUNCTIONS are the function names to call, in order, to create |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
117 ;; the display. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
118 ;; Another tweakable variable is `speedbar-stealthy-function-list' |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
119 ;; which is of the form (NAME &rest FUNCTION ...). NAME is the string |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
120 ;; name matching `speedbar-add-expansion-list'. (It does not need to |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
121 ;; exist.). This provides additional display info which might be |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
122 ;; time-consuming to calculate. |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
123 ;; Lastly, `speedbar-mode-functions-list' allows you to set special |
9f9cc4dd5f76
Re-instate comments about developing for speedbar
Nick Roberts <nickrob@snap.net.nz>
parents:
69021
diff
changeset
|
124 ;; function overrides. |
21650 | 125 |
126 ;;; TODO: | |
127 ;; - Timeout directories we haven't visited in a while. | |
128 | |
129 (require 'assoc) | |
130 (require 'easymenu) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
131 (require 'dframe) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
132 (require 'sb-image) |
22735 | 133 |
21650 | 134 ;; customization stuff |
135 (defgroup speedbar nil | |
136 "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
|
137 :group 'etags |
21658
d8a81542dbf9
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21650
diff
changeset
|
138 :group 'tools |
22250
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21658
diff
changeset
|
139 :group 'convenience |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
140 ; :version "20.3" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
141 ) |
21650 | 142 |
143 (defgroup speedbar-faces nil | |
144 "Faces used in speedbar." | |
145 :prefix "speedbar-" | |
146 :group 'speedbar | |
147 :group 'faces) | |
148 | |
149 (defgroup speedbar-vc nil | |
150 "Version control display in speedbar." | |
151 :prefix "speedbar-" | |
152 :group 'speedbar) | |
153 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
154 ;;; Code: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
155 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
156 ;; 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
|
157 ;; not included with Emacs. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
158 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
159 ;; (defun speedbar-require-version (major minor &optional beta) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
160 ;; "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
|
161 ;; Arguments can be: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
162 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
163 ;; (MAJOR MINOR &optional BETA) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
164 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
165 ;; 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
|
166 ;; excluded if a released version is required. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
167 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
168 ;; 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
|
169 ;; everything passes. Exceptions occur when known incompatibilities are |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
170 ;; introduced." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
171 ;; (inversion-test 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
172 ;; (concat major "." minor |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
173 ;; (when beta (concat "beta" beta))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
174 |
22735 | 175 (defvar speedbar-initial-expansion-mode-alist |
176 '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map | |
177 speedbar-buffer-buttons) | |
178 ("quick buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map | |
179 speedbar-buffer-buttons-temp) | |
180 ;; Files last, means first in the Displays menu | |
181 ("files" speedbar-easymenu-definition-special speedbar-file-key-map | |
182 speedbar-directory-buttons speedbar-default-directory-list) | |
183 ) | |
184 "List of named expansion elements for filling the speedbar frame. | |
185 These expansion lists are only valid for regular files. Special modes | |
186 still get to override this list on a mode-by-mode basis. This list of | |
187 lists is of the form (NAME MENU KEYMAP FN1 FN2 ...). NAME is a string | |
188 representing the types of things to be displayed. MENU is an easymenu | |
189 structure used when in this mode. KEYMAP is a local keymap to install | |
190 over the regular speedbar keymap. FN1 ... are functions that will be | |
191 called in order. These functions will always get the default | |
192 directory to use passed in as the first parameter, and a 0 as the | |
193 second parameter. The 0 indicates the uppermost indentation level. | |
194 They must assume that the cursor is at the position where they start | |
195 inserting buttons.") | |
21650 | 196 |
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
|
197 (defvar speedbar-initial-expansion-list-name "files" |
22735 | 198 "A symbol name representing the expansion list to use. |
199 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
|
200 the names and associated functions to use for buttons in speedbar.") |
22735 | 201 |
202 (defvar speedbar-previously-used-expansion-list-name "files" | |
203 "Save the last expansion list method. | |
204 This is used for returning to a previous expansion list method when | |
205 the user is done with the current expansion list.") | |
21650 | 206 |
207 (defvar speedbar-stealthy-function-list | |
22735 | 208 '(("files" |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
209 speedbar-update-current-file |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
210 speedbar-check-read-only |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
211 speedbar-check-vc |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
212 speedbar-check-objects) |
22735 | 213 ) |
21650 | 214 "List of functions to periodically call stealthily. |
22735 | 215 This list is of the form: |
216 '( (\"NAME\" FUNCTION ...) | |
217 ...) | |
218 where NAME is the name of the major display mode these functions are | |
219 for, and the remaining elements FUNCTION are functions to call in order. | |
21650 | 220 Each function must return nil if interrupted, or t if completed. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
221 Stealthy functions which have a single operation should always return t. |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
222 Functions which take a long time should maintain a state (where they |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
223 are in their speedbar related calculations) and permit interruption. |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
224 See `speedbar-check-vc' as a good example.") |
21650 | 225 |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
226 (defvar speedbar-mode-functions-list |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
227 '(("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
|
228 (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
|
229 ("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
|
230 (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
|
231 ("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
|
232 (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
|
233 ) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
234 "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
|
235 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
|
236 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
|
237 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
|
238 (\"NAME\" (FUNCTIONSYMBOL . REPLACEMENTFUNCTION) ...) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
239 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
|
240 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
|
241 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
|
242 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
|
243 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
|
244 functionality individually.") |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
245 |
21650 | 246 (defcustom speedbar-mode-specific-contents-flag t |
100171 | 247 "Non-nil means speedbar will show special mode contents. |
21650 | 248 This permits some modes to create customized contents for the speedbar |
249 frame." | |
250 :group 'speedbar | |
251 :type 'boolean) | |
252 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
253 (defcustom speedbar-query-confirmation-method 'all |
100171 | 254 "Query control for file operations. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
255 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
|
256 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
|
257 operations, except before a file deletion." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
258 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
259 :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
|
260 all) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
261 (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
|
262 none-but-delete) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
263 ;;;; (const :tag "Never Every Query." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
264 ;;;; none) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
265 )) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
266 |
21650 | 267 (defvar speedbar-special-mode-expansion-list nil |
22735 | 268 "Default function list for creating specialized button lists. |
269 This list is set by modes that wish to have special speedbar displays. | |
270 The list is of function names. Each function is called with one | |
271 parameter BUFFER, the originating buffer. The current buffer is the | |
272 speedbar buffer.") | |
21650 | 273 |
22735 | 274 (defvar speedbar-special-mode-key-map nil |
275 "Default keymap used when identifying a specialized display mode. | |
276 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
|
277 effective when its display is shown.") |
21650 | 278 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
279 (defcustom speedbar-before-visiting-file-hook '(push-mark) |
100171 | 280 "Hooks run before speedbar visits a file in the selected frame. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
281 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
|
282 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
283 :type 'hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
284 |
21650 | 285 (defcustom speedbar-visiting-file-hook nil |
100171 | 286 "Hooks run when speedbar visits a file in the selected frame." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
287 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
288 :type 'hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
289 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
290 (defcustom speedbar-before-visiting-tag-hook '(push-mark) |
100171 | 291 "Hooks run before speedbar visits a tag in the selected frame. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
292 The default buffer is the buffer in the selected window in the attached frame." |
21650 | 293 :group 'speedbar |
294 :type 'hook) | |
295 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
296 (defcustom speedbar-visiting-tag-hook '(speedbar-highlight-one-tag-line) |
100171 | 297 "Hooks run when speedbar visits a tag in the selected frame." |
21650 | 298 :group 'speedbar |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
299 :type 'hook |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
300 :options '(speedbar-highlight-one-tag-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
301 speedbar-recenter-to-top |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
302 speedbar-recenter |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
303 )) |
21650 | 304 |
305 (defcustom speedbar-load-hook nil | |
100171 | 306 "Hooks run when speedbar is loaded." |
21650 | 307 :group 'speedbar |
308 :type 'hook) | |
309 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
310 (defcustom speedbar-reconfigure-keymaps-hook nil |
100171 | 311 "Hooks run when the keymaps are regenerated." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
312 :group 'speedbar |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
313 :type 'hook) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
314 |
21650 | 315 (defcustom speedbar-show-unknown-files nil |
100171 | 316 "Non-nil show files we can't expand with a ? in the expand button. |
76017
f110ee6599bf
(speedbar-frame-mode, speedbar-frame-width, speedbar-show-unknown-files,
Juanma Barranquero <lekktu@gmail.com>
parents:
75484
diff
changeset
|
317 A nil value means don't show the file in the list." |
21650 | 318 :group 'speedbar |
319 :type 'boolean) | |
320 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
321 ;;; EVENTUALLY REMOVE THESE |
21650 | 322 |
94321 | 323 ;; When I moved to a repeating timer, I had the horrible misfortune |
324 ;; of losing the ability for adaptive speed choice. This update | |
22735 | 325 ;; speed currently causes long delays when it should have been turned off. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
326 (defvar speedbar-update-speed dframe-update-speed) |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
327 (make-obsolete-variable 'speedbar-update-speed |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
328 'dframe-update-speed |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
329 "speedbar 1.0pre3") |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
330 |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
331 (defvar speedbar-navigating-speed dframe-update-speed) |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
332 (make-obsolete-variable 'speedbar-navigating-speed |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
333 'dframe-update-speed |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
334 "speedbar 1.0pre3") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
335 ;;; END REMOVE THESE |
21650 | 336 |
337 (defcustom speedbar-frame-parameters '((minibuffer . nil) | |
338 (width . 20) | |
339 (border-width . 0) | |
340 (menu-bar-lines . 0) | |
36047
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
341 (tool-bar-lines . 0) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
342 (unsplittable . t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
343 (left-fringe . 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
344 ) |
100171 | 345 "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
|
346 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
|
347 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
|
348 attached to and added to this list before the new frame is initialized." |
21650 | 349 :group 'speedbar |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
350 :type '(repeat (cons :format "%v" |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
351 (symbol :tag "Parameter") |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
352 (sexp :tag "Value")))) |
21650 | 353 |
354 ;; These values by Hrvoje Niksic <hniksic@srce.hr> | |
355 (defcustom speedbar-frame-plist | |
356 '(minibuffer nil width 20 border-width 0 | |
357 internal-border-width 0 unsplittable t | |
358 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
|
359 menubar-visible-p nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
360 default-gutter-visible-p nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
361 ) |
100171 | 362 "Parameters to use when creating the speedbar frame in XEmacs. |
21650 | 363 Parameters not listed here which will be added automatically are |
364 `height' which will be initialized to the height of the frame speedbar | |
365 is attached to." | |
366 :group 'speedbar | |
367 :type '(repeat (group :inline t | |
368 (symbol :tag "Property") | |
369 (sexp :tag "Value")))) | |
370 | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
371 (defcustom speedbar-use-imenu-flag (fboundp 'imenu) |
100171 | 372 "Non-nil means use imenu for file parsing, nil to use etags. |
21650 | 373 XEmacs prior to 20.4 doesn't support imenu, therefore the default is to |
374 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
|
375 :tag "Use Imenu for tags" |
21650 | 376 :group 'speedbar |
377 :type 'boolean) | |
378 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
379 (defvar speedbar-dynamic-tags-function-list |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
380 '((speedbar-fetch-dynamic-imenu . speedbar-insert-imenu-list) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
381 (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
|
382 "Set to a list of functions which will return and insert a list of tags. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 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
|
387 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
|
388 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
|
389 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
|
390 |
94277
0d9b4dfd3f8b
(speedbar-use-tool-tips-flag): Check for tooltip-mode, rather than
Glenn Morris <rgm@gnu.org>
parents:
94033
diff
changeset
|
391 (defcustom speedbar-use-tool-tips-flag (fboundp 'tooltip-mode) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
392 "Non-nil means to use tool tips if they are available. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
393 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
|
394 display is used instead." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
395 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
396 :type 'boolean) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
397 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
398 (defcustom speedbar-track-mouse-flag (not speedbar-use-tool-tips-flag) |
100171 | 399 "Non-nil means to display info about the line under the mouse." |
22735 | 400 :group 'speedbar |
401 :type 'boolean) | |
402 | |
67227
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
403 (defcustom speedbar-default-position 'left-right |
100171 | 404 "Default position of the speedbar frame. |
67227
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
405 Possible values are 'left, 'right or 'left-right. |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
406 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
|
407 determined automatically." |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
408 :group 'speedbar |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
409 :type '(radio (const :tag "Automatic" left-right) |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
410 (const :tag "Left" left) |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
411 (const :tag "Right" right))) |
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
412 |
21650 | 413 (defcustom speedbar-sort-tags nil |
100171 | 414 "If non-nil, sort tags in the speedbar display. *Obsolete*. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
415 Use `semantic-tag-hierarchy-method' instead." |
21650 | 416 :group 'speedbar |
417 :type 'boolean) | |
418 | |
22735 | 419 (defcustom speedbar-tag-hierarchy-method |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
420 '(speedbar-prefix-group-tag-hierarchy |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
421 speedbar-trim-words-tag-hierarchy) |
100171 | 422 "List of hooks which speedbar will use to organize tags into groups. |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
423 Groups are defined as expandable meta-tags. Imenu supports |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 form: |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
428 (ELT1 ELT2 ... ELTn) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
429 where each ELT is of the form |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
430 (TAG-NAME-STRING . NUMBER-OR-MARKER) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
431 or |
46286
6117ca314143
(speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents:
46282
diff
changeset
|
432 (GROUP-NAME-STRING ELT1 ELT2... ELTn)" |
22735 | 433 :group 'speedbar |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
434 :type 'hook |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
435 :options '(speedbar-prefix-group-tag-hierarchy |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
436 speedbar-trim-words-tag-hierarchy |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
437 speedbar-simple-group-tag-hierarchy |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
438 speedbar-sort-tag-hierarchy) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
439 ) |
22735 | 440 |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
441 (defcustom speedbar-tag-group-name-minimum-length 4 |
100171 | 442 "The minimum length of a prefix group name before expanding. |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
443 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
|
444 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
|
445 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
|
446 worda to wordb |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
447 instead of just |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
448 word |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
449 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
|
450 :group 'speedbar |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
451 :type 'integer) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
452 |
22735 | 453 (defcustom speedbar-tag-split-minimum-length 20 |
100171 | 454 "Minimum length before we stop trying to create sub-lists in tags. |
22735 | 455 This is used by all tag-hierarchy methods that break large lists into |
456 sub-lists." | |
457 :group 'speedbar | |
458 :type 'integer) | |
459 | |
460 (defcustom speedbar-tag-regroup-maximum-length 10 | |
100171 | 461 "Maximum length of submenus that are regrouped. |
22735 | 462 If the regrouping option is used, then if two or more short subgroups |
463 are next to each other, then they are combined until this number of | |
464 items is reached." | |
465 :group 'speedbar | |
466 :type 'integer) | |
467 | |
21650 | 468 (defcustom speedbar-directory-button-trim-method 'span |
100171 | 469 "Indicates how the directory button will be displayed. |
21650 | 470 Possible values are: |
471 'span - span large directories over multiple lines. | |
472 'trim - trim large directories to only show the last few. | |
473 nil - no trimming." | |
474 :group 'speedbar | |
475 :type '(radio (const :tag "Span large directories over mutiple lines." | |
476 span) | |
477 (const :tag "Trim large directories to only show the last few." | |
478 trim) | |
479 (const :tag "No trimming." nil))) | |
480 | |
481 (defcustom speedbar-smart-directory-expand-flag t | |
100171 | 482 "Non-nil means speedbar should use smart expansion. |
21650 | 483 Smart expansion only affects when speedbar wants to display a |
484 directory for a file in the attached frame. When smart expansion is | |
485 enabled, new directories which are children of a displayed directory | |
486 are expanded in the current framework. If nil, then the current | |
487 hierarchy would be replaced with the new directory." | |
488 :group 'speedbar | |
489 :type 'boolean) | |
490 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
491 (defcustom speedbar-indentation-width 1 |
100171 | 492 "When sub-nodes are expanded, the number of spaces used for indentation." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
493 :group 'speedbar |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
494 :type 'integer) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
495 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
496 (defcustom speedbar-hide-button-brackets-flag nil |
100171 | 497 "Non-nil means speedbar will hide the brackets around the + or -." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
498 :group 'speedbar |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
499 :type 'boolean) |
22735 | 500 |
21650 | 501 (defcustom speedbar-before-popup-hook nil |
100171 | 502 "Hooks called before popping up the speedbar frame." |
21650 | 503 :group 'speedbar |
504 :type 'hook) | |
505 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
506 (defcustom speedbar-after-create-hook '(speedbar-frame-reposition-smartly) |
100171 | 507 "Hooks called after popping up the speedbar frame." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
508 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
509 :type 'hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
510 |
21650 | 511 (defcustom speedbar-before-delete-hook nil |
100171 | 512 "Hooks called before deleting the speedbar frame." |
21650 | 513 :group 'speedbar |
514 :type 'hook) | |
515 | |
516 (defcustom speedbar-mode-hook nil | |
100171 | 517 "Hooks called after creating a speedbar buffer." |
21650 | 518 :group 'speedbar |
519 :type 'hook) | |
520 | |
521 (defcustom speedbar-timer-hook nil | |
100171 | 522 "Hooks called after running the speedbar timer function." |
21650 | 523 :group 'speedbar |
524 :type 'hook) | |
525 | |
526 (defcustom speedbar-verbosity-level 1 | |
100171 | 527 "Verbosity level of the speedbar. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
528 0 means say nothing. |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
529 1 means medium level verbosity. |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
530 2 and higher are higher levels of verbosity." |
21650 | 531 :group 'speedbar |
532 :type 'integer) | |
533 | |
22735 | 534 (defvar speedbar-indicator-separator " " |
535 "String separating file text from indicator characters.") | |
536 | |
21650 | 537 (defcustom speedbar-vc-do-check t |
100171 | 538 "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
|
539 Any file checked out is marked with `speedbar-vc-indicator'." |
21650 | 540 :group 'speedbar-vc |
541 :type 'boolean) | |
542 | |
22735 | 543 (defvar speedbar-vc-indicator "*" |
21650 | 544 "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
|
545 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
|
546 `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
|
547 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
548 (defcustom speedbar-vc-directory-enable-hook nil |
100171 | 549 "Return non-nil if the current directory should be checked for Version Control. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
550 Functions in this hook must accept one parameter which is the directory |
21650 | 551 being checked." |
552 :group 'speedbar-vc | |
553 :type 'hook) | |
554 | |
555 (defcustom speedbar-vc-in-control-hook nil | |
100171 | 556 "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
|
557 Functions in this hook must accept two parameters. The DIRECTORY of the |
21650 | 558 current file, and the FILENAME of the file being checked." |
559 :group 'speedbar-vc | |
560 :type 'hook) | |
561 | |
562 (defvar speedbar-vc-to-do-point nil | |
563 "Local variable maintaining the current version control check position.") | |
564 | |
22735 | 565 (defcustom speedbar-obj-do-check t |
100171 | 566 "Non-nil check all files in speedbar to see if they have an object file. |
22735 | 567 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
|
568 marking is based on `speedbar-obj-alist'" |
22735 | 569 :group 'speedbar-vc |
570 :type 'boolean) | |
571 | |
572 (defvar speedbar-obj-to-do-point nil | |
573 "Local variable maintaining the current version control check position.") | |
574 | |
575 (defvar speedbar-obj-indicator '("#" . "!") | |
576 "Text used to mark files that have a corresponding hidden object file. | |
577 The car is for an up-to-date object. The cdr is for an out of date object. | |
578 The expression `speedbar-obj-alist' defines who gets tagged.") | |
579 | |
580 (defvar speedbar-obj-alist | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
581 '(("\\.\\([cpC]\\|cpp\\|cc\\|cxx\\)$" . ".o") |
22735 | 582 ("\\.el$" . ".elc") |
583 ("\\.java$" . ".class") | |
584 ("\\.f\\(or\\|90\\|77\\)?$" . ".o") | |
585 ("\\.tex$" . ".dvi") | |
586 ("\\.texi$" . ".info")) | |
587 "Alist of file extensions, and their corresponding object file type.") | |
588 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
589 (defvar speedbar-ro-to-do-point nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
590 "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
|
591 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
592 (defvar speedbar-object-read-only-indicator "%" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
593 "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
|
594 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
595 ;; 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
|
596 ;; use skip-chars instead of a regular expression. |
22735 | 597 (defvar speedbar-indicator-regex |
598 (concat (regexp-quote speedbar-indicator-separator) | |
599 "\\(" | |
600 (regexp-quote speedbar-vc-indicator) | |
601 "\\|" | |
602 (regexp-quote (car speedbar-obj-indicator)) | |
603 "\\|" | |
604 (regexp-quote (cdr speedbar-obj-indicator)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
605 "\\|" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
606 (regexp-quote speedbar-object-read-only-indicator) |
22735 | 607 "\\)*") |
608 "Regular expression used when identifying files. | |
609 Permits stripping of indicator characters from a line.") | |
610 | |
611 (defcustom speedbar-scanner-reset-hook nil | |
100171 | 612 "Hook called whenever generic scanners are reset. |
22735 | 613 Set this to implement your own scanning / rescan safe functions with |
614 state data." | |
615 :group 'speedbar | |
616 :type 'hook) | |
617 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
618 (defvar speedbar-ignored-modes '(fundamental-mode) |
21650 | 619 "*List of major modes which speedbar will not switch directories for.") |
620 | |
621 (defun speedbar-extension-list-to-regex (extlist) | |
622 "Takes EXTLIST, a list of extensions and transforms it into regexp. | |
22735 | 623 All the preceding `.' are stripped for an optimized expression starting |
624 with `.' followed by extensions, followed by full-filenames." | |
21650 | 625 (let ((regex1 nil) (regex2 nil)) |
626 (while extlist | |
627 (if (= (string-to-char (car extlist)) ?.) | |
628 (setq regex1 (concat regex1 (if regex1 "\\|" "") | |
629 (substring (car extlist) 1))) | |
630 (setq regex2 (concat regex2 (if regex2 "\\|" "") (car extlist)))) | |
631 (setq extlist (cdr extlist))) | |
632 ;; concat all the sub-exressions together, making sure all types | |
633 ;; of parts exist during concatination. | |
634 (concat "\\(" | |
635 (if regex1 (concat "\\(\\.\\(" regex1 "\\)\\)") "") | |
636 (if (and regex1 regex2) "\\|" "") | |
637 (if regex2 (concat "\\(" regex2 "\\)") "") | |
638 "\\)$"))) | |
639 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
640 (defvar speedbar-ignored-directory-regexp nil |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
641 "Regular expression matching directories speedbar will not switch to. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
642 Created from `speedbar-ignored-directory-expressions' with the function |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
643 `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
|
644 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
|
645 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
|
646 |
94033
03995f64a613
Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
647 (define-obsolete-variable-alias 'speedbar-ignored-path-expressions |
03995f64a613
Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
648 'speedbar-ignored-directory-expressions) |
03995f64a613
Move non-autoloaded define-obsolete-variable-alias calls for
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
649 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
650 (defcustom speedbar-ignored-directory-expressions |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
651 '("[/\\]logs?[/\\]\\'") |
100171 | 652 "List of regular expressions matching directories speedbar will ignore. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
653 They should included directories which are notoriously very large |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
654 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
|
655 `speedbar-add-ignored-directory-regexp' to add new items to this list after |
21650 | 656 speedbar is loaded. You may place anything you like in this list |
657 before speedbar has been loaded." | |
658 :group 'speedbar | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
659 :type '(repeat (regexp :tag "Directory Regexp")) |
21650 | 660 :set (lambda (sym val) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
661 (setq speedbar-ignored-directory-expressions val |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
662 speedbar-ignored-directory-regexp |
21650 | 663 (speedbar-extension-list-to-regex val)))) |
664 | |
87446
168445c0b213
* vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
78705
diff
changeset
|
665 (defcustom speedbar-directory-unshown-regexp "^\\(\\..*\\)\\'" |
100171 | 666 "Regular expression matching directories not to show in speedbar. |
22735 | 667 They should include commonly existing directories which are not |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
668 useful. It is no longer necessary to include version-control |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
669 directories here; see `vc-directory-exclusion-list'." |
22735 | 670 :group 'speedbar |
671 :type 'string) | |
672 | |
21650 | 673 (defvar speedbar-file-unshown-regexp |
674 (let ((nstr "") (noext completion-ignored-extensions)) | |
675 (while noext | |
676 (setq nstr (concat nstr (regexp-quote (car noext)) "\\'" | |
677 (if (cdr noext) "\\|" "")) | |
678 noext (cdr noext))) | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
679 ;; backup refdir lockfile |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
680 (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#")) |
21650 | 681 "*Regexp matching files we don't want displayed in a speedbar buffer. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
682 It is generated from the variable `completion-ignored-extensions'.") |
21650 | 683 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
684 (defvar speedbar-file-regexp nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
685 "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
|
686 Created from `speedbar-supported-extension-expressions' with the |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
687 function `speedbar-extension-list-to-regex'.") |
56762
85c0c238dbbf
(speedbar-file-regexp): Definition moved up.
Richard M. Stallman <rms@gnu.org>
parents:
56754
diff
changeset
|
688 |
21650 | 689 ;; this is dangerous to customize, because the defaults will probably |
690 ;; change in the future. | |
691 (defcustom speedbar-supported-extension-expressions | |
22735 | 692 (append '(".[ch]\\(\\+\\+\\|pp\\|c\\|h\\|xx\\)?" ".tex\\(i\\(nfo\\)?\\)?" |
693 ".el" ".emacs" ".l" ".lsp" ".p" ".java" ".f\\(90\\|77\\|or\\)?") | |
21650 | 694 (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
|
695 '(".ada" ".p[lm]" ".tcl" ".m" ".scm" ".pm" ".py" ".g" |
22735 | 696 ;; html is not supported by default, but an imenu tags package |
697 ;; is available. Also, html files are nice to be able to see. | |
698 ".s?html" | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
699 ".ma?k" "[Mm]akefile\\(\\.in\\)?"))) |
100171 | 700 "List of regular expressions which will match files supported by tagging. |
21650 | 701 Do not prefix the `.' char with a double \\ to quote it, as the period |
702 will be stripped by a simplified optimizer when compiled into a | |
703 singular expression. This variable will be turned into | |
704 `speedbar-file-regexp' for use with speedbar. You should use the | |
705 function `speedbar-add-supported-extension' to add a new extension at | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
706 runtime, or use the configuration dialog to set it in your .emacs file. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
707 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
|
708 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
|
709 file completion." |
21650 | 710 :group 'speedbar |
711 :type '(repeat (regexp :tag "Extension Regexp")) | |
712 :set (lambda (sym val) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
713 (set 'speedbar-supported-extension-expressions val) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
714 (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
|
715 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
716 (setq speedbar-file-regexp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
717 (speedbar-extension-list-to-regex speedbar-supported-extension-expressions)) |
21650 | 718 |
719 (defun speedbar-add-supported-extension (extension) | |
720 "Add EXTENSION as a new supported extension for speedbar tagging. | |
721 This should start with a `.' if it is not a complete file name, and | |
722 the dot should NOT be quoted in with \\. Other regular expression | |
723 matchers are allowed however. EXTENSION may be a single string or a | |
724 list of strings." | |
44578
9c2b72b4b303
(speedbar-generic-item-info)
Pavel Janík <Pavel@Janik.cz>
parents:
44225
diff
changeset
|
725 (interactive "sExtension: ") |
21650 | 726 (if (not (listp extension)) (setq extension (list extension))) |
727 (while extension | |
728 (if (member (car extension) speedbar-supported-extension-expressions) | |
729 nil | |
730 (setq speedbar-supported-extension-expressions | |
731 (cons (car extension) speedbar-supported-extension-expressions))) | |
732 (setq extension (cdr extension))) | |
733 (setq speedbar-file-regexp (speedbar-extension-list-to-regex | |
734 speedbar-supported-extension-expressions))) | |
735 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
736 (defun speedbar-add-ignored-directory-regexp (directory-expression) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
737 "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
|
738 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
|
739 DIRECTORY-EXPRESSION to `speedbar-ignored-directory-expressions'." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
740 (interactive "sDirectory regex: ") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
741 (if (not (listp directory-expression)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
742 (setq directory-expression (list directory-expression))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
743 (while directory-expression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
744 (if (member (car directory-expression) speedbar-ignored-directory-expressions) |
21650 | 745 nil |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
746 (setq speedbar-ignored-directory-expressions |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
747 (cons (car directory-expression) speedbar-ignored-directory-expressions))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
748 (setq directory-expression (cdr directory-expression))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
749 (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
|
750 speedbar-ignored-directory-expressions))) |
21650 | 751 |
752 ;; If we don't have custom, then we set it here by hand. | |
753 (if (not (fboundp 'custom-declare-variable)) | |
754 (setq speedbar-file-regexp (speedbar-extension-list-to-regex | |
755 speedbar-supported-extension-expressions) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
756 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
|
757 speedbar-ignored-directory-expressions))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
758 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
759 (defvar speedbar-update-flag dframe-have-timer-flag |
21650 | 760 "*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
|
761 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
|
762 When speedbar is active, use: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
763 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
764 \\<speedbar-key-map> `\\[speedbar-toggle-updates]' |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
765 |
21650 | 766 to toggle this value.") |
767 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
768 (defvar speedbar-update-flag-disable nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
769 "Permanently disable changing of the update flag.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
770 |
21650 | 771 (defvar speedbar-syntax-table nil |
772 "Syntax-table used on the speedbar.") | |
773 | |
774 (if speedbar-syntax-table | |
775 nil | |
776 (setq speedbar-syntax-table (make-syntax-table)) | |
777 ;; turn off paren matching around here. | |
778 (modify-syntax-entry ?\' " " speedbar-syntax-table) | |
779 (modify-syntax-entry ?\" " " speedbar-syntax-table) | |
780 (modify-syntax-entry ?( " " speedbar-syntax-table) | |
781 (modify-syntax-entry ?) " " speedbar-syntax-table) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
782 (modify-syntax-entry ?{ " " speedbar-syntax-table) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
783 (modify-syntax-entry ?} " " speedbar-syntax-table) |
21650 | 784 (modify-syntax-entry ?[ " " speedbar-syntax-table) |
785 (modify-syntax-entry ?] " " speedbar-syntax-table)) | |
786 | |
787 (defvar speedbar-key-map nil | |
788 "Keymap used in speedbar buffer.") | |
789 | |
790 (if speedbar-key-map | |
791 nil | |
792 (setq speedbar-key-map (make-keymap)) | |
793 (suppress-keymap speedbar-key-map t) | |
794 | |
795 ;; control | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
796 (define-key speedbar-key-map "t" 'speedbar-toggle-updates) |
21650 | 797 (define-key speedbar-key-map "g" 'speedbar-refresh) |
798 | |
799 ;; navigation | |
800 (define-key speedbar-key-map "n" 'speedbar-next) | |
801 (define-key speedbar-key-map "p" 'speedbar-prev) | |
22735 | 802 (define-key speedbar-key-map "\M-n" 'speedbar-restricted-next) |
803 (define-key speedbar-key-map "\M-p" 'speedbar-restricted-prev) | |
804 (define-key speedbar-key-map "\C-\M-n" 'speedbar-forward-list) | |
805 (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
|
806 ;; These commands never seemed useful. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
807 ;; (define-key speedbar-key-map " " 'speedbar-scroll-up) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
808 ;; (define-key speedbar-key-map [delete] 'speedbar-scroll-down) |
21650 | 809 |
22735 | 810 ;; Short cuts I happen to find useful |
811 (define-key speedbar-key-map "r" | |
812 (lambda () (interactive) | |
813 (speedbar-change-initial-expansion-list | |
814 speedbar-previously-used-expansion-list-name))) | |
815 (define-key speedbar-key-map "b" | |
816 (lambda () (interactive) | |
817 (speedbar-change-initial-expansion-list "quick buffers"))) | |
818 (define-key speedbar-key-map "f" | |
819 (lambda () (interactive) | |
820 (speedbar-change-initial-expansion-list "files"))) | |
821 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
822 (dframe-update-keymap speedbar-key-map) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
823 ) |
22735 | 824 |
825 (defun speedbar-make-specialized-keymap () | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
826 "Create a keymap for use with a speedbar major or minor display mode. |
75484
f1fe767eedcb
(speedbar-make-specialized-keymap): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
827 This basically creates a sparse keymap, and makes its parent be |
22735 | 828 `speedbar-key-map'." |
829 (let ((k (make-sparse-keymap))) | |
830 (set-keymap-parent k speedbar-key-map) | |
831 k)) | |
832 | |
833 (defvar speedbar-file-key-map nil | |
834 "Keymap used in speedbar buffer while files are displayed.") | |
835 | |
836 (if speedbar-file-key-map | |
837 nil | |
838 (setq speedbar-file-key-map (speedbar-make-specialized-keymap)) | |
839 | |
840 ;; Basic tree features | |
841 (define-key speedbar-file-key-map "e" 'speedbar-edit-line) | |
842 (define-key speedbar-file-key-map "\C-m" 'speedbar-edit-line) | |
843 (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
|
844 (define-key speedbar-file-key-map "=" 'speedbar-expand-line) |
22735 | 845 (define-key speedbar-file-key-map "-" 'speedbar-contract-line) |
846 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
847 (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
|
848 (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
|
849 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
850 (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
|
851 |
22735 | 852 ;; file based commands |
853 (define-key speedbar-file-key-map "U" 'speedbar-up-directory) | |
854 (define-key speedbar-file-key-map "I" 'speedbar-item-info) | |
855 (define-key speedbar-file-key-map "B" 'speedbar-item-byte-compile) | |
856 (define-key speedbar-file-key-map "L" 'speedbar-item-load) | |
857 (define-key speedbar-file-key-map "C" 'speedbar-item-copy) | |
858 (define-key speedbar-file-key-map "D" 'speedbar-item-delete) | |
859 (define-key speedbar-file-key-map "O" 'speedbar-item-object-delete) | |
860 (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
|
861 (define-key speedbar-file-key-map "M" 'speedbar-create-directory) |
22735 | 862 ) |
21650 | 863 |
864 (defvar speedbar-easymenu-definition-base | |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
865 (append |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
866 '("Speedbar" |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
867 ["Update" speedbar-refresh t] |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
868 ["Auto Update" speedbar-toggle-updates |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
869 :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
|
870 :style toggle :selected speedbar-update-flag]) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
871 (if (and (or (fboundp 'defimage) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
872 (fboundp 'make-image-specifier)) |
29260
7f1b3013a136
(speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents:
29130
diff
changeset
|
873 (if (fboundp 'display-graphic-p) |
7f1b3013a136
(speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents:
29130
diff
changeset
|
874 (display-graphic-p) |
7f1b3013a136
(speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents:
29130
diff
changeset
|
875 window-system)) |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
876 (list |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
877 ["Use Images" speedbar-toggle-images |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
878 :style toggle :selected speedbar-use-images])) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
879 ) |
21650 | 880 "Base part of the speedbar menu.") |
881 | |
882 (defvar speedbar-easymenu-definition-special | |
883 '(["Edit Item On Line" speedbar-edit-line t] | |
884 ["Show All Files" speedbar-toggle-show-all-files | |
885 :style toggle :selected speedbar-show-unknown-files] | |
22735 | 886 ["Expand File Tags" speedbar-expand-line |
21650 | 887 (save-excursion (beginning-of-line) |
888 (looking-at "[0-9]+: *.\\+. "))] | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
889 ["Flush Cache & Expand" speedbar-flush-expand-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
890 (save-excursion (beginning-of-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
891 (looking-at "[0-9]+: *.\\+. "))] |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
892 ["Expand All Descendants" speedbar-expand-line-descendants |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
893 (save-excursion (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
894 (looking-at "[0-9]+: *.\\+. ")) ] |
22735 | 895 ["Contract File Tags" speedbar-contract-line |
21650 | 896 (save-excursion (beginning-of-line) |
897 (looking-at "[0-9]+: *.-. "))] | |
22735 | 898 ; ["Sort Tags" speedbar-toggle-sorting |
899 ; :style toggle :selected speedbar-sort-tags] | |
21650 | 900 "----" |
22735 | 901 ["File/Tag Information" speedbar-item-info t] |
21650 | 902 ["Load Lisp File" speedbar-item-load |
903 (save-excursion | |
904 (beginning-of-line) | |
22735 | 905 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\|$\\)"))] |
21650 | 906 ["Byte Compile File" speedbar-item-byte-compile |
907 (save-excursion | |
908 (beginning-of-line) | |
22735 | 909 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\|$\\)"))] |
910 ["Copy File" speedbar-item-copy | |
21650 | 911 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *\\["))] |
22735 | 912 ["Rename File" speedbar-item-rename |
913 (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
|
914 ["Create Directory" speedbar-create-directory |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
915 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] |
22735 | 916 ["Delete File" speedbar-item-delete |
21650 | 917 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] |
22735 | 918 ["Delete Object" speedbar-item-object-delete |
919 (save-excursion (beginning-of-line) | |
920 (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))] | |
921 ) | |
21650 | 922 "Additional menu items while in file-mode.") |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
923 |
21650 | 924 (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
|
925 (append |
22735 | 926 (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
|
927 (list ["Customize..." speedbar-customize t])) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
928 (list |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
929 ["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
|
930 ["Quit" delete-frame t] )) |
21650 | 931 "Menu items appearing at the end of the speedbar menu.") |
932 | |
933 (defvar speedbar-desired-buffer nil | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
934 "Non-nil when speedbar is showing buttons specific to a special mode. |
21650 | 935 In this case it is the originating buffer.") |
936 (defvar speedbar-buffer nil | |
937 "The buffer displaying the speedbar.") | |
938 (defvar speedbar-frame nil | |
939 "The frame displaying speedbar.") | |
940 (defvar speedbar-cached-frame nil | |
941 "The frame that was last created, then removed from the display.") | |
942 (defvar speedbar-full-text-cache nil | |
943 "The last open directory is saved in its entirety for ultra-fast switching.") | |
944 | |
945 (defvar speedbar-last-selected-file nil | |
946 "The last file which was selected in speedbar buffer.") | |
947 | |
948 (defvar speedbar-shown-directories nil | |
949 "Maintain list of directories simultaneously open in the current speedbar.") | |
950 | |
951 (defvar speedbar-directory-contents-alist nil | |
952 "An association list of directories and their contents. | |
953 Each sublist was returned by `speedbar-file-lists'. This list is | |
954 maintained to speed up the refresh rate when switching between | |
955 directories.") | |
956 | |
957 (defvar speedbar-power-click nil | |
958 "Never set this by hand. Value is t when S-mouse activity occurs.") | |
959 | |
960 | |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
961 ;;; Compatibility |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
962 ;; |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
963 (defalias 'speedbar-make-overlay |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
964 (if (featurep 'xemacs) 'make-extent 'make-overlay)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
965 |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
966 (defalias 'speedbar-overlay-put |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
967 (if (featurep 'xemacs) 'set-extent-property 'overlay-put)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
968 |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
969 (defalias 'speedbar-delete-overlay |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
970 (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
971 |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
972 (defalias 'speedbar-mode-line-update |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
973 (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
|
974 |
21650 | 975 ;;; Mode definitions/ user commands |
976 ;; | |
977 | |
978 ;;;###autoload | |
979 (defalias 'speedbar 'speedbar-frame-mode) | |
980 ;;;###autoload | |
981 (defun speedbar-frame-mode (&optional arg) | |
982 "Enable or disable speedbar. Positive ARG means turn on, negative turn off. | |
76017
f110ee6599bf
(speedbar-frame-mode, speedbar-frame-width, speedbar-show-unknown-files,
Juanma Barranquero <lekktu@gmail.com>
parents:
75484
diff
changeset
|
983 A nil ARG means toggle. Once the speedbar frame is activated, a buffer in |
21650 | 984 `speedbar-mode' will be displayed. Currently, only one speedbar is |
985 supported at a time. | |
986 `speedbar-before-popup-hook' is called before popping up the speedbar frame. | |
987 `speedbar-before-delete-hook' is called before the frame is deleted." | |
988 (interactive "P") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
989 ;; Get the buffer to play with |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
990 (if (not (buffer-live-p speedbar-buffer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
991 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
992 (setq speedbar-buffer (get-buffer-create " SPEEDBAR")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
993 (set-buffer speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
994 (speedbar-mode))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
995 ;; Do the frame thing |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
996 (dframe-frame-mode arg |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
997 'speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
998 'speedbar-cached-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
999 'speedbar-buffer |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1000 "Speedbar" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1001 #'speedbar-frame-mode |
78705
105d3bc0aae5
(speedbar-frame-reposition-smartly)
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
1002 (if (featurep 'xemacs) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1003 (append speedbar-frame-plist |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1004 ;; 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
|
1005 ;; with the selected frame. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1006 (list 'parent (selected-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1007 speedbar-frame-parameters) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1008 speedbar-before-delete-hook |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1009 speedbar-before-popup-hook |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1010 speedbar-after-create-hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1011 ;; Start up the timer |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1012 (if (not speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1013 (speedbar-set-timer nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1014 (speedbar-reconfigure-keymaps) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1015 (speedbar-update-contents) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1016 (speedbar-set-timer dframe-update-speed) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1017 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1018 ;; Frame modifications |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1019 (set (make-local-variable 'dframe-delete-frame-function) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1020 'speedbar-handle-delete-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1021 ;; hscroll |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1022 (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
|
1023 ;; reset the selection variable |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1024 (setq speedbar-last-selected-file nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1025 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1026 (defun speedbar-frame-reposition-smartly () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1027 "Reposition the speedbar frame to be next to the attached frame." |
78705
105d3bc0aae5
(speedbar-frame-reposition-smartly)
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
1028 (cond ((and (featurep 'xemacs) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1029 (or (member 'left speedbar-frame-plist) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1030 (member 'top speedbar-frame-plist))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1031 (dframe-reposition-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1032 speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1033 (dframe-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1034 (cons (car (cdr (member 'left speedbar-frame-plist))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1035 (car (cdr (member 'top speedbar-frame-plist))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1036 ) |
78705
105d3bc0aae5
(speedbar-frame-reposition-smartly)
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
1037 ((and (not (featurep 'xemacs)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1038 (or (assoc 'left speedbar-frame-parameters) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1039 (assoc 'top speedbar-frame-parameters))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1040 ;; 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
|
1041 ;; down to the reposition function |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1042 (dframe-reposition-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1043 speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1044 (dframe-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1045 (cons (cdr (assoc 'left speedbar-frame-parameters)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1046 (cdr (assoc 'top speedbar-frame-parameters)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1047 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1048 (t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1049 (dframe-reposition-frame speedbar-frame |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1050 (dframe-attached-frame speedbar-frame) |
67227
d02e0d3b5db9
(speedbar-default-position): New defcustom.
Romain Francoise <romain@orebokech.com>
parents:
66163
diff
changeset
|
1051 speedbar-default-position)))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1052 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1053 (defsubst speedbar-current-frame () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1054 "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
|
1055 (dframe-current-frame 'speedbar-frame 'speedbar-mode)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1056 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1057 (defun speedbar-handle-delete-frame (e) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1058 "Handle a delete frame event E. |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1059 If the deleted frame is the frame speedbar is attached to, |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1060 we need to delete speedbar also." |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
1061 (when (and speedbar-frame |
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
1062 (eq (car (car (cdr e))) ;; frame to be deleted |
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
1063 dframe-attached-frame)) |
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
1064 (delete-frame speedbar-frame))) |
21650 | 1065 |
1066 ;;;###autoload | |
1067 (defun speedbar-get-focus () | |
1068 "Change frame focus to or from the speedbar frame. | |
1069 If the selected frame is not speedbar, then speedbar frame is | |
1070 selected. If the speedbar frame is active, then select the attached frame." | |
1071 (interactive) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1072 (speedbar-reset-scanners) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1073 (dframe-get-focus 'speedbar-frame 'speedbar-frame-mode |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1074 (lambda () (let ((speedbar-update-flag t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1075 (speedbar-timer-fn))))) |
22735 | 1076 |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
1077 (defsubst speedbar-frame-width () |
21650 | 1078 "Return the width of the speedbar frame in characters. |
76017
f110ee6599bf
(speedbar-frame-mode, speedbar-frame-width, speedbar-show-unknown-files,
Juanma Barranquero <lekktu@gmail.com>
parents:
75484
diff
changeset
|
1079 Return nil if it doesn't exist." |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
1080 (frame-width speedbar-frame)) |
21650 | 1081 |
1082 (defun speedbar-mode () | |
1083 "Major mode for managing a display of directories and tags. | |
1084 \\<speedbar-key-map> | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1085 The first line represents the default directory of the speedbar frame. |
21650 | 1086 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
|
1087 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
|
1088 In some situations using `\\[dframe-power-click]' is a `power click' which will |
21650 | 1089 rescan cached items, or pop up new frames. |
1090 | |
1091 Each line starting with <+> represents a directory. Click on the <+> | |
1092 to insert the directory listing into the current tree. Click on the | |
1093 <-> to retract that list. Click on the directory name to go to that | |
1094 directory as the default. | |
1095 | |
1096 Each line starting with [+] is a file. If the variable | |
1097 `speedbar-show-unknown-files' is t, the lines starting with [?] are | |
1098 files which don't have imenu support, but are not expressly ignored. | |
1099 Files are completely ignored if they match `speedbar-file-unshown-regexp' | |
1100 which is generated from `completion-ignored-extensions'. | |
1101 | |
1102 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
|
1103 version control system. (Currently only RCS is supported.) New |
21650 | 1104 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
|
1105 for `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p'. |
21650 | 1106 |
22735 | 1107 Files with a `#' or `!' character after them are source files that |
1108 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
|
1109 files is out of date. You can control what source/object associations |
22735 | 1110 exist through the variable `speedbar-obj-alist'. |
1111 | |
21650 | 1112 Click on the [+] to display a list of tags from that file. Click on |
1113 the [-] to retract the list. Click on the file name to edit the file | |
1114 in the attached frame. | |
1115 | |
1116 If you open tags, you might find a node starting with {+}, which is a | |
1117 category of tags. Click the {+} to expand the category. Jump-able | |
1118 tags start with >. Click the name of the tag to go to that position | |
1119 in the selected file. | |
1120 | |
1121 \\{speedbar-key-map}" | |
1122 ;; NOT interactive | |
1123 (save-excursion | |
1124 (kill-all-local-variables) | |
1125 (setq major-mode 'speedbar-mode) | |
1126 (setq mode-name "Speedbar") | |
1127 (set-syntax-table speedbar-syntax-table) | |
1128 (setq font-lock-keywords nil) ;; no font-locking please | |
1129 (setq truncate-lines t) | |
1130 (make-local-variable 'frame-title-format) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1131 (setq frame-title-format (concat "Speedbar " speedbar-version)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1132 (setq case-fold-search nil) |
23083
2dea437fe88a
(speedbar-with-writable): remove `toggle-read-only'.
Eric M. Ludlam <zappo@gnu.org>
parents:
23080
diff
changeset
|
1133 (toggle-read-only 1) |
21650 | 1134 (speedbar-set-mode-line-format) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1135 ;; Add in our dframe hooks. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1136 (if speedbar-track-mouse-flag |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1137 (setq dframe-track-mouse-function #'speedbar-track-mouse)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1138 (setq dframe-help-echo-function #'speedbar-item-info |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1139 dframe-mouse-click-function #'speedbar-click |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1140 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
|
1141 (run-hooks 'speedbar-mode-hook)) |
21650 | 1142 speedbar-buffer) |
1143 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1144 (defmacro speedbar-message (fmt &rest args) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1145 "Like `message', but for use in the speedbar frame. |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1146 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
|
1147 `(dframe-message ,fmt ,@args)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1148 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1149 (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
|
1150 "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
|
1151 Argument PROMPT is the prompt to use. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1152 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
|
1153 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
|
1154 return true without a query." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1155 (or (and (not deleting) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1156 (eq speedbar-query-confirmation-method 'none-but-delete)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1157 (dframe-y-or-n-p prompt))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1158 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1159 (defsubst speedbar-select-attached-frame () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1160 "Select the frame attached to this speedbar." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1161 (dframe-select-attached-frame (speedbar-current-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1162 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1163 ;; Backwards compatibility |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1164 (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
|
1165 (defalias 'speedbar-maybee-jump-to-attached-frame 'dframe-maybee-jump-to-attached-frame) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
1166 |
21650 | 1167 (defun speedbar-set-mode-line-format () |
1168 "Set the format of the mode line based on the current speedbar environment. | |
1169 This gives visual indications of what is up. It EXPECTS the speedbar | |
1170 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
|
1171 (if (and (frame-live-p (speedbar-current-frame)) |
78705
105d3bc0aae5
(speedbar-frame-reposition-smartly)
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
1172 (or (not (featurep 'xemacs)) |
56762
85c0c238dbbf
(speedbar-file-regexp): Definition moved up.
Richard M. Stallman <rms@gnu.org>
parents:
56754
diff
changeset
|
1173 (with-no-warnings |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1174 (specifier-instance has-modeline-p))) |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1175 speedbar-buffer) |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1176 (save-excursion |
21650 | 1177 (set-buffer speedbar-buffer) |
1178 (let* ((w (or (speedbar-frame-width) 20)) | |
1179 (p1 "<<") | |
1180 (p5 ">>") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1181 (p3 (if speedbar-update-flag "#" "!")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1182 (p35 (capitalize speedbar-initial-expansion-list-name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1183 (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
|
1184 (if line-number-mode 5 1))) |
21650 | 1185 (p2 (if (> blank 0) |
1186 (make-string (/ blank 2) ? ) | |
1187 "")) | |
1188 (p4 (if (> blank 0) | |
1189 (make-string (+ (/ blank 2) (% blank 2)) ? ) | |
1190 "")) | |
1191 (tf | |
1192 (if line-number-mode | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1193 (list (concat p1 p2 p3 " " p35) '(line-number-mode " %3l") |
21650 | 1194 (concat p4 p5)) |
1195 (list (concat p1 p2 p3 p4 p5))))) | |
1196 (if (not (equal mode-line-format tf)) | |
1197 (progn | |
1198 (setq mode-line-format tf) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1199 (speedbar-mode-line-update))))))) |
21650 | 1200 |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1201 (defvar speedbar-previous-menu nil |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1202 "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
|
1203 |
22735 | 1204 (defun speedbar-reconfigure-keymaps () |
21650 | 1205 "Reconfigure the menu-bar in a speedbar frame. |
1206 Different menu items are displayed depending on the current display mode | |
1207 and the existence of packages." | |
22735 | 1208 (let ((md (append |
1209 speedbar-easymenu-definition-base | |
1210 (if speedbar-shown-directories | |
1211 ;; file display mode version | |
1212 (speedbar-initial-menu) | |
1213 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1214 (dframe-select-attached-frame speedbar-frame) |
71091
3407291ee367
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
70504
diff
changeset
|
1215 (eval (nth 1 (assoc speedbar-initial-expansion-list-name |
3407291ee367
*** empty log message ***
Nick Roberts <nickrob@snap.net.nz>
parents:
70504
diff
changeset
|
1216 speedbar-initial-expansion-mode-alist))))) |
22735 | 1217 ;; Dynamic menu stuff |
1218 '("-") | |
1219 (list (cons "Displays" | |
1220 (let ((displays nil) | |
1221 (alist speedbar-initial-expansion-mode-alist)) | |
1222 (while alist | |
1223 (setq displays | |
1224 (cons | |
1225 (vector | |
1226 (capitalize (car (car alist))) | |
1227 (list | |
1228 'speedbar-change-initial-expansion-list | |
1229 (car (car alist))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1230 :style 'radio |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1231 :selected |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1232 `(string= ,(car (car alist)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1233 speedbar-initial-expansion-list-name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1234 ) |
22735 | 1235 displays)) |
1236 (setq alist (cdr alist))) | |
1237 displays))) | |
1238 ;; The trailer | |
1239 speedbar-easymenu-definition-trailer)) | |
1240 (localmap (save-excursion | |
1241 (let ((cf (selected-frame))) | |
1242 (prog2 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1243 (dframe-select-attached-frame speedbar-frame) |
22735 | 1244 (if (local-variable-p |
1245 'speedbar-special-mode-key-map | |
1246 (current-buffer)) | |
1247 speedbar-special-mode-key-map) | |
1248 (select-frame cf)))))) | |
1249 (save-excursion | |
1250 (set-buffer speedbar-buffer) | |
1251 (use-local-map (or localmap | |
1252 (speedbar-initial-keymap) | |
1253 ;; This creates a small keymap we can glom the | |
1254 ;; menu adjustments into. | |
1255 (speedbar-make-specialized-keymap))) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1256 ;; Delete the old menu if applicable. |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1257 (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
|
1258 (setq speedbar-previous-menu md) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1259 ;; Now add the new menu |
78705
105d3bc0aae5
(speedbar-frame-reposition-smartly)
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
1260 (if (not (featurep 'xemacs)) |
22735 | 1261 (easy-menu-define speedbar-menu-map (current-local-map) |
1262 "Speedbar menu" md) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1263 (easy-menu-add md (current-local-map)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1264 ;; XEmacs-specific: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1265 (if (fboundp 'set-buffer-menubar) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1266 (set-buffer-menubar (list md))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1267 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1268 (run-hooks 'speedbar-reconfigure-keymaps-hook))) |
21650 | 1269 |
1270 | |
1271 ;;; User Input stuff | |
1272 ;; | |
1273 (defun speedbar-customize () | |
1274 "Customize speedbar using the Custom package." | |
1275 (interactive) | |
1276 (let ((sf (selected-frame))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1277 (dframe-select-attached-frame speedbar-frame) |
21650 | 1278 (customize-group 'speedbar) |
1279 (select-frame sf)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1280 (dframe-maybee-jump-to-attached-frame)) |
21650 | 1281 |
22735 | 1282 (defun speedbar-track-mouse (event) |
1283 "For motion EVENT, display info about the current line." | |
1284 (if (not speedbar-track-mouse-flag) | |
1285 nil | |
1286 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1287 (save-window-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1288 (condition-case nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1289 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1290 (mouse-set-point event) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1291 (if (eq major-mode 'speedbar-mode) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1292 ;; 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
|
1293 (speedbar-item-info))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1294 (t (speedbar-message nil))))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1295 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1296 (defun speedbar-show-info-under-mouse () |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1297 "Call the info function for the line under the mouse." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1298 (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
|
1299 (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
|
1300 (save-excursion |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1301 (save-window-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1302 (apply 'set-mouse-position pos) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1303 (speedbar-item-info)))))) |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1304 |
21650 | 1305 (defun speedbar-next (arg) |
1306 "Move to the next ARGth line in a speedbar buffer." | |
1307 (interactive "p") | |
1308 (forward-line (or arg 1)) | |
1309 (speedbar-item-info) | |
1310 (speedbar-position-cursor-on-line)) | |
1311 | |
1312 (defun speedbar-prev (arg) | |
1313 "Move to the previous ARGth line in a speedbar buffer." | |
1314 (interactive "p") | |
1315 (speedbar-next (if arg (- arg) -1))) | |
1316 | |
22735 | 1317 (defun speedbar-restricted-move (arg) |
1318 "Move to the next ARGth line in a speedbar buffer at the same depth. | |
1319 This means that movement is restricted to a subnode, and that siblings | |
1320 of intermediate nodes are skipped." | |
99919
0be1dac780bb
(speedbar-restricted-move): Fix signal arguments.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
1321 (if (not (numberp arg)) (signal 'wrong-type-argument (list 'numberp arg))) |
22735 | 1322 ;; First find the extent for which we are allowed to move. |
1323 (let ((depth (save-excursion (beginning-of-line) | |
1324 (if (looking-at "[0-9]+:") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1325 (string-to-number (match-string 0)) |
22735 | 1326 0))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1327 (crement (if (< arg 0) 1 -1)) ; decrement or increment |
22735 | 1328 (lastmatch (point))) |
1329 (while (/= arg 0) | |
1330 (forward-line (- crement)) | |
1331 (let ((subdepth (save-excursion (beginning-of-line) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1332 (if (looking-at "[0-9]+:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1333 (string-to-number (match-string 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1334 0)))) |
22735 | 1335 (cond ((or (< subdepth depth) |
1336 (progn (end-of-line) (eobp)) | |
1337 (progn (beginning-of-line) (bobp))) | |
1338 ;; We have reached the end of this block. | |
1339 (goto-char lastmatch) | |
1340 (setq arg 0) | |
1341 (error "End of sub-list")) | |
1342 ((= subdepth depth) | |
1343 (setq lastmatch (point) | |
1344 arg (+ arg crement)))))) | |
1345 (speedbar-position-cursor-on-line))) | |
1346 | |
1347 (defun speedbar-restricted-next (arg) | |
1348 "Move to the next ARGth line in a speedbar buffer at the same depth. | |
1349 This means that movement is restricted to a subnode, and that siblings | |
1350 of intermediate nodes are skipped." | |
1351 (interactive "p") | |
1352 (speedbar-restricted-move (or arg 1)) | |
1353 (speedbar-item-info)) | |
1354 | |
1355 (defun speedbar-restricted-prev (arg) | |
1356 "Move to the previous ARGth line in a speedbar buffer at the same depth. | |
1357 This means that movement is restricted to a subnode, and that siblings | |
1358 of intermediate nodes are skipped." | |
1359 (interactive "p") | |
1360 (speedbar-restricted-move (if arg (- arg) -1)) | |
1361 (speedbar-item-info)) | |
1362 | |
1363 (defun speedbar-navigate-list (arg) | |
1364 "Move across ARG groups of similarly typed items in speedbar. | |
1365 Stop on the first line of the next type of item, or on the last or first item | |
1366 if we reach a buffer boundary." | |
1367 (interactive "p") | |
1368 (beginning-of-line) | |
1369 (if (looking-at "[0-9]+: *[[<{][-+?][]>}] ") | |
1370 (let ((str (regexp-quote (match-string 0)))) | |
1371 (while (looking-at str) | |
1372 (speedbar-restricted-move arg) | |
1373 (beginning-of-line)))) | |
1374 (speedbar-position-cursor-on-line)) | |
1375 | |
1376 (defun speedbar-forward-list () | |
1377 "Move forward over the current list. | |
1378 A LIST in speedbar is a group of similarly typed items, such as directories, | |
1379 files, or the directory button." | |
1380 (interactive) | |
1381 (speedbar-navigate-list 1) | |
1382 (speedbar-item-info)) | |
1383 | |
1384 (defun speedbar-backward-list () | |
1385 "Move backward over the current list. | |
1386 A LIST in speedbar is a group of similarly typed items, such as directories, | |
1387 files, or the directory button." | |
1388 (interactive) | |
1389 (speedbar-navigate-list -1) | |
1390 (speedbar-item-info)) | |
1391 | |
21650 | 1392 (defun speedbar-scroll-up (&optional arg) |
1393 "Page down one screen-full of the speedbar, or ARG lines." | |
1394 (interactive "P") | |
1395 (scroll-up arg) | |
1396 (speedbar-position-cursor-on-line)) | |
1397 | |
1398 (defun speedbar-scroll-down (&optional arg) | |
1399 "Page up one screen-full of the speedbar, or ARG lines." | |
1400 (interactive "P") | |
1401 (scroll-down arg) | |
1402 (speedbar-position-cursor-on-line)) | |
1403 | |
1404 (defun speedbar-up-directory () | |
1405 "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
|
1406 Assumes that the current buffer is the speedbar buffer." |
21650 | 1407 (interactive) |
1408 (setq default-directory (expand-file-name (concat default-directory "../"))) | |
1409 (speedbar-update-contents)) | |
1410 | |
1411 ;;; Speedbar file activity (aka creeping featurism) | |
1412 ;; | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1413 (defun speedbar-refresh (&optional arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1414 "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
|
1415 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
|
1416 (interactive "P") |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1417 (let ((dl speedbar-shown-directories) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1418 (dframe-power-click arg) |
47627
33bcb75e91e8
(speedbar-refresh): Simply bind deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents:
47286
diff
changeset
|
1419 deactivate-mark) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1420 ;; We need to hack something so this works in detached frames. |
21650 | 1421 (while dl |
1422 (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
|
1423 (setq dl (cdr dl))) |
22906
adfc04c48002
Updated refresh messages to clear themselves.
Eric M. Ludlam <zappo@gnu.org>
parents:
22893
diff
changeset
|
1424 (if (<= 1 speedbar-verbosity-level) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1425 (speedbar-message "Refreshing speedbar...")) |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1426 (speedbar-update-contents) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1427 (speedbar-stealthy-updates) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
1428 ;; 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
|
1429 (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
|
1430 (if (<= 1 speedbar-verbosity-level) |
47627
33bcb75e91e8
(speedbar-refresh): Simply bind deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents:
47286
diff
changeset
|
1431 (speedbar-message "Refreshing speedbar...done")))) |
21650 | 1432 |
1433 (defun speedbar-item-load () | |
22735 | 1434 "Load the item under the cursor or mouse if it is a Lisp file." |
21650 | 1435 (interactive) |
1436 (let ((f (speedbar-line-file))) | |
1437 (if (and (file-exists-p f) (string-match "\\.el\\'" f)) | |
1438 (if (and (file-exists-p (concat f "c")) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1439 (speedbar-y-or-n-p (format "Load %sc? " f))) |
21650 | 1440 ;; If the compiled version exists, load that instead... |
1441 (load-file (concat f "c")) | |
1442 (load-file f)) | |
22735 | 1443 (error "Not a loadable file")))) |
21650 | 1444 |
1445 (defun speedbar-item-byte-compile () | |
22735 | 1446 "Byte compile the item under the cursor or mouse if it is a Lisp file." |
21650 | 1447 (interactive) |
1448 (let ((f (speedbar-line-file)) | |
1449 (sf (selected-frame))) | |
1450 (if (and (file-exists-p f) (string-match "\\.el\\'" f)) | |
1451 (progn | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1452 (dframe-select-attached-frame speedbar-frame) |
21650 | 1453 (byte-compile-file f nil) |
22735 | 1454 (select-frame sf) |
1455 (speedbar-reset-scanners))) | |
21650 | 1456 )) |
1457 | |
1458 (defun speedbar-mouse-item-info (event) | |
1459 "Provide information about what the user clicked on. | |
1460 This should be bound to a mouse EVENT." | |
1461 (interactive "e") | |
1462 (mouse-set-point event) | |
1463 (speedbar-item-info)) | |
1464 | |
22735 | 1465 (defun speedbar-generic-item-info () |
44578
9c2b72b4b303
(speedbar-generic-item-info)
Pavel Janík <Pavel@Janik.cz>
parents:
44225
diff
changeset
|
1466 "Attempt to derive, and then display information about this line item. |
22735 | 1467 File style information is displayed with `speedbar-item-info'." |
1468 (save-excursion | |
1469 (beginning-of-line) | |
1470 ;; Skip invisible number info. | |
1471 (if (looking-at "\\([0-9]+\\):") (goto-char (match-end 0))) | |
1472 ;; Skip items in "folder" type text characters. | |
1473 (if (looking-at "\\s-*[[<({].[]>)}] ") (goto-char (match-end 0))) | |
1474 ;; Get the text | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1475 (speedbar-message "Text: %s" (buffer-substring-no-properties |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1476 (point) (progn (end-of-line) (point)))))) |
22735 | 1477 |
21650 | 1478 (defun speedbar-item-info () |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1479 "Display info in the minibuffer about the button the mouse is over. |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1480 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
|
1481 `speedbar-item-info'." |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1482 (interactive) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1483 (let (message-log-max) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1484 (funcall (or (speedbar-fetch-replacement-function 'speedbar-item-info) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1485 'speedbar-generic-item-info)))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1486 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1487 (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
|
1488 "Display info about a file that is on the current line. |
76017
f110ee6599bf
(speedbar-frame-mode, speedbar-frame-width, speedbar-show-unknown-files,
Juanma Barranquero <lekktu@gmail.com>
parents:
75484
diff
changeset
|
1489 Return nil if not applicable. If FILENAME, then use that |
f110ee6599bf
(speedbar-frame-mode, speedbar-frame-width, speedbar-show-unknown-files,
Juanma Barranquero <lekktu@gmail.com>
parents:
75484
diff
changeset
|
1490 instead of reading it from the speedbar buffer." |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1491 (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
|
1492 (attr (if item (file-attributes item) nil))) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1493 (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
|
1494 (nth 7 attr) item) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1495 nil))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1496 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1497 (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
|
1498 "Display info about a tag that is on the current line. |
76017
f110ee6599bf
(speedbar-frame-mode, speedbar-frame-width, speedbar-show-unknown-files,
Juanma Barranquero <lekktu@gmail.com>
parents:
75484
diff
changeset
|
1499 Return nil if not applicable." |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1500 (save-excursion |
24321
0e5b7bb19ddc
(speedbar-item-info-tag-helper): Scan the whole line.
Richard M. Stallman <rms@gnu.org>
parents:
24232
diff
changeset
|
1501 (beginning-of-line) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1502 (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
|
1503 (save-excursion(end-of-line)(point)) t) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1504 (let* ((tag (match-string 1)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1505 (attr (speedbar-line-token)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1506 (item nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1507 (semantic-tagged (if (fboundp 'semantic-tag-p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1508 (semantic-tag-p attr)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1509 (if semantic-tagged |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1510 (with-no-warnings |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1511 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1512 (when (and (semantic-tag-overlay attr) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1513 (semantic-tag-buffer attr)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1514 (set-buffer (semantic-tag-buffer attr))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1515 (speedbar-message |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1516 (funcall semantic-sb-info-format-tag-function attr) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1517 ))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1518 (looking-at "\\([0-9]+\\):") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1519 (setq item (file-name-nondirectory (speedbar-line-directory))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1520 (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
|
1521 (if (re-search-forward "{[+-]} \\([^\n]+\\)$" |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1522 (save-excursion(end-of-line)(point)) t) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1523 (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
|
1524 (if (re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1525 (let* ((detailtext (match-string 1)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1526 (detail (or (speedbar-line-token) detailtext)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1527 (parent (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1528 (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1529 (let ((dep (if (looking-at "[0-9]+:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1530 (1- (string-to-number (match-string 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1531 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1532 (re-search-backward (concat "^" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1533 (int-to-string dep) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1534 ":") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1535 nil t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1536 (if (looking-at "[0-9]+: +[-+=>]> \\([^\n]+\\)$") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1537 (speedbar-line-token) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1538 nil)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1539 (if (featurep 'semantic) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1540 (with-no-warnings |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1541 (if (semantic-tag-p detail) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1542 (speedbar-message |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1543 (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
|
1544 (if parent |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1545 (speedbar-message "Detail: %s of tag %s" detail |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1546 (if (semantic-tag-p parent) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1547 (semantic-format-tag-name parent nil t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1548 parent)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1549 (speedbar-message "Detail: %s" detail)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1550 ;; Not using `semantic': |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1551 (if parent |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1552 (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
|
1553 (speedbar-message "Detail: %s" detail)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1554 nil))))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1555 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1556 (defun speedbar-files-item-info () |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1557 "Display info in the minibuffer about the button the mouse is over." |
21650 | 1558 (if (not speedbar-shown-directories) |
22735 | 1559 (speedbar-generic-item-info) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1560 (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
|
1561 (speedbar-item-info-tag-helper) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1562 (speedbar-generic-item-info)))) |
21650 | 1563 |
1564 (defun speedbar-item-copy () | |
1565 "Copy the item under the cursor. | |
1566 Files can be copied to new names or places." | |
1567 (interactive) | |
1568 (let ((f (speedbar-line-file))) | |
22735 | 1569 (if (not f) (error "Not a file")) |
21650 | 1570 (if (file-directory-p f) |
22735 | 1571 (error "Cannot copy directory") |
21650 | 1572 (let* ((rt (read-file-name (format "Copy %s to: " |
1573 (file-name-nondirectory f)) | |
1574 (file-name-directory f))) | |
1575 (refresh (member (expand-file-name (file-name-directory rt)) | |
1576 speedbar-shown-directories))) | |
1577 ;; Create the right file name part | |
1578 (if (file-directory-p rt) | |
1579 (setq rt | |
1580 (concat (expand-file-name rt) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1581 (if (string-match "[/\\]$" rt) "" "/") |
21650 | 1582 (file-name-nondirectory f)))) |
1583 (if (or (not (file-exists-p rt)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1584 (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
|
1585 t)) |
21650 | 1586 (progn |
1587 (copy-file f rt t t) | |
1588 ;; refresh display if the new place is currently displayed. | |
1589 (if refresh | |
1590 (progn | |
1591 (speedbar-refresh) | |
1592 (if (not (speedbar-goto-this-file rt)) | |
1593 (speedbar-goto-this-file f)))) | |
1594 )))))) | |
1595 | |
1596 (defun speedbar-item-rename () | |
1597 "Rename the item under the cursor or mouse. | |
1598 Files can be renamed to new names or moved to new directories." | |
1599 (interactive) | |
1600 (let ((f (speedbar-line-file))) | |
1601 (if f | |
1602 (let* ((rt (read-file-name (format "Rename %s to: " | |
1603 (file-name-nondirectory f)) | |
1604 (file-name-directory f))) | |
1605 (refresh (member (expand-file-name (file-name-directory rt)) | |
1606 speedbar-shown-directories))) | |
1607 ;; Create the right file name part | |
1608 (if (file-directory-p rt) | |
1609 (setq rt | |
1610 (concat (expand-file-name rt) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1611 (if (string-match "[/\\]\\'" rt) "" "/") |
21650 | 1612 (file-name-nondirectory f)))) |
1613 (if (or (not (file-exists-p rt)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1614 (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
|
1615 t)) |
21650 | 1616 (progn |
1617 (rename-file f rt t) | |
1618 ;; refresh display if the new place is currently displayed. | |
1619 (if refresh | |
1620 (progn | |
1621 (speedbar-refresh) | |
1622 (speedbar-goto-this-file rt) | |
1623 ))))) | |
22735 | 1624 (error "Not a file")))) |
21650 | 1625 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1626 (defun speedbar-create-directory () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1627 "Create a directory in speedbar." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1628 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1629 (let ((f (speedbar-line-file))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1630 (if f |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1631 (let* ((basedir (file-name-directory f)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1632 (nd (read-file-name "Create directory: " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1633 basedir))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1634 ;; Make the directory |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1635 (make-directory nd t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1636 (speedbar-refresh) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1637 (speedbar-goto-this-file nd) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1638 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1639 (error "Not a file")))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1640 |
21650 | 1641 (defun speedbar-item-delete () |
1642 "Delete the item under the cursor. Files are removed from disk." | |
1643 (interactive) | |
1644 (let ((f (speedbar-line-file))) | |
22735 | 1645 (if (not f) (error "Not a file")) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1646 (if (speedbar-y-or-n-p (format "Delete %s? " f) t) |
21650 | 1647 (progn |
1648 (if (file-directory-p f) | |
1649 (delete-directory f) | |
1650 (delete-file f)) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
1651 (speedbar-message "Okie dokie..") |
21650 | 1652 (let ((p (point))) |
1653 (speedbar-refresh) | |
1654 (goto-char p)) | |
1655 )) | |
1656 )) | |
1657 | |
22735 | 1658 (defun speedbar-item-object-delete () |
1659 "Delete the object associated from the item under the cursor. | |
1660 The file is removed from disk. The object is determined from the | |
1661 variable `speedbar-obj-alist'." | |
1662 (interactive) | |
1663 (let* ((f (speedbar-line-file)) | |
1664 (obj nil) | |
1665 (oa speedbar-obj-alist)) | |
1666 (if (not f) (error "Not a file")) | |
1667 (while (and oa (not (string-match (car (car oa)) f))) | |
1668 (setq oa (cdr oa))) | |
1669 (setq obj (concat (file-name-sans-extension f) (cdr (car oa)))) | |
1670 (if (and oa (file-exists-p obj) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1671 (speedbar-y-or-n-p (format "Delete %s? " obj) t)) |
22735 | 1672 (progn |
1673 (delete-file obj) | |
1674 (speedbar-reset-scanners))))) | |
1675 | |
21650 | 1676 (defun speedbar-enable-update () |
1677 "Enable automatic updating in speedbar via timers." | |
1678 (interactive) | |
1679 (setq speedbar-update-flag t) | |
1680 (speedbar-set-mode-line-format) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1681 (speedbar-set-timer dframe-update-speed)) |
21650 | 1682 |
1683 (defun speedbar-disable-update () | |
1684 "Disable automatic updating and stop consuming resources." | |
1685 (interactive) | |
1686 (setq speedbar-update-flag nil) | |
1687 (speedbar-set-mode-line-format) | |
1688 (speedbar-set-timer nil)) | |
1689 | |
1690 (defun speedbar-toggle-updates () | |
1691 "Toggle automatic update for the speedbar frame." | |
1692 (interactive) | |
1693 (if speedbar-update-flag | |
1694 (speedbar-disable-update) | |
1695 (speedbar-enable-update))) | |
1696 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1697 (defun speedbar-toggle-images () |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1698 "Toggle use of images in the speedbar frame. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1699 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
|
1700 (interactive) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1701 (setq speedbar-use-images (not speedbar-use-images)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1702 (speedbar-refresh)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1703 |
21650 | 1704 (defun speedbar-toggle-sorting () |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1705 "Toggle tag sorting." |
21650 | 1706 (interactive) |
1707 (setq speedbar-sort-tags (not speedbar-sort-tags))) | |
1708 | |
1709 (defun speedbar-toggle-show-all-files () | |
1710 "Toggle display of files speedbar can not tag." | |
1711 (interactive) | |
1712 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files)) | |
1713 (speedbar-refresh)) | |
1714 | |
1715 (defmacro speedbar-with-writable (&rest forms) | |
1716 "Allow the buffer to be writable and evaluate FORMS." | |
1717 (list 'let '((inhibit-read-only t)) | |
1718 (cons 'progn forms))) | |
1719 (put 'speedbar-with-writable 'lisp-indent-function 0) | |
1720 | |
1721 (defun speedbar-insert-button (text face mouse function | |
1722 &optional token prevline) | |
1723 "Insert TEXT as the next logical speedbar button. | |
1724 FACE is the face to put on the button, MOUSE is the highlight face to use. | |
1725 When the user clicks on TEXT, FUNCTION is called with the TOKEN parameter. | |
1726 This function assumes that the current buffer is the speedbar buffer. | |
1727 If PREVLINE, then put this button on the previous line. | |
1728 | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
1729 This is a convenience function for special modes that create their own |
21650 | 1730 specialized speedbar displays." |
1731 (goto-char (point-max)) | |
29130
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1732 (let ((start (point))) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1733 (if (/= (current-column) 0) (insert "\n")) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1734 (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
|
1735 (if prevline (progn (delete-char -1) |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1736 (insert " ") ;back up if desired... |
b37210b05707
(speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents:
28925
diff
changeset
|
1737 (put-text-property (1- (point)) (point) 'invisible nil))) |
21650 | 1738 (let ((start (point))) |
1739 (insert text) | |
1740 (speedbar-make-button start (point) face mouse function token)) | |
1741 (let ((start (point))) | |
1742 (insert "\n") | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1743 (add-text-properties |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1744 start (point) '(face nil invisible nil mouse-face nil)))) |
21650 | 1745 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1746 (defun speedbar-insert-separator (text) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1747 "Insert a separation label of TEXT. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1748 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
|
1749 (if speedbar-use-images |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1750 (let ((start (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1751 (insert "//") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1752 (speedbar-insert-image-button-maybe start 2))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1753 (let ((start (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1754 (insert text "\n") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1755 (speedbar-make-button start (point) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1756 'speedbar-separator-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1757 nil nil nil))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1758 |
21650 | 1759 (defun speedbar-make-button (start end face mouse function &optional token) |
1760 "Create a button from START to END, with FACE as the display face. | |
1761 MOUSE is the mouse face. When this button is clicked on FUNCTION | |
69021
4d9d30d2a347
(speedbar-make-button): Keep text properties
Nick Roberts <nickrob@snap.net.nz>
parents:
68942
diff
changeset
|
1762 will be run with the TOKEN parameter (any Lisp object). If FACE |
4d9d30d2a347
(speedbar-make-button): Keep text properties
Nick Roberts <nickrob@snap.net.nz>
parents:
68942
diff
changeset
|
1763 is t use the text properties of the string that is passed as an |
4d9d30d2a347
(speedbar-make-button): Keep text properties
Nick Roberts <nickrob@snap.net.nz>
parents:
68942
diff
changeset
|
1764 argument." |
4d9d30d2a347
(speedbar-make-button): Keep text properties
Nick Roberts <nickrob@snap.net.nz>
parents:
68942
diff
changeset
|
1765 (unless (eq face t) |
4d9d30d2a347
(speedbar-make-button): Keep text properties
Nick Roberts <nickrob@snap.net.nz>
parents:
68942
diff
changeset
|
1766 (put-text-property start end 'face face)) |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1767 (add-text-properties |
69021
4d9d30d2a347
(speedbar-make-button): Keep text properties
Nick Roberts <nickrob@snap.net.nz>
parents:
68942
diff
changeset
|
1768 start end `(mouse-face ,mouse invisible nil |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
1769 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
|
1770 (if speedbar-use-tool-tips-flag |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1771 (put-text-property start end 'help-echo #'dframe-help-echo)) |
21650 | 1772 (if function (put-text-property start end 'speedbar-function function)) |
1773 (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
|
1774 ;; 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
|
1775 (if (<= (- end start) 3) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1776 (speedbar-insert-image-button-maybe start (- end start))) |
21650 | 1777 ) |
1778 | |
22735 | 1779 ;;; Initial Expansion list management |
1780 ;; | |
1781 (defun speedbar-initial-expansion-list () | |
1782 "Return the current default expansion list. | |
1783 This is based on `speedbar-initial-expansion-list-name' referencing | |
1784 `speedbar-initial-expansion-mode-alist'." | |
1785 ;; cdr1 - name, cdr2 - menu | |
1786 (cdr (cdr (cdr (assoc speedbar-initial-expansion-list-name | |
1787 speedbar-initial-expansion-mode-alist))))) | |
1788 | |
1789 (defun speedbar-initial-menu () | |
1790 "Return the current default menu data. | |
1791 This is based on `speedbar-initial-expansion-list-name' referencing | |
1792 `speedbar-initial-expansion-mode-alist'." | |
1793 (symbol-value | |
1794 (car (cdr (assoc speedbar-initial-expansion-list-name | |
1795 speedbar-initial-expansion-mode-alist))))) | |
1796 | |
1797 (defun speedbar-initial-keymap () | |
1798 "Return the current default menu data. | |
1799 This is based on `speedbar-initial-expansion-list-name' referencing | |
1800 `speedbar-initial-expansion-mode-alist'." | |
1801 (symbol-value | |
1802 (car (cdr (cdr (assoc speedbar-initial-expansion-list-name | |
1803 speedbar-initial-expansion-mode-alist)))))) | |
1804 | |
1805 (defun speedbar-initial-stealthy-functions () | |
1806 "Return a list of functions to call stealthily. | |
1807 This is based on `speedbar-initial-expansion-list-name' referencing | |
1808 `speedbar-stealthy-function-list'." | |
1809 (cdr (assoc speedbar-initial-expansion-list-name | |
1810 speedbar-stealthy-function-list))) | |
1811 | |
1812 (defun speedbar-add-expansion-list (new-list) | |
1813 "Add NEW-LIST to the list of expansion lists." | |
1814 (add-to-list 'speedbar-initial-expansion-mode-alist new-list)) | |
1815 | |
1816 (defun speedbar-change-initial-expansion-list (new-default) | |
1817 "Change speedbar's default expansion list to NEW-DEFAULT." | |
1818 (interactive | |
1819 (list | |
1820 (completing-read (format "Speedbar Mode (default %s): " | |
1821 speedbar-previously-used-expansion-list-name) | |
1822 speedbar-initial-expansion-mode-alist | |
1823 nil t "" nil | |
1824 speedbar-previously-used-expansion-list-name))) | |
1825 (setq speedbar-previously-used-expansion-list-name | |
1826 speedbar-initial-expansion-list-name | |
1827 speedbar-initial-expansion-list-name new-default) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1828 (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
|
1829 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1830 (speedbar-refresh) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1831 (speedbar-reconfigure-keymaps)))) |
22735 | 1832 |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1833 (defun speedbar-fetch-replacement-function (function) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1834 "Return a current mode-specific replacement for function, or nil. |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1835 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
|
1836 for FUNCTION." |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1837 (cdr (assoc function |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1838 (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
|
1839 speedbar-mode-functions-list))))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1840 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
1841 (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
|
1842 "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
|
1843 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
|
1844 (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
|
1845 |
22735 | 1846 |
1847 ;;; Special speedbar display management | |
1848 ;; | |
1849 (defun speedbar-maybe-add-localized-support (buffer) | |
1850 "Quick check function called on BUFFERs by the speedbar timer function. | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1851 Maintains the value of local variables which control speedbar's use |
22735 | 1852 of the special mode functions." |
1853 (or speedbar-special-mode-expansion-list | |
1854 (speedbar-add-localized-speedbar-support buffer))) | |
1855 | |
1856 (defun speedbar-add-localized-speedbar-support (buffer) | |
1857 "Add localized speedbar support to BUFFER's mode if it is available." | |
1858 (interactive "bBuffer: ") | |
1859 (if (stringp buffer) (setq buffer (get-buffer buffer))) | |
1860 (if (not (buffer-live-p buffer)) | |
1861 nil | |
1862 (save-excursion | |
1863 (set-buffer buffer) | |
1864 (save-match-data | |
1865 (let ((ms (symbol-name major-mode)) v) | |
1866 (if (not (string-match "-mode$" ms)) | |
1867 nil ;; do nothing to broken mode | |
1868 (setq ms (substring ms 0 (match-beginning 0))) | |
1869 (setq v (intern-soft (concat ms "-speedbar-buttons"))) | |
1870 (make-local-variable 'speedbar-special-mode-expansion-list) | |
1871 (if (not v) | |
1872 (setq speedbar-special-mode-expansion-list t) | |
1873 ;; If it is autoloaded, we need to load it now so that | |
1874 ;; we have access to the varialbe -speedbar-menu-items. | |
1875 ;; Is this XEmacs safe? | |
1876 (let ((sf (symbol-function v))) | |
1877 (if (and (listp sf) (eq (car sf) 'autoload)) | |
1878 (load-library (car (cdr sf))))) | |
1879 (setq speedbar-special-mode-expansion-list (list v)) | |
1880 (setq v (intern-soft (concat ms "-speedbar-key-map"))) | |
1881 (if (not v) | |
1882 nil ;; don't add special keymap | |
1883 (make-local-variable 'speedbar-special-mode-key-map) | |
1884 (setq speedbar-special-mode-key-map | |
1885 (symbol-value v))) | |
1886 (setq v (intern-soft (concat ms "-speedbar-menu-items"))) | |
1887 (if (not v) | |
1888 nil ;; don't add special menus | |
1889 (make-local-variable 'speedbar-easymenu-definition-special) | |
1890 (setq speedbar-easymenu-definition-special | |
1891 (symbol-value v))) | |
1892 ))))))) | |
1893 | |
1894 (defun speedbar-remove-localized-speedbar-support (buffer) | |
1895 "Remove any traces that BUFFER supports speedbar in a specialized way." | |
1896 (save-excursion | |
1897 (set-buffer buffer) | |
1898 (kill-local-variable 'speedbar-special-mode-expansion-list) | |
1899 (kill-local-variable 'speedbar-special-mode-key-map) | |
1900 (kill-local-variable 'speedbar-easymenu-definition-special))) | |
1901 | |
21650 | 1902 ;;; File button management |
1903 ;; | |
1904 (defun speedbar-file-lists (directory) | |
1905 "Create file lists for DIRECTORY. | |
1906 The car is the list of directories, the cdr is list of files not | |
1907 matching ignored headers. Cache any directory files found in | |
1908 `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
|
1909 the file-system." |
21650 | 1910 (setq directory (expand-file-name directory)) |
1911 ;; If in powerclick mode, then the directory we are getting | |
1912 ;; should be rescanned. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1913 (if dframe-power-click |
21650 | 1914 (adelete 'speedbar-directory-contents-alist directory)) |
1915 ;; find the directory, either in the cache, or build it. | |
1916 (or (cdr-safe (assoc directory speedbar-directory-contents-alist)) | |
1917 (let ((default-directory directory) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1918 (dir (directory-files directory nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1919 (dirs nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1920 (files nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1921 (while dir |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1922 (if (not |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1923 (or (string-match speedbar-file-unshown-regexp (car dir)) |
87446
168445c0b213
* vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
78705
diff
changeset
|
1924 (member (car dir) vc-directory-exclusion-list) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1925 (string-match speedbar-directory-unshown-regexp (car dir)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1926 (if (file-directory-p (car dir)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1927 (setq dirs (cons (car dir) dirs)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1928 (setq files (cons (car dir) files)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1929 (setq dir (cdr dir))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1930 (let ((nl (cons (nreverse dirs) (list (nreverse files))))) |
21650 | 1931 (aput 'speedbar-directory-contents-alist directory nl) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1932 nl)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
1933 )) |
21650 | 1934 |
1935 (defun speedbar-directory-buttons (directory index) | |
1936 "Insert a single button group at point for DIRECTORY. | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
1937 Each directory part is a different button. If part of the directory |
21650 | 1938 matches the user directory ~, then it is replaced with a ~. |
1939 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
|
1940 (let* ((tilde (expand-file-name "~/")) |
21650 | 1941 (dd (expand-file-name directory)) |
1942 (junk (string-match (regexp-quote tilde) dd)) | |
1943 (displayme (if junk | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1944 (concat "~/" (substring dd (match-end 0))) |
21650 | 1945 dd)) |
1946 (p (point))) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1947 (if (string-match "^~[/\\]?\\'" displayme) (setq displayme tilde)) |
21650 | 1948 (insert displayme) |
1949 (save-excursion | |
1950 (goto-char p) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1951 (while (re-search-forward "\\([^/\\]+\\)[/\\]" nil t) |
21650 | 1952 (speedbar-make-button (match-beginning 1) (match-end 1) |
1953 'speedbar-directory-face | |
1954 'speedbar-highlight-face | |
1955 'speedbar-directory-buttons-follow | |
25432
07df7c764669
(speedbar-directory-buttons): Recognize
Richard M. Stallman <rms@gnu.org>
parents:
24809
diff
changeset
|
1956 (if (and (= (match-beginning 1) p) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1957 (not (char-equal (char-after (+ p 1)) ?:))) |
21650 | 1958 (expand-file-name "~/") ;the tilde |
1959 (buffer-substring-no-properties | |
1960 p (match-end 0))))) | |
1961 ;; Nuke the beginning of the directory if it's too long... | |
1962 (cond ((eq speedbar-directory-button-trim-method 'span) | |
1963 (beginning-of-line) | |
1964 (let ((ww (or (speedbar-frame-width) 20))) | |
1965 (move-to-column ww nil) | |
1966 (while (>= (current-column) ww) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1967 (re-search-backward "[/\\]" nil t) |
21650 | 1968 (if (<= (current-column) 2) |
1969 (progn | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1970 (re-search-forward "[/\\]" nil t) |
21650 | 1971 (if (< (current-column) 4) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1972 (re-search-forward "[/\\]" nil t)) |
21650 | 1973 (forward-char -1))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1974 (if (looking-at "[/\\]?$") |
21650 | 1975 (beginning-of-line) |
1976 (insert "/...\n ") | |
1977 (move-to-column ww nil))))) | |
1978 ((eq speedbar-directory-button-trim-method 'trim) | |
1979 (end-of-line) | |
1980 (let ((ww (or (speedbar-frame-width) 20)) | |
1981 (tl (current-column))) | |
1982 (if (< ww tl) | |
1983 (progn | |
1984 (move-to-column (- tl ww)) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1985 (if (re-search-backward "[/\\]" nil t) |
21650 | 1986 (progn |
1987 (delete-region (point-min) (point)) | |
1988 (insert "$") | |
1989 ))))))) | |
1990 ) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
1991 (if (string-match "\\`[/\\][^/\\]+[/\\]\\'" displayme) |
21650 | 1992 (progn |
1993 (insert " ") | |
1994 (let ((p (point))) | |
1995 (insert "<root>") | |
1996 (speedbar-make-button p (point) | |
1997 'speedbar-directory-face | |
1998 'speedbar-highlight-face | |
1999 'speedbar-directory-buttons-follow | |
2000 "/")))) | |
2001 (end-of-line) | |
2002 (insert-char ?\n 1 nil))) | |
2003 | |
2004 (defun speedbar-make-tag-line (exp-button-type | |
2005 exp-button-char exp-button-function | |
2006 exp-button-data | |
2007 tag-button tag-button-function tag-button-data | |
2008 tag-button-face depth) | |
2009 "Create a tag line with EXP-BUTTON-TYPE for the small expansion button. | |
2010 This is the button that expands or contracts a node (if applicable), | |
2011 and EXP-BUTTON-CHAR the character in it (+, -, ?, etc). EXP-BUTTON-FUNCTION | |
2012 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
|
2013 'bracket, 'angle, 'curly, 'expandtag, 'statictag, t, or nil. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2014 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
|
2015 button. |
21650 | 2016 |
2017 Next, TAG-BUTTON is the text of the tag. TAG-BUTTON-FUNCTION is the | |
2018 function to call if clicked on, and TAG-BUTTON-DATA is the data to | |
2019 attach to the text field (such a tag positioning, etc). | |
2020 TAG-BUTTON-FACE is a face used for this type of tag. | |
2021 | |
2022 Lastly, DEPTH shows the depth of expansion. | |
2023 | |
2024 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
|
2025 position to insert a new item, and that the new item will end with a CR." |
21650 | 2026 (let ((start (point)) |
2027 (end (progn | |
2028 (insert (int-to-string depth) ":") | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2029 (point))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2030 (depthspacesize (* depth speedbar-indentation-width))) |
21650 | 2031 (put-text-property start end 'invisible t) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2032 (insert-char ? depthspacesize nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2033 (put-text-property (- (point) depthspacesize) (point) 'invisible nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2034 (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
|
2035 ((eq exp-button-type 'angle) "<%c>") |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2036 ((eq exp-button-type 'curly) "{%c}") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2037 ((eq exp-button-type 'expandtag) " %c>") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2038 ((eq exp-button-type 'statictag) " =>") |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2039 (t ">"))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2040 (buttxt (format exp-button exp-button-char)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2041 (start (point)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2042 (end (progn (insert buttxt) (point))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2043 (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
|
2044 'speedbar-button-face nil)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2045 (mf (if exp-button-function 'speedbar-highlight-face nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2046 ) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2047 (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
|
2048 (if speedbar-hide-button-brackets-flag |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2049 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2050 (put-text-property start (1+ start) 'invisible t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2051 (put-text-property end (1- end) 'invisible t))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2052 ) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2053 (insert-char ? 1 nil) |
21650 | 2054 (put-text-property (1- (point)) (point) 'invisible nil) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2055 (let ((start (point)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2056 (end (progn (insert tag-button) (point)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2057 (insert-char ?\n 1 nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2058 (put-text-property (1- (point)) (point) 'invisible nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2059 (speedbar-make-button start end tag-button-face |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2060 (if tag-button-function 'speedbar-highlight-face nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2061 tag-button-function tag-button-data)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2062 )) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
2063 |
21650 | 2064 (defun speedbar-change-expand-button-char (char) |
2065 "Change the expansion button character to CHAR for the current line." | |
2066 (save-excursion | |
2067 (beginning-of-line) | |
2068 (if (re-search-forward ":\\s-*.\\([-+?]\\)" (save-excursion (end-of-line) | |
2069 (point)) t) | |
2070 (speedbar-with-writable | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2071 (goto-char (match-end 1)) |
22735 | 2072 (insert-char char 1 t) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2073 (forward-char -1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2074 (delete-char -1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2075 ;;(put-text-property (point) (1- (point)) 'invisible nil) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2076 ;; 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
|
2077 (speedbar-insert-image-button-maybe (- (point) 1) 3))))) |
21650 | 2078 |
2079 | |
2080 ;;; Build button lists | |
2081 ;; | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2082 (defun speedbar-insert-files-at-point (files level) |
21650 | 2083 "Insert list of FILES starting at point, and indenting all files to LEVEL. |
2084 Tag expandable items with a +, otherwise a ?. Don't highlight ? as we | |
2085 don't know how to manage them. The input parameter FILES is a cons | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2086 cell of the form ( 'DIRLIST . 'FILELIST )." |
21650 | 2087 ;; Start inserting all the directories |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2088 (let ((dirs (car files))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2089 (while dirs |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2090 (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
|
2091 (car dirs) 'speedbar-dir-follow nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2092 'speedbar-directory-face level) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2093 (setq dirs (cdr dirs)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2094 (let ((lst (car (cdr files))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2095 (case-fold-search t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2096 (while lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2097 (let* ((known (string-match speedbar-file-regexp (car lst))) |
21650 | 2098 (expchar (if known ?+ ??)) |
2099 (fn (if known 'speedbar-tag-file nil))) | |
2100 (if (or speedbar-show-unknown-files (/= expchar ??)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2101 (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
|
2102 (car lst) 'speedbar-find-file nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2103 'speedbar-file-face level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2104 (setq lst (cdr lst))))) |
21650 | 2105 |
2106 (defun speedbar-default-directory-list (directory index) | |
2107 "Insert files for DIRECTORY with level INDEX at point." | |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
2108 (speedbar-insert-files-at-point |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2109 (speedbar-file-lists directory) index) |
21650 | 2110 (speedbar-reset-scanners) |
2111 (if (= index 0) | |
2112 ;; If the shown files variable has extra directories, then | |
2113 ;; it is our responsibility to redraw them all | |
2114 ;; Luckilly, the nature of inserting items into this list means | |
2115 ;; that by reversing it, we can easilly go in the right order | |
2116 (let ((sf (cdr (reverse speedbar-shown-directories)))) | |
2117 (setq speedbar-shown-directories | |
2118 (list (expand-file-name default-directory))) | |
2119 ;; exand them all as we find them | |
2120 (while sf | |
2121 (if (speedbar-goto-this-file (car sf)) | |
2122 (progn | |
2123 (beginning-of-line) | |
2124 (if (looking-at "[0-9]+:[ ]*<") | |
2125 (progn | |
2126 (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
|
2127 (speedbar-do-function-pointer))))) |
e47fc6bb028d
(speedbar-default-directory-list): Made robust against deleted directories.
Richard M. Stallman <rms@gnu.org>
parents:
42456
diff
changeset
|
2128 (setq sf (cdr sf))) |
21650 | 2129 ))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2130 ;;; Generic List support |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2131 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2132 ;; 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
|
2133 ;; in order to make it look nice. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2134 ;; |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2135 ;; A generic list is of the form: |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2136 ;; ( ("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
|
2137 ;; ("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
|
2138 ;; ("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
|
2139 (defun speedbar-generic-list-group-p (sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2140 "Non-nil if SUBLST is a group. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2141 Groups may optionally contain a position." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2142 (and (stringp (car-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2143 (or (and (listp (cdr-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2144 (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
|
2145 (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
|
2146 ))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2147 (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
|
2148 (listp (cdr-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2149 (speedbar-generic-list-tag-p |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2150 (car-safe (cdr-safe (cdr-safe sublst))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2151 ))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2152 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2153 (defun speedbar-generic-list-positioned-group-p (sublst) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2154 "Non-nil if SUBLST is a group with a position." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2155 (and (stringp (car-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2156 (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
|
2157 (listp (cdr-safe (cdr-safe sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2158 (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
|
2159 (or (speedbar-generic-list-tag-p rest) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2160 (speedbar-generic-list-group-p rest) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2161 (speedbar-generic-list-positioned-group-p rest) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2162 )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2163 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2164 (defun speedbar-generic-list-tag-p (sublst) |
73645
4dac62a8a77b
(speedbar-generic-list-tag-p): Use "non-nil" in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
71091
diff
changeset
|
2165 "Non-nil if SUBLST is a tag." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2166 (and (stringp (car-safe sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2167 (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
|
2168 (not (cdr-safe (cdr-safe sublst)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2169 ;; For semantic/bovine items, this is needed |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2170 (symbolp (car-safe (cdr-safe sublst)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2171 )) |
21650 | 2172 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2173 (defun speedbar-sort-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2174 "Sort all elements of tag hierarchy LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2175 (sort (copy-alist lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2176 (lambda (a b) (string< (car a) (car b))))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2177 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2178 (defun speedbar-try-completion (string alist) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2179 "A wrapper for `try-completion'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2180 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
|
2181 passes some tests." |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2182 (if (and (consp alist) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2183 (listp (car alist)) (stringp (car (car alist)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2184 (try-completion string alist) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2185 nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2186 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2187 (defun speedbar-prefix-group-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2188 "Prefix group names for tag hierarchy LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2189 (let ((newlst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2190 (sublst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2191 (work-list nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2192 (junk-list nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2193 (short-group-list nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2194 (short-start-name nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2195 (short-end-name nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2196 (num-shorts-grouped 0) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2197 (bins (make-vector 256 nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2198 (diff-idx 0)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2199 (if (<= (length lst) speedbar-tag-regroup-maximum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2200 ;; Do nothing. Too short to bother with. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2201 lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2202 ;; Break out sub-lists |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2203 (while lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2204 (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
|
2205 (setq newlst (cons (car lst) newlst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2206 (setq sublst (cons (car lst) sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2207 (setq lst (cdr lst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2208 ;; Reverse newlst because it was made backwards. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2209 ;; Sublist doesn't need reversing because the act |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2210 ;; of binning things will reverse it for us. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2211 (setq newlst (nreverse newlst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2212 sublst sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2213 ;; 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
|
2214 ;; list get-shorter than our minimum. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2215 (if (<= (length sublst) speedbar-tag-split-minimum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2216 (setq work-list sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2217 (setq diff-idx (length (speedbar-try-completion "" sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2218 ;; Sort the whole list into bins. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2219 (while sublst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2220 (let ((e (car sublst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2221 (s (car (car sublst)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2222 (cond ((<= (length s) diff-idx) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2223 ;; 0 storage bin for shorty. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2224 (aset bins 0 (cons e (aref bins 0)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2225 (t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2226 ;; 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
|
2227 (aset bins (aref s diff-idx) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2228 (cons e (aref bins (aref s diff-idx))))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2229 (setq sublst (cdr sublst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2230 ;; 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
|
2231 ;; 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
|
2232 ;; 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
|
2233 ;; group combinding those two sub-lists. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2234 (setq diff-idx 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2235 (while (> 256 diff-idx) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2236 ;; The bins contents are currently in forward order. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2237 (let ((l (aref bins diff-idx))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2238 (if l |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2239 (let ((tmp (cons (speedbar-try-completion "" l) l))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2240 (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
|
2241 (> (+ (length l) (length short-group-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2242 speedbar-tag-split-minimum-length)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2243 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2244 ;; We have reached a longer list, so we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2245 ;; must finish off a grouped group. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2246 (cond |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2247 ((and short-group-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2248 (= (length short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2249 num-shorts-grouped)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2250 ;; All singles? Junk list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2251 (setq junk-list (append (nreverse short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2252 junk-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2253 ((= num-shorts-grouped 1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2254 ;; Only one short group? Just stick it in |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2255 ;; there by itself. Make a group, and find |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2256 ;; a subexpression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2257 (let ((subexpression (speedbar-try-completion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2258 "" short-group-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2259 (if (< (length subexpression) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2260 speedbar-tag-group-name-minimum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2261 (setq subexpression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2262 (concat short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2263 " (" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2264 (substring |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2265 (car (car short-group-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2266 (length short-start-name)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2267 ")"))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2268 (setq work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2269 (cons (cons subexpression |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2270 short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2271 work-list )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2272 (short-group-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2273 ;; Multiple groups to be named in a special |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2274 ;; way by displaying the range over which we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2275 ;; have grouped them. |
22735 | 2276 (setq work-list |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2277 (cons (cons (concat short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2278 " to " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2279 short-end-name) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2280 short-group-list) |
22735 | 2281 work-list)))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2282 ;; Reset short group list information every time. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2283 (setq short-group-list nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2284 short-start-name nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2285 short-end-name nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2286 num-shorts-grouped 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2287 ;; 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
|
2288 ;; 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
|
2289 ;; 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
|
2290 (if (< (length l) speedbar-tag-regroup-maximum-length) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2291 (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
|
2292 num-shorts-grouped (1+ num-shorts-grouped) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2293 short-end-name (car tmp) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2294 short-start-name (if short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2295 short-start-name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2296 (car tmp))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2297 (setq work-list (cons tmp work-list)))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2298 (setq diff-idx (1+ diff-idx)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2299 ;; 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
|
2300 (cond |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2301 ((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
|
2302 ;; All singles? Junk list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2303 (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
|
2304 ((= num-shorts-grouped 1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2305 ;; Only one short group? Just stick it in |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2306 ;; there by itself. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2307 (setq work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2308 (cons (cons (speedbar-try-completion "" short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2309 short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2310 work-list))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2311 (short-group-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2312 ;; Multiple groups to be named in a special |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2313 ;; way by displaying the range over which we |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2314 ;; have grouped them. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2315 (setq work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2316 (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
|
2317 short-group-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2318 work-list)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2319 ;; Reverse the work list nreversed when consing. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2320 (setq work-list (nreverse work-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2321 ;; 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
|
2322 (if work-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2323 (if junk-list |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2324 (append newlst work-list junk-list) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2325 (append newlst work-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2326 (append newlst junk-list))))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2327 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2328 (defun speedbar-trim-words-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2329 "Trim all words in a tag hierarchy. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2330 Base trimming information on word separators, and group names. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2331 Argument LST is the list of tags to trim." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2332 (let ((newlst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2333 (sublst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2334 (trim-prefix nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2335 (trim-chars 0) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2336 (trimlst nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2337 (while lst |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2338 (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
|
2339 (setq newlst (cons (car lst) newlst)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2340 (setq sublst (cons (car lst) sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2341 (setq lst (cdr lst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2342 ;; 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
|
2343 ;; off silly pieces, only complete understandable words. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2344 (setq trim-prefix (speedbar-try-completion "" sublst) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2345 newlst (nreverse newlst)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2346 (if (or (= (length sublst) 1) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2347 (not trim-prefix) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2348 (not (string-match "\\(\\w+\\W+\\)+" trim-prefix))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2349 (append newlst (nreverse sublst)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2350 (setq trim-prefix (substring trim-prefix (match-beginning 0) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2351 (match-end 0))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2352 (setq trim-chars (length trim-prefix)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2353 (while sublst |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2354 (setq trimlst (cons |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2355 (cons (substring (car (car sublst)) trim-chars) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2356 (cdr (car sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2357 trimlst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2358 sublst (cdr sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2359 ;; Put the lists together |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2360 (append newlst trimlst)))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2361 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2362 (defun speedbar-simple-group-tag-hierarchy (lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2363 "Create a simple 'Tags' group with orphaned tags. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2364 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
|
2365 (let ((newlst nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2366 (sublst nil)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2367 (while lst |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2368 (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
|
2369 (setq newlst (cons (car lst) newlst)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2370 (setq sublst (cons (car lst) sublst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2371 (setq lst (cdr lst))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2372 (if (not newlst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2373 (nreverse sublst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2374 (setq newlst (cons (cons "Tags" (nreverse sublst)) newlst)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2375 (nreverse newlst)))) |
22735 | 2376 |
2377 (defun speedbar-create-tag-hierarchy (lst) | |
2378 "Adjust the tag hierarchy in LST, and return it. | |
2379 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
|
2380 the list." |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2381 (let* ((f (save-excursion |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2382 (forward-line -1) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2383 (or (speedbar-line-file) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2384 (speedbar-line-directory)))) |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2385 (methods (if (get-file-buffer f) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2386 (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
|
2387 speedbar-tag-hierarchy-method) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2388 speedbar-tag-hierarchy-method)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2389 (lst (if (fboundp 'copy-tree) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2390 (copy-tree lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2391 lst))) |
22735 | 2392 (while methods |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2393 (setq lst (funcall (car methods) lst) |
22735 | 2394 methods (cdr methods))) |
2395 lst)) | |
2396 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2397 (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
|
2398 "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
|
2399 Good values for this are `curly' and `expandtag'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2400 Make buffer local for your mode.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2401 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2402 (defvar speedbar-generic-list-tag-button-type nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2403 "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
|
2404 Good values for this are nil and `statictag'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2405 Make buffer local for your mode.") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2406 |
21650 | 2407 (defun speedbar-insert-generic-list (level lst expand-fun find-fun) |
2408 "At LEVEL, insert a generic multi-level alist LST. | |
2409 Associations with lists get {+} tags (to expand into more nodes) and | |
2410 those with positions just get a > as the indicator. {+} buttons will | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2411 have the function EXPAND-FUN and the token is the cdr list. The token |
21650 | 2412 name will have the function FIND-FUN and not token." |
2413 ;; Remove imenu rescan button | |
2414 (if (string= (car (car lst)) "*Rescan*") | |
2415 (setq lst (cdr lst))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2416 ;; 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
|
2417 (let ((f (save-excursion (forward-line -1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2418 (or (speedbar-line-file) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2419 (speedbar-line-directory)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2420 expand-button tag-button) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2421 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2422 (if (get-file-buffer f) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2423 (set-buffer (get-file-buffer f))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2424 (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
|
2425 tag-button speedbar-generic-list-tag-button-type)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2426 ;; Adjust the list. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2427 (setq lst (speedbar-create-tag-hierarchy lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2428 ;; insert the parts |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2429 (while lst |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2430 (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
|
2431 ((speedbar-generic-list-tag-p (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2432 (speedbar-make-tag-line tag-button |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2433 nil nil nil ;no expand button data |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2434 (car (car lst)) ;button name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2435 find-fun ;function |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2436 (cdr (car lst)) ;token is position |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2437 'speedbar-tag-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2438 (1+ level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2439 ((speedbar-generic-list-positioned-group-p (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2440 (speedbar-make-tag-line expand-button |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2441 ?+ expand-fun (cdr (cdr (car lst))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2442 (car (car lst)) ;button name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2443 find-fun ;function |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2444 (car (cdr (car lst))) ;token is posn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2445 'speedbar-tag-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2446 (1+ level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2447 ((speedbar-generic-list-group-p (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2448 (speedbar-make-tag-line expand-button |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2449 ?+ expand-fun (cdr (car lst)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2450 (car (car lst)) ;button name |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2451 nil nil 'speedbar-tag-face |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2452 (1+ level))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2453 (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
|
2454 )) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2455 (setq lst (cdr lst))))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2456 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2457 (defun speedbar-insert-imenu-list (indent lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2458 "At level INDENT, insert the imenu generated LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2459 (speedbar-insert-generic-list indent lst |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2460 'speedbar-tag-expand |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2461 'speedbar-tag-find)) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
2462 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2463 (defun speedbar-insert-etags-list (indent lst) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2464 "At level INDENT, insert the etags generated LST." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2465 (speedbar-insert-generic-list indent lst |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2466 'speedbar-tag-expand |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2467 'speedbar-tag-find)) |
21650 | 2468 |
2469 ;;; Timed functions | |
2470 ;; | |
2471 (defun speedbar-update-contents () | |
2472 "Generically update the contents of the speedbar buffer." | |
2473 (interactive) | |
2474 ;; Set the current special buffer | |
2475 (setq speedbar-desired-buffer nil) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2476 |
22735 | 2477 ;; Check for special modes |
2478 (speedbar-maybe-add-localized-support (current-buffer)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2479 |
22735 | 2480 ;; Choose the correct method of doodling. |
21650 | 2481 (if (and speedbar-mode-specific-contents-flag |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2482 (consp speedbar-special-mode-expansion-list) |
21650 | 2483 (local-variable-p |
2484 'speedbar-special-mode-expansion-list | |
2485 (current-buffer))) | |
2486 ;;(eq (get major-mode 'mode-class 'special))) | |
2487 (speedbar-update-special-contents) | |
2488 (speedbar-update-directory-contents))) | |
2489 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2490 (defun speedbar-update-localized-contents () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2491 "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
|
2492 ;; 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
|
2493 ;; special for "files" mode. Too bad. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2494 (let ((name speedbar-initial-expansion-list-name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2495 (funclst (speedbar-initial-expansion-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2496 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2497 (if (string= name "files") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2498 ;; 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
|
2499 ;; expansion list stuff. :( |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2500 (if (or (member (expand-file-name default-directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2501 speedbar-shown-directories) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2502 (and speedbar-ignored-directory-regexp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2503 (string-match |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2504 speedbar-ignored-directory-regexp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2505 (expand-file-name default-directory)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2506 nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2507 (if (<= 1 speedbar-verbosity-level) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2508 (speedbar-message "Updating speedbar to: %s..." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2509 default-directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2510 (speedbar-update-directory-contents) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2511 (if (<= 1 speedbar-verbosity-level) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2512 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2513 (speedbar-message "Updating speedbar to: %s...done" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2514 default-directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2515 (speedbar-message nil)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2516 ;; Else, we can do a short cut. No text cache. |
70504
f30d66ed3e9a
(speedbar-timer-fn): Remove save-window-excursion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69760
diff
changeset
|
2517 (let ((cbd (expand-file-name default-directory))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2518 (set-buffer speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2519 (speedbar-with-writable |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2520 (let* ((window (get-buffer-window speedbar-buffer 0)) |
69213
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2521 (p (window-point window)) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2522 (start (window-start window))) |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2523 (erase-buffer) |
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2524 (dolist (func funclst) |
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2525 (setq default-directory cbd) |
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2526 (funcall func cbd 0)) |
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2527 (speedbar-reconfigure-keymaps) |
69213
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2528 (set-window-point window p) |
70504
f30d66ed3e9a
(speedbar-timer-fn): Remove save-window-excursion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69760
diff
changeset
|
2529 (set-window-start window start))))))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2530 |
21650 | 2531 (defun speedbar-update-directory-contents () |
2532 "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
|
2533 (let ((cbd (expand-file-name default-directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2534 cbd-parent |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2535 (funclst (speedbar-initial-expansion-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2536 (cache speedbar-full-text-cache) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2537 ;; disable stealth during update |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2538 (speedbar-stealthy-function-list nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2539 (use-cache nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2540 (expand-local nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2541 ;; 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
|
2542 (inhibit-quit nil)) |
21650 | 2543 (set-buffer speedbar-buffer) |
2544 ;; If we are updating contents to where we are, then this is | |
2545 ;; really a request to update existing contents, so we must be | |
2546 ;; careful with our text cache! | |
2547 (if (member cbd speedbar-shown-directories) | |
22735 | 2548 (progn |
2549 (setq cache nil) | |
2550 ;; If the current directory is not the last element in the dir | |
2551 ;; list, then we ALSO need to zap the list of expanded directories | |
2552 (if (/= (length (member cbd speedbar-shown-directories)) 1) | |
2553 (setq speedbar-shown-directories (list cbd)))) | |
21650 | 2554 |
2555 ;; Build cbd-parent, and see if THAT is in the current shown | |
2556 ;; directories. First, go through pains to get the parent directory | |
2557 (if (and speedbar-smart-directory-expand-flag | |
2558 (save-match-data | |
2559 (setq cbd-parent cbd) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
2560 (if (string-match "[/\\]$" cbd-parent) |
22735 | 2561 (setq cbd-parent (substring cbd-parent 0 |
2562 (match-beginning 0)))) | |
21650 | 2563 (setq cbd-parent (file-name-directory cbd-parent))) |
2564 (member cbd-parent speedbar-shown-directories)) | |
2565 (setq expand-local t) | |
2566 | |
2567 ;; If this directory is NOT in the current list of available | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2568 ;; directories, then use the cache, and set the cache to our new |
21650 | 2569 ;; value. Make sure to unhighlight the current file, or if we |
2570 ;; come back to this directory, it might be a different file | |
2571 ;; and then we get a mess! | |
2572 (if (> (point-max) 1) | |
2573 (progn | |
2574 (speedbar-clear-current-file) | |
2575 (setq speedbar-full-text-cache | |
2576 (cons speedbar-shown-directories (buffer-string))))) | |
2577 | |
2578 ;; Check if our new directory is in the list of directories | |
2579 ;; shown in the text-cache | |
2580 (if (member cbd (car cache)) | |
2581 (setq speedbar-shown-directories (car cache) | |
2582 use-cache t) | |
2583 ;; default the shown directories to this list... | |
2584 (setq speedbar-shown-directories (list cbd))) | |
2585 )) | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2586 (if (not expand-local) (setq speedbar-last-selected-file nil)) |
21650 | 2587 (speedbar-with-writable |
2588 (if (and expand-local | |
2589 ;; Find this directory as a speedbar node. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2590 (speedbar-directory-line cbd)) |
21650 | 2591 ;; Open it. |
2592 (speedbar-expand-line) | |
69213
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2593 (let* ((window (get-buffer-window speedbar-buffer 0)) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2594 (p (window-point window)) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2595 (start (window-start window))) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2596 (erase-buffer) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2597 (cond (use-cache |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2598 (setq default-directory |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2599 (nth (1- (length speedbar-shown-directories)) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2600 speedbar-shown-directories)) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2601 (insert (cdr cache))) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2602 (t |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2603 (dolist (func funclst) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2604 (setq default-directory cbd) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2605 (funcall func cbd 0)))) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2606 (set-window-point window p) |
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2607 (set-window-start window start))))) |
22735 | 2608 (speedbar-reconfigure-keymaps)) |
21650 | 2609 |
2610 (defun speedbar-update-special-contents () | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
2611 "Use the mode-specific variable to fill in the speedbar buffer. |
21650 | 2612 This should only be used by modes classified as special." |
2613 (let ((funclst speedbar-special-mode-expansion-list) | |
2614 (specialbuff (current-buffer))) | |
2615 (save-excursion | |
2616 (setq speedbar-desired-buffer specialbuff) | |
2617 (set-buffer speedbar-buffer) | |
2618 ;; If we are leaving a directory, cache it. | |
2619 (if (not speedbar-shown-directories) | |
2620 ;; Do nothing | |
2621 nil | |
2622 ;; Clean up directory maintenance stuff | |
2623 (speedbar-clear-current-file) | |
2624 (setq speedbar-full-text-cache | |
2625 (cons speedbar-shown-directories (buffer-string)) | |
2626 speedbar-shown-directories nil)) | |
2627 ;; Now fill in the buffer with our newly found specialized list. | |
2628 (speedbar-with-writable | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2629 (dolist (func funclst) |
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
2630 ;; 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
|
2631 ;; decide NOT to update themselves. |
69213
d836c61e53c9
(speedbar-update-localized-contents): Try to
Nick Roberts <nickrob@snap.net.nz>
parents:
69197
diff
changeset
|
2632 (funcall func specialbuff))))) |
22735 | 2633 (speedbar-reconfigure-keymaps)) |
21650 | 2634 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2635 (defun speedbar-set-timer (timeout) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2636 "Set up the speedbar timer with TIMEOUT. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2637 Uses `dframe-set-timer'. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2638 Also resets scanner functions." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2639 (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
|
2640 ;; 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
|
2641 ;; 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
|
2642 ;; VC scanner fix itself. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2643 (if timeout |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2644 (add-hook 'after-revert-hook 'speedbar-reset-scanners) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2645 (remove-hook 'after-revert-hook 'speedbar-reset-scanners)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2646 ;; change this if it changed for some reason |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2647 (speedbar-set-mode-line-format)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2648 |
21650 | 2649 (defun speedbar-timer-fn () |
22735 | 2650 "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
|
2651 (if (or (not (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2652 (not (frame-live-p (speedbar-current-frame)))) |
21650 | 2653 (speedbar-set-timer nil) |
2654 ;; Save all the match data so that we don't mess up executing fns | |
2655 (save-match-data | |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2656 ;; 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
|
2657 ;; 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
|
2658 (if (and speedbar-update-flag |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2659 (speedbar-current-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2660 (frame-visible-p (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2661 (not (eq (frame-visible-p (speedbar-current-frame)) 'icon))) |
21650 | 2662 (let ((af (selected-frame))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2663 (dframe-select-attached-frame speedbar-frame) |
21650 | 2664 ;; make sure we at least choose a window to |
2665 ;; 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
|
2666 (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
|
2667 nil |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2668 ;; Check for special modes |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2669 (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
|
2670 ;; 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
|
2671 (if (and speedbar-mode-specific-contents-flag |
68942
cb07d3843e81
(speedbar-frame-width): Make an inline function
Nick Roberts <nickrob@snap.net.nz>
parents:
68651
diff
changeset
|
2672 (consp speedbar-special-mode-expansion-list) |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2673 (local-variable-p |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2674 'speedbar-special-mode-expansion-list |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2675 (current-buffer))) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2676 ;;(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
|
2677 (progn |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2678 (if (<= 2 speedbar-verbosity-level) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2679 (speedbar-message |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2680 "Updating speedbar to special mode: %s..." |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2681 major-mode)) |
23073
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2682 (speedbar-update-special-contents) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2683 (if (<= 2 speedbar-verbosity-level) |
a0e975baf1e1
(speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents:
23015
diff
changeset
|
2684 (progn |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2685 (speedbar-message |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2686 "Updating speedbar to special mode: %s...done" |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2687 major-mode) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2688 (speedbar-message nil)))) |
74212
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2689 |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2690 ;; Update all the contents if directories change! |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2691 (unless (and (or (member major-mode speedbar-ignored-modes) |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2692 (eq af (speedbar-current-frame)) |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2693 (not (buffer-file-name))) |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2694 ;; Always update for GUD. |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2695 (not (string-equal "GUD" |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2696 speedbar-initial-expansion-list-name))) |
b90d5a3a62fb
(speedbar-timer-fn): Revert to old behaviour when not
Nick Roberts <nickrob@snap.net.nz>
parents:
73645
diff
changeset
|
2697 (speedbar-update-localized-contents))) |
70504
f30d66ed3e9a
(speedbar-timer-fn): Remove save-window-excursion.
Nick Roberts <nickrob@snap.net.nz>
parents:
69760
diff
changeset
|
2698 (select-frame af)) |
21650 | 2699 ;; 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
|
2700 (speedbar-stealthy-updates))))) |
21650 | 2701 (run-hooks 'speedbar-timer-hook)) |
2702 | |
2703 | |
2704 ;;; Stealthy activities | |
2705 ;; | |
22735 | 2706 (defvar speedbar-stealthy-update-recurse nil |
2707 "Recursion avoidance variable for stealthy update.") | |
2708 | |
21650 | 2709 (defun speedbar-stealthy-updates () |
2710 "For a given speedbar, run all items in the stealthy function list. | |
2711 Each item returns t if it completes successfully, or nil if | |
2712 interrupted by the user." | |
22735 | 2713 (if (not speedbar-stealthy-update-recurse) |
2714 (let ((l (speedbar-initial-stealthy-functions)) | |
2715 (speedbar-stealthy-update-recurse t)) | |
2716 (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
|
2717 (speedbar-with-writable |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2718 (while (and l (funcall (car l))) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2719 ;;(sit-for 0) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
2720 (setq l (cdr l)))) |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2721 ;;(speedbar-message "Exit with %S" (car l)) |
22735 | 2722 )))) |
21650 | 2723 |
2724 (defun speedbar-reset-scanners () | |
2725 "Reset any variables used by functions in the stealthy list as state. | |
2726 If new functions are added, their state needs to be updated here." | |
22735 | 2727 (setq speedbar-vc-to-do-point t |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2728 speedbar-obj-to-do-point t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2729 speedbar-ro-to-do-point t) |
21650 | 2730 (run-hooks 'speedbar-scanner-reset-hook) |
2731 ) | |
2732 | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2733 (defun speedbar-find-selected-file (file) |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
2734 "Go to the line where FILE is." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2735 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2736 (set-buffer speedbar-buffer) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
2737 |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2738 (goto-char (point-min)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2739 (let ((m nil)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2740 (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
|
2741 (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
|
2742 "\\)\\(" speedbar-indicator-regex "\\)?\n") |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2743 nil t)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2744 (not (string= file |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2745 (concat |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2746 (speedbar-line-directory |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2747 (save-excursion |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2748 (goto-char (match-beginning 0)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2749 (beginning-of-line) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2750 (save-match-data |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2751 (looking-at "[0-9]+:") |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2752 (string-to-number (match-string 0))))) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2753 (match-string 1)))))) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2754 (if m |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2755 (progn |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2756 (goto-char (match-beginning 1)) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2757 (match-string 1))))) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2758 |
21650 | 2759 (defun speedbar-clear-current-file () |
2760 "Locate the file thought to be current, and remove its highlighting." | |
2761 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2762 ;;(set-buffer speedbar-buffer) |
21650 | 2763 (if speedbar-last-selected-file |
2764 (speedbar-with-writable | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2765 (if (speedbar-find-selected-file speedbar-last-selected-file) |
21650 | 2766 (put-text-property (match-beginning 1) |
2767 (match-end 1) | |
2768 'face | |
2769 'speedbar-file-face)))))) | |
2770 | |
2771 (defun speedbar-update-current-file () | |
2772 "Find the current file, and update our visuals to indicate its name. | |
2773 This is specific to file names. If the file name doesn't show up, but | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2774 it should be in the list, then the directory cache needs to be updated." |
21650 | 2775 (let* ((lastf (selected-frame)) |
2776 (newcfd (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2777 (dframe-select-attached-frame speedbar-frame) |
21650 | 2778 (let ((rf (if (buffer-file-name) |
2779 (buffer-file-name) | |
2780 nil))) | |
2781 (select-frame lastf) | |
2782 rf))) | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2783 (newcf (if newcfd newcfd)) |
21650 | 2784 (lastb (current-buffer)) |
22735 | 2785 (sucf-recursive (boundp 'sucf-recursive)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2786 (case-fold-search t)) |
21650 | 2787 (if (and newcf |
2788 ;; check here, that way we won't refresh to newcf until | |
2789 ;; its been written, thus saving ourselves some time | |
2790 (file-exists-p newcf) | |
2791 (not (string= newcf speedbar-last-selected-file))) | |
2792 (progn | |
2793 ;; It is important to select the frame, otherwise the window | |
2794 ;; we want the cursor to move in will not be updated by the | |
2795 ;; search-forward command. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2796 (select-frame (speedbar-current-frame)) |
21650 | 2797 ;; Remove the old file... |
2798 (speedbar-clear-current-file) | |
2799 ;; now highlight the new one. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2800 ;; (set-buffer speedbar-buffer) |
21650 | 2801 (speedbar-with-writable |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2802 (if (speedbar-find-selected-file newcf) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2803 ;; put the property on it |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2804 (put-text-property (match-beginning 1) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2805 (match-end 1) |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2806 'face |
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2807 'speedbar-selected-face) |
21650 | 2808 ;; Oops, it's not in the list. Should it be? |
2809 (if (and (string-match speedbar-file-regexp newcf) | |
2810 (string= (file-name-directory newcfd) | |
2811 (expand-file-name default-directory))) | |
2812 ;; yes, it is (we will ignore unknowns for now...) | |
2813 (progn | |
2814 (speedbar-refresh) | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
2815 (if (speedbar-find-selected-file newcf) |
21650 | 2816 ;; put the property on it |
2817 (put-text-property (match-beginning 1) | |
2818 (match-end 1) | |
2819 'face | |
2820 'speedbar-selected-face))) | |
2821 ;; if it's not in there now, whatever... | |
2822 )) | |
2823 (setq speedbar-last-selected-file newcf)) | |
2824 (if (not sucf-recursive) | |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
2825 (progn |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2826 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2827 ;;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
|
2828 ;;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
|
2829 ;;updating files. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2830 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2831 ;;(speedbar-center-buffer-smartly) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2832 |
22893
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
2833 (speedbar-position-cursor-on-line) |
322179a8fd20
(speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents:
22735
diff
changeset
|
2834 )) |
21650 | 2835 (set-buffer lastb) |
2836 (select-frame lastf) | |
2837 ))) | |
2838 ;; return that we are done with this activity. | |
2839 t) | |
2840 | |
22735 | 2841 (defun speedbar-add-indicator (indicator-string &optional replace-this) |
2842 "Add INDICATOR-STRING to the end of this speedbar line. | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2843 If INDICATOR-STRING is space, and REPLACE-THIS is a character, |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2844 then the existing indicator is removed. If there is already an |
22735 | 2845 indicator, then do not add a space." |
2846 (beginning-of-line) | |
2847 ;; The nature of the beast: Assume we are in "the right place" | |
2848 (end-of-line) | |
2849 (skip-chars-backward (concat " " speedbar-vc-indicator | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2850 speedbar-object-read-only-indicator |
22735 | 2851 (car speedbar-obj-indicator) |
2852 (cdr speedbar-obj-indicator))) | |
2853 (if (and (not (looking-at speedbar-indicator-regex)) | |
2854 (not (string= indicator-string " "))) | |
2855 (insert speedbar-indicator-separator)) | |
2856 (speedbar-with-writable | |
2857 (save-excursion | |
2858 (if (and replace-this | |
2859 (re-search-forward replace-this (save-excursion (end-of-line) | |
2860 (point)) | |
2861 t)) | |
2862 (delete-region (match-beginning 0) (match-end 0)))) | |
2863 (end-of-line) | |
2864 (if (not (string= " " indicator-string)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2865 (let ((start (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2866 (insert indicator-string) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2867 (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
|
2868 )))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2869 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2870 (defun speedbar-check-read-only () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2871 "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
|
2872 ;; 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
|
2873 ;; 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
|
2874 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2875 (if speedbar-buffer (set-buffer speedbar-buffer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2876 (if (eq speedbar-ro-to-do-point t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2877 (setq speedbar-ro-to-do-point 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2878 (if (numberp speedbar-ro-to-do-point) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2879 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2880 (goto-char speedbar-ro-to-do-point) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2881 (while (and (not (input-pending-p)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2882 (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+-\?][]>] " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2883 nil t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2884 (setq speedbar-ro-to-do-point (point)) |
65780
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2885 (let ((f (speedbar-line-file))) |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2886 (if f |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2887 (if (not (file-writable-p f)) |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2888 (speedbar-add-indicator |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2889 speedbar-object-read-only-indicator |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2890 (regexp-quote speedbar-object-read-only-indicator)) |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2891 (speedbar-add-indicator |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2892 " " (regexp-quote |
6e229fd94815
* speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65765
diff
changeset
|
2893 speedbar-object-read-only-indicator)))))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2894 (if (input-pending-p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2895 ;; return that we are incomplete |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2896 nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2897 ;; we are done, set to-do to nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2898 (setq speedbar-ro-to-do-point nil) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2899 ;; and return t |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2900 t)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2901 t))) |
22735 | 2902 |
2903 ;; Load efs/ange-ftp only if compiling to remove byte-compiler warnings. | |
21650 | 2904 ;; Steven L Baur <steve@xemacs.org> said this was important: |
22735 | 2905 (eval-when-compile (or (featurep 'xemacs) |
2906 (condition-case () (require 'efs) | |
2907 (error (require 'ange-ftp))))) | |
21650 | 2908 |
2909 (defun speedbar-check-vc () | |
2910 "Scan all files in a directory, and for each see if it's checked out. | |
2911 See `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p' for how | |
2912 to add more types of version control systems." | |
2913 ;; Check for to-do to be reset. If reset but no RCS is available | |
2914 ;; then set to nil (do nothing) otherwise, start at the beginning | |
2915 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2916 (if speedbar-buffer (set-buffer speedbar-buffer)) |
21650 | 2917 (if (and speedbar-vc-do-check (eq speedbar-vc-to-do-point t) |
2918 (speedbar-vc-check-dir-p default-directory) | |
22735 | 2919 (not (or (and (featurep 'ange-ftp) |
2920 (string-match | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2921 (car (symbol-value |
78705
105d3bc0aae5
(speedbar-frame-reposition-smartly)
Richard M. Stallman <rms@gnu.org>
parents:
78236
diff
changeset
|
2922 (if (featurep 'xemacs) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2923 'ange-ftp-directory-format |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2924 'ange-ftp-name-format))) |
22735 | 2925 (expand-file-name default-directory))) |
2926 ;; efs support: Bob Weiner | |
2927 (and (featurep 'efs) | |
2928 (string-match | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2929 (let ((reg (symbol-value 'efs-directory-regexp))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2930 (if (stringp reg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2931 reg |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2932 (car reg))) |
22735 | 2933 (expand-file-name default-directory)))))) |
21650 | 2934 (setq speedbar-vc-to-do-point 0)) |
2935 (if (numberp speedbar-vc-to-do-point) | |
2936 (progn | |
2937 (goto-char speedbar-vc-to-do-point) | |
2938 (while (and (not (input-pending-p)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2939 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-?]\\] " |
21650 | 2940 nil t)) |
2941 (setq speedbar-vc-to-do-point (point)) | |
2942 (if (speedbar-check-vc-this-line (match-string 1)) | |
22735 | 2943 (speedbar-add-indicator speedbar-vc-indicator |
2944 (regexp-quote speedbar-vc-indicator)) | |
2945 (speedbar-add-indicator " " | |
2946 (regexp-quote speedbar-vc-indicator)))) | |
21650 | 2947 (if (input-pending-p) |
2948 ;; return that we are incomplete | |
2949 nil | |
2950 ;; we are done, set to-do to nil | |
2951 (setq speedbar-vc-to-do-point nil) | |
2952 ;; and return t | |
2953 t)) | |
2954 t))) | |
2955 | |
2956 (defun speedbar-check-vc-this-line (depth) | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
2957 "Return t if the file on this line is checked out of a version control system. |
21650 | 2958 Parameter DEPTH is a string with the current depth of indentation of |
2959 the file being checked." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2960 (let* ((d (string-to-number depth)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2961 (f (speedbar-line-directory d)) |
21650 | 2962 (fn (buffer-substring-no-properties |
2963 ;; Skip-chars: thanks ptype@dra.hmg.gb | |
2964 (point) (progn | |
2965 (skip-chars-forward "^ " | |
2966 (save-excursion (end-of-line) | |
2967 (point))) | |
2968 (point)))) | |
2969 (fulln (concat f fn))) | |
2970 (if (<= 2 speedbar-verbosity-level) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
2971 (speedbar-message "Speedbar vc check...%s" fulln)) |
21650 | 2972 (and (file-writable-p fulln) |
2973 (speedbar-this-file-in-vc f fn)))) | |
2974 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2975 (defun speedbar-vc-check-dir-p (directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2976 "Return t if we should bother checking DIRECTORY for version control files. |
21650 | 2977 This can be overloaded to add new types of version control systems." |
2978 (or | |
87446
168445c0b213
* vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
78705
diff
changeset
|
2979 (catch t (dolist (vcd vc-directory-exclusion-list) |
168445c0b213
* vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
78705
diff
changeset
|
2980 (if (file-exists-p (concat directory vcd)) (throw t t))) nil) |
21650 | 2981 ;; User extension |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2982 (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
|
2983 directory) |
21650 | 2984 )) |
2985 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2986 (defun speedbar-this-file-in-vc (directory name) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2987 "Check to see if the file in DIRECTORY with NAME is in a version control system. |
87446
168445c0b213
* vc-hooks.el, vc.el: Move vc-directory-exclusion-list from vc.el
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
78705
diff
changeset
|
2988 Automatically recognizes all VCs supported by VC mode. You can |
21650 | 2989 optimize this function by overriding it and only doing those checks |
2990 that will occur on your system." | |
2991 (or | |
87448 | 2992 (vc-backend (concat directory "/" name)) |
21650 | 2993 ;; User extension |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
2994 (run-hook-with-args 'speedbar-vc-in-control-hook directory name) |
21650 | 2995 )) |
22735 | 2996 |
2997 ;; Objet File scanning | |
2998 (defun speedbar-check-objects () | |
2999 "Scan all files in a directory, and for each see if there is an object. | |
3000 See `speedbar-check-obj-this-line' and `speedbar-obj-alist' for how | |
3001 to add more object types." | |
3002 ;; Check for to-do to be reset. If reset but no RCS is available | |
3003 ;; then set to nil (do nothing) otherwise, start at the beginning | |
3004 (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3005 (if speedbar-buffer (set-buffer speedbar-buffer)) |
22735 | 3006 (if (and speedbar-obj-do-check (eq speedbar-obj-to-do-point t)) |
3007 (setq speedbar-obj-to-do-point 0)) | |
3008 (if (numberp speedbar-obj-to-do-point) | |
3009 (progn | |
3010 (goto-char speedbar-obj-to-do-point) | |
3011 (while (and (not (input-pending-p)) | |
3012 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-]\\] " | |
3013 nil t)) | |
3014 (setq speedbar-obj-to-do-point (point)) | |
3015 (let ((ind (speedbar-check-obj-this-line (match-string 1)))) | |
3016 (if (not ind) (setq ind " ")) | |
3017 (speedbar-add-indicator ind (concat | |
3018 (car speedbar-obj-indicator) | |
3019 "\\|" | |
3020 (cdr speedbar-obj-indicator))))) | |
3021 (if (input-pending-p) | |
3022 ;; return that we are incomplete | |
3023 nil | |
3024 ;; we are done, set to-do to nil | |
3025 (setq speedbar-obj-to-do-point nil) | |
3026 ;; and return t | |
3027 t)) | |
3028 t))) | |
3029 | |
3030 (defun speedbar-check-obj-this-line (depth) | |
3031 "Return t if the file on this line has an associated object. | |
3032 Parameter DEPTH is a string with the current depth of indentation of | |
3033 the file being checked." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3034 (let* ((d (string-to-number depth)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3035 (f (speedbar-line-directory d)) |
22735 | 3036 (fn (buffer-substring-no-properties |
3037 ;; Skip-chars: thanks ptype@dra.hmg.gb | |
3038 (point) (progn | |
3039 (skip-chars-forward "^ " | |
3040 (save-excursion (end-of-line) | |
3041 (point))) | |
3042 (point)))) | |
3043 (fulln (concat f fn))) | |
3044 (if (<= 2 speedbar-verbosity-level) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3045 (speedbar-message "Speedbar obj check...%s" fulln)) |
22735 | 3046 (let ((oa speedbar-obj-alist)) |
3047 (while (and oa (not (string-match (car (car oa)) fulln))) | |
3048 (setq oa (cdr oa))) | |
3049 (if (not (and oa (file-exists-p (concat (file-name-sans-extension fulln) | |
3050 (cdr (car oa)))))) | |
3051 nil | |
3052 ;; Find out if the object is out of date or not. | |
3053 (let ((date1 (nth 5 (file-attributes fulln))) | |
3054 (date2 (nth 5 (file-attributes (concat | |
3055 (file-name-sans-extension fulln) | |
3056 (cdr (car oa))))))) | |
3057 (if (or (< (car date1) (car date2)) | |
3058 (and (= (car date1) (car date2)) | |
3059 (< (nth 1 date1) (nth 1 date2)))) | |
3060 (car speedbar-obj-indicator) | |
3061 (cdr speedbar-obj-indicator))))))) | |
21650 | 3062 |
3063 ;;; Clicking Activity | |
3064 ;; | |
3065 (defun speedbar-position-cursor-on-line () | |
3066 "Position the cursor on a line." | |
3067 (let ((oldpos (point))) | |
3068 (beginning-of-line) | |
3069 (if (looking-at "[0-9]+:\\s-*..?.? ") | |
3070 (goto-char (1- (match-end 0))) | |
3071 (goto-char oldpos)))) | |
3072 | |
3073 (defun speedbar-click (e) | |
3074 "Activate any speedbar buttons where the mouse is clicked. | |
3075 This must be bound to a mouse event. A button is any location of text | |
3076 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
|
3077 Argument E is the click event." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3078 ;; Backward compatibility let statement. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3079 (let ((speedbar-power-click dframe-power-click)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3080 (speedbar-do-function-pointer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3081 (dframe-quick-mouse e)) |
21650 | 3082 |
3083 (defun speedbar-do-function-pointer () | |
3084 "Look under the cursor and examine the text properties. | |
3085 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
|
3086 a function if appropriate." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3087 (let* ((speedbar-frame (speedbar-current-frame)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3088 (fn (get-text-property (point) 'speedbar-function)) |
21650 | 3089 (tok (get-text-property (point) 'speedbar-token)) |
3090 ;; The 1-,+ is safe because scaning starts AFTER the point | |
3091 ;; specified. This lets the search include the character the | |
3092 ;; cursor is on. | |
3093 (tp (previous-single-property-change | |
3094 (1+ (point)) 'speedbar-function)) | |
3095 (np (next-single-property-change | |
3096 (point) 'speedbar-function)) | |
3097 (txt (buffer-substring-no-properties (or tp (point-min)) | |
3098 (or np (point-max)))) | |
3099 (dent (save-excursion (beginning-of-line) | |
3100 (string-to-number | |
3101 (if (looking-at "[0-9]+") | |
3102 (buffer-substring-no-properties | |
3103 (match-beginning 0) (match-end 0)) | |
3104 "0"))))) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3105 ;;(speedbar-message "%S:%S:%S:%s" fn tok txt dent) |
21650 | 3106 (and fn (funcall fn txt tok dent))) |
3107 (speedbar-position-cursor-on-line)) | |
3108 | |
3109 ;;; Reading info from the speedbar buffer | |
3110 ;; | |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3111 (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
|
3112 "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
|
3113 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
|
3114 (save-excursion |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3115 (if p (goto-char p)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3116 (beginning-of-line) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3117 (if (looking-at (concat |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3118 "\\([0-9]+\\): *[[<{]?[-+?= ][]>}@()|] \\([^ \n]+\\)")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3119 (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
|
3120 nil))) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3121 |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3122 (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
|
3123 "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
|
3124 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
|
3125 (save-excursion |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3126 (if p (goto-char p)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3127 (beginning-of-line) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3128 (if (looking-at (concat |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3129 "\\([0-9]+\\): *[[<{]?[-+?= ][]>}@()|] \\([^ \n]+\\)\\(" |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3130 speedbar-indicator-regex "\\)?")) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3131 (progn |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3132 (goto-char (match-beginning 2)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3133 (get-text-property (point) 'speedbar-token)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3134 nil))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3135 |
21650 | 3136 (defun speedbar-line-file (&optional p) |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3137 "Retrieve the file or whatever from the line at point P. |
21650 | 3138 The return value is a string representing the file. If it is a |
3139 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
|
3140 (save-match-data |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3141 (save-restriction |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3142 (widen) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3143 (let ((f (speedbar-line-text p))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3144 (if f |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3145 (let* ((depth (string-to-number (match-string 1))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3146 (directory (speedbar-line-directory depth))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3147 (if (file-exists-p (concat directory f)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3148 (concat directory f) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3149 nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3150 nil))))) |
21650 | 3151 |
3152 (defun speedbar-goto-this-file (file) | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3153 "If FILE is displayed, go to this line and return t. |
21650 | 3154 Otherwise do not move and return nil." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3155 (let ((directory (substring (file-name-directory (expand-file-name file)) |
21650 | 3156 (length (expand-file-name default-directory)))) |
3157 (dest (point))) | |
3158 (save-match-data | |
3159 (goto-char (point-min)) | |
3160 ;; scan all the directories | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3161 (while (and directory (not (eq directory t))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3162 (if (string-match "^[/\\]?\\([^/\\]+\\)" directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3163 (let ((pp (match-string 1 directory))) |
21650 | 3164 (if (save-match-data |
3165 (re-search-forward (concat "> " (regexp-quote pp) "$") | |
3166 nil t)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3167 (setq directory (substring directory (match-end 1))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3168 (setq directory nil))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3169 (setq directory t))) |
21650 | 3170 ;; find the file part |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3171 (if (or (not directory) (string= (file-name-nondirectory file) "")) |
21650 | 3172 ;; only had a dir part |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3173 (if directory |
21650 | 3174 (progn |
3175 (speedbar-position-cursor-on-line) | |
3176 t) | |
3177 (goto-char dest) nil) | |
3178 ;; find the file part | |
3179 (let ((nd (file-name-nondirectory file))) | |
3180 (if (re-search-forward | |
3181 (concat "] \\(" (regexp-quote nd) | |
22735 | 3182 "\\)\\(" speedbar-indicator-regex "\\)$") |
21650 | 3183 nil t) |
3184 (progn | |
3185 (speedbar-position-cursor-on-line) | |
3186 t) | |
3187 (goto-char dest) | |
3188 nil)))))) | |
3189 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3190 (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
|
3191 "Retrieve the directory name associated with the current line. |
21650 | 3192 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
|
3193 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
|
3194 `speedbar-mode-functions-list' as `speedbar-line-directory'." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3195 (save-restriction |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3196 (widen) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3197 (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
|
3198 (if rf (funcall rf depth) default-directory)))) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
3199 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3200 (defun speedbar-files-line-directory (&optional depth) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3201 "Retrieve the directory 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
|
3202 This may require traversing backwards from DEPTH and combining the default |
21650 | 3203 directory with these items." |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3204 (save-excursion |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3205 (save-match-data |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3206 (if (not depth) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3207 (progn |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3208 (beginning-of-line) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3209 (looking-at "^\\([0-9]+\\):") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3210 (setq depth (string-to-number (match-string 1))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3211 (let ((directory nil)) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3212 (setq depth (1- depth)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3213 (while (/= depth -1) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3214 (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
|
3215 (error "Error building filename of tag") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3216 (cond ((looking-at "[0-9]+:\\s-*<->\\s-+\\([^\n]+\\)") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3217 (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
|
3218 "/" |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3219 directory))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3220 ((looking-at "[0-9]+:\\s-*[-]\\s-+\\([^\n]+\\)") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3221 ;; This is the start of our directory. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3222 (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
|
3223 (setq depth (1- depth))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3224 (if (and directory |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3225 (string-match (concat speedbar-indicator-regex "$") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3226 directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3227 (setq directory (substring directory 0 (match-beginning 0)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3228 (concat default-directory directory))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3229 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3230 (defun speedbar-directory-line (directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3231 "Position the cursor on the line specified by DIRECTORY." |
21650 | 3232 (save-match-data |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3233 (if (string-match "[/\\]$" directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3234 (setq directory (substring directory 0 (match-beginning 0)))) |
21650 | 3235 (let ((nomatch t) (depth 0) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3236 (fname (file-name-nondirectory directory)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3237 (pname (file-name-directory directory))) |
21650 | 3238 (if (not (member pname speedbar-shown-directories)) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3239 (error "Internal Error: File %s not shown in speedbar" directory)) |
21650 | 3240 (goto-char (point-min)) |
3241 (while (and nomatch | |
3242 (re-search-forward | |
3243 (concat "[]>] \\(" (regexp-quote fname) | |
22735 | 3244 "\\)\\(" speedbar-indicator-regex "\\)?$") |
21650 | 3245 nil t)) |
3246 (beginning-of-line) | |
3247 (looking-at "\\([0-9]+\\):") | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3248 (setq depth (string-to-number (match-string 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3249 nomatch (not (string= pname (speedbar-line-directory depth)))) |
21650 | 3250 (end-of-line)) |
3251 (beginning-of-line) | |
3252 (not nomatch)))) | |
3253 | |
3254 (defun speedbar-edit-line () | |
3255 "Edit whatever tag or file is on the current speedbar line." | |
3256 (interactive) | |
3257 (or (save-excursion | |
3258 (beginning-of-line) | |
3259 ;; If this fails, then it is a non-standard click, and as such, | |
3260 ;; perfectly allowed. | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
3261 (if (re-search-forward "[]>?}] [^ ]" |
21650 | 3262 (save-excursion (end-of-line) (point)) |
3263 t) | |
53487
25ff62ff164d
(speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
3264 (progn |
25ff62ff164d
(speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
3265 (forward-char -1) |
25ff62ff164d
(speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
3266 (speedbar-do-function-pointer)) |
21650 | 3267 nil)) |
3268 (speedbar-do-function-pointer))) | |
3269 | |
28925
89a795d90175
(speedbar-recenter): Typo, and fix logic.
Eric M. Ludlam <zappo@gnu.org>
parents:
28902
diff
changeset
|
3270 (defun speedbar-expand-line (&optional arg) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3271 "Expand the line under the cursor. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3272 With universal argument ARG, flush cached data." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3273 (interactive "P") |
21650 | 3274 (beginning-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3275 (let* ((dframe-power-click arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3276 (speedbar-power-click arg)) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3277 (condition-case nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3278 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3279 (re-search-forward ":\\s-*.\\+. " |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3280 (save-excursion (end-of-line) (point))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3281 (forward-char -2) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3282 (speedbar-do-function-pointer)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3283 (error (speedbar-position-cursor-on-line))))) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
3284 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3285 (defun speedbar-flush-expand-line () |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3286 "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
|
3287 (interactive) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3288 (speedbar-expand-line 1)) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
3289 |
21650 | 3290 (defun speedbar-contract-line () |
3291 "Contract the line under the cursor." | |
3292 (interactive) | |
3293 (beginning-of-line) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3294 (condition-case nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3295 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3296 (re-search-forward ":\\s-*.-. " |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3297 (save-excursion (end-of-line) (point))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3298 (forward-char -2) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3299 (speedbar-do-function-pointer)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3300 (error (speedbar-position-cursor-on-line)))) |
21650 | 3301 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3302 (defun speedbar-toggle-line-expansion () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3303 "Contract or expand the line under the cursor." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3304 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3305 (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3306 (condition-case nil |
21650 | 3307 (progn |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3308 (re-search-forward ":\\s-*.[-+]. " |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3309 (save-excursion (end-of-line) (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3310 (forward-char -2) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3311 (speedbar-do-function-pointer)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3312 (error (speedbar-position-cursor-on-line)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3313 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3314 (defun speedbar-expand-line-descendants (&optional arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3315 "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
|
3316 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
|
3317 (interactive "P") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3318 (speedbar-expand-line arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3319 ;; 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
|
3320 ;; the same descendant type. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3321 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3322 (speedbar-next 1) ;; Move into the list. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3323 (let ((err nil)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3324 (while (not err) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3325 (condition-case nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3326 (progn |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3327 (speedbar-expand-line-descendants arg) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3328 (speedbar-restricted-next 1)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3329 (error (setq err t)))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3330 ) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3331 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3332 (defun speedbar-contract-line-descendants () |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3333 "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
|
3334 (interactive) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3335 (speedbar-contract-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3336 ;; 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
|
3337 ;; hidden by default anyway. Yay! It's easy. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3338 ) |
21650 | 3339 |
3340 (defun speedbar-find-file (text token indent) | |
3341 "Speedbar click handler for filenames. | |
3342 TEXT, the file will be displayed in the attached frame. | |
3343 TOKEN is unused, but required by the click handler. INDENT is the | |
3344 current indentation level." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3345 (let ((cdd (speedbar-line-directory indent))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3346 ;; Run before visiting file hook here. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3347 (let ((f (selected-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3348 (dframe-select-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3349 (run-hooks 'speedbar-before-visiting-file-hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3350 (select-frame f)) |
21650 | 3351 (speedbar-find-file-in-frame (concat cdd text)) |
3352 (speedbar-stealthy-updates) | |
3353 (run-hooks 'speedbar-visiting-file-hook) | |
3354 ;; Reset the timer with a new timeout when cliking a file | |
3355 ;; in case the user was navigating directories, we can cancel | |
3356 ;; that other timer. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3357 (speedbar-set-timer dframe-update-speed)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3358 (dframe-maybee-jump-to-attached-frame)) |
21650 | 3359 |
3360 (defun speedbar-dir-follow (text token indent) | |
3361 "Speedbar click handler for directory names. | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3362 Clicking a directory will cause the speedbar to list files in |
21650 | 3363 the subdirectory TEXT. TOKEN is an unused requirement. The |
3364 subdirectory chosen will be at INDENT level." | |
3365 (setq default-directory | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3366 (concat (expand-file-name (concat (speedbar-line-directory indent) text)) |
21650 | 3367 "/")) |
3368 ;; Because we leave speedbar as the current buffer, | |
3369 ;; update contents will change directory without | |
22735 | 3370 ;; having to touch the attached frame. Turn off smart expand just |
3371 ;; in case. | |
3372 (let ((speedbar-smart-directory-expand-flag nil)) | |
3373 (speedbar-update-contents)) | |
21650 | 3374 (speedbar-set-timer speedbar-navigating-speed) |
3375 (setq speedbar-last-selected-file nil) | |
3376 (speedbar-stealthy-updates)) | |
3377 | |
3378 (defun speedbar-delete-subblock (indent) | |
3379 "Delete text from point to indentation level INDENT or greater. | |
3380 Handles end-of-sublist smartly." | |
3381 (speedbar-with-writable | |
23917
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3382 (save-excursion |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3383 (end-of-line) (forward-char 1) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3384 (let ((start (point))) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3385 (while (and (looking-at "^\\([0-9]+\\):") |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3386 (> (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
|
3387 (not (eobp))) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3388 (forward-line 1) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3389 (beginning-of-line)) |
4182d24c6d9f
(speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents:
23372
diff
changeset
|
3390 (delete-region start (point)))))) |
21650 | 3391 |
3392 (defun speedbar-dired (text token indent) | |
3393 "Speedbar click handler for directory expand button. | |
3394 Clicking this button expands or contracts a directory. TEXT is the | |
3395 button clicked which has either a + or -. TOKEN is the directory to be | |
3396 expanded. INDENT is the current indentation level." | |
3397 (cond ((string-match "+" text) ;we have to expand this dir | |
3398 (setq speedbar-shown-directories | |
3399 (cons (expand-file-name | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3400 (concat (speedbar-line-directory indent) token "/")) |
21650 | 3401 speedbar-shown-directories)) |
3402 (speedbar-change-expand-button-char ?-) | |
3403 (speedbar-reset-scanners) | |
3404 (save-excursion | |
3405 (end-of-line) (forward-char 1) | |
3406 (speedbar-with-writable | |
3407 (speedbar-default-directory-list | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3408 (concat (speedbar-line-directory indent) token "/") |
21650 | 3409 (1+ indent))))) |
3410 ((string-match "-" text) ;we have to contract this node | |
3411 (speedbar-reset-scanners) | |
3412 (let ((oldl speedbar-shown-directories) | |
3413 (newl nil) | |
3414 (td (expand-file-name | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3415 (concat (speedbar-line-directory indent) token)))) |
21650 | 3416 (while oldl |
3417 (if (not (string-match (concat "^" (regexp-quote td)) (car oldl))) | |
3418 (setq newl (cons (car oldl) newl))) | |
3419 (setq oldl (cdr oldl))) | |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3420 (setq speedbar-shown-directories (nreverse newl))) |
21650 | 3421 (speedbar-change-expand-button-char ?+) |
3422 (speedbar-delete-subblock indent) | |
3423 ) | |
22735 | 3424 (t (error "Ooops... not sure what to do"))) |
21650 | 3425 (speedbar-center-buffer-smartly) |
3426 (save-excursion (speedbar-stealthy-updates))) | |
3427 | |
3428 (defun speedbar-directory-buttons-follow (text token indent) | |
3429 "Speedbar click handler for default directory buttons. | |
3430 TEXT is the button clicked on. TOKEN is the directory to follow. | |
3431 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
|
3432 (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
|
3433 (setq default-directory (concat token "/")) |
22735 | 3434 (setq default-directory token)) |
21650 | 3435 ;; Because we leave speedbar as the current buffer, |
3436 ;; update contents will change directory without | |
3437 ;; having to touch the attached frame. | |
3438 (speedbar-update-contents) | |
3439 (speedbar-set-timer speedbar-navigating-speed)) | |
3440 | |
3441 (defun speedbar-tag-file (text token indent) | |
3442 "The cursor is on a selected line. Expand the tags in the specified file. | |
3443 The parameter TEXT and TOKEN are required, where TEXT is the button | |
3444 clicked, and TOKEN is the file to expand. INDENT is the current | |
3445 indentation level." | |
3446 (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
|
3447 (let* ((fn (expand-file-name (concat (speedbar-line-directory indent) |
21650 | 3448 token))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3449 (mode nil) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3450 (lst (speedbar-fetch-dynamic-tags fn))) |
21650 | 3451 ;; if no list, then remove expando button |
3452 (if (not lst) | |
3453 (speedbar-change-expand-button-char ??) | |
3454 (speedbar-change-expand-button-char ?-) | |
3455 (speedbar-with-writable | |
3456 (save-excursion | |
3457 (end-of-line) (forward-char 1) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3458 (funcall (car lst) indent (cdr lst))))))) |
21650 | 3459 ((string-match "-" text) ;we have to contract this node |
3460 (speedbar-change-expand-button-char ?+) | |
3461 (speedbar-delete-subblock indent)) | |
22735 | 3462 (t (error "Ooops... not sure what to do"))) |
21650 | 3463 (speedbar-center-buffer-smartly)) |
3464 | |
3465 (defun speedbar-tag-find (text token indent) | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3466 "For the tag TEXT in a file TOKEN, go to that position. |
21650 | 3467 INDENT is the current indentation level." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3468 (let ((file (speedbar-line-directory indent))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3469 (let ((f (selected-frame))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3470 (dframe-select-attached-frame speedbar-frame) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3471 (run-hooks 'speedbar-before-visiting-tag-hook) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3472 (select-frame f)) |
21650 | 3473 (speedbar-find-file-in-frame file) |
3474 (save-excursion (speedbar-stealthy-updates)) | |
3475 ;; Reset the timer with a new timeout when cliking a file | |
3476 ;; in case the user was navigating directories, we can cancel | |
3477 ;; that other timer. | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3478 (speedbar-set-timer dframe-update-speed) |
21650 | 3479 (goto-char token) |
3480 (run-hooks 'speedbar-visiting-tag-hook) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3481 (dframe-maybee-jump-to-attached-frame) |
21650 | 3482 )) |
3483 | |
3484 (defun speedbar-tag-expand (text token indent) | |
3485 "Expand a tag sublist. Imenu will return sub-lists of specialized tag types. | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3486 Etags does not support this feature. TEXT will be the button string. |
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3487 TOKEN will be the list, and INDENT is the current indentation level." |
21650 | 3488 (cond ((string-match "+" text) ;we have to expand this file |
3489 (speedbar-change-expand-button-char ?-) | |
3490 (speedbar-with-writable | |
3491 (save-excursion | |
3492 (end-of-line) (forward-char 1) | |
22735 | 3493 (speedbar-insert-generic-list indent token 'speedbar-tag-expand |
21650 | 3494 'speedbar-tag-find)))) |
3495 ((string-match "-" text) ;we have to contract this node | |
3496 (speedbar-change-expand-button-char ?+) | |
3497 (speedbar-delete-subblock indent)) | |
22735 | 3498 (t (error "Ooops... not sure what to do"))) |
21650 | 3499 (speedbar-center-buffer-smartly)) |
3500 | |
3501 ;;; Loading files into the attached frame. | |
3502 ;; | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3503 (defcustom speedbar-select-frame-method 'attached |
100171 | 3504 "Specify how to select a frame for displaying a file. |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3505 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
|
3506 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
|
3507 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
|
3508 :group 'speedbar |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3509 :type 'sexp) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3510 |
21650 | 3511 (defun speedbar-find-file-in-frame (file) |
3512 "This will load FILE into the speedbar attached frame. | |
3513 If the file is being displayed in a different frame already, then raise that | |
3514 frame instead." | |
3515 (let* ((buff (find-file-noselect file)) | |
3516 (bwin (get-buffer-window buff 0))) | |
3517 (if bwin | |
3518 (progn | |
3519 (select-window bwin) | |
3520 (raise-frame (window-frame bwin))) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3521 (if dframe-power-click |
21650 | 3522 (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
|
3523 (if (numberp speedbar-select-frame-method) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3524 (other-frame speedbar-select-frame-method) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3525 (dframe-select-attached-frame speedbar-frame)) |
21650 | 3526 (switch-to-buffer buff)))) |
22735 | 3527 ) |
21650 | 3528 |
3529 ;;; Centering Utility | |
3530 ;; | |
3531 (defun speedbar-center-buffer-smartly () | |
3532 "Recenter a speedbar buffer so the current indentation level is all visible. | |
3533 This assumes that the cursor is on a file, or tag of a file which the user is | |
3534 interested in." | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3535 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3536 (save-selected-window |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
3537 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3538 (select-window (get-buffer-window speedbar-buffer t)) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
3539 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3540 (set-buffer speedbar-buffer) |
78055
e49170723831
(speedbar-handle-delete-frame): Don't try to delete the speedbar frame if nil;
Juanma Barranquero <lekktu@gmail.com>
parents:
76017
diff
changeset
|
3541 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3542 (if (<= (count-lines (point-min) (point-max)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3543 (1- (window-height (selected-window)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3544 ;; whole buffer fits |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3545 (let ((cp (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3546 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3547 (goto-char (point-min)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3548 (recenter 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3549 (goto-char cp)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3550 ;; too big |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3551 (let (depth start end exp p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3552 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3553 (beginning-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3554 (setq depth (if (looking-at "[0-9]+") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3555 (string-to-number (buffer-substring-no-properties |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3556 (match-beginning 0) (match-end 0))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3557 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3558 (setq exp (format "^%d:" depth))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3559 (save-excursion |
21650 | 3560 (end-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3561 (if (re-search-backward exp nil t) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3562 (setq start (point)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3563 (setq start (point-min))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3564 (save-excursion ;Not sure about this part. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3565 (end-of-line) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3566 (setq p (point)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3567 (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
|
3568 (>= depth 0)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3569 (setq depth (1- depth)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3570 (setq exp (format "^%d:" depth))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3571 (if (/= (point) p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3572 (setq end (point)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3573 (setq end (point-max))))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3574 ;; Now work out the details of centering |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3575 (let ((nl (count-lines start end)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3576 (wl (1- (window-height (selected-window)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3577 (cp (point))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3578 (if (> nl wl) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3579 ;; 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
|
3580 (progn (goto-char start) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3581 (recenter 1)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3582 ;; we can fit everything on the screen, but... |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3583 (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
|
3584 (pos-visible-in-window-p end (selected-window))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3585 ;; we are all set! |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3586 nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3587 ;; we need to do something... |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3588 (goto-char start) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3589 (let ((newcent (/ (- (window-height (selected-window)) nl) 2)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3590 (lte (count-lines start (point-max)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3591 (if (and (< (+ newcent lte) (window-height (selected-window))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3592 (> (- (window-height (selected-window)) lte 1) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3593 newcent)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3594 (setq newcent (- (window-height (selected-window)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3595 lte 1))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3596 (recenter newcent)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3597 (goto-char cp)))))) |
21650 | 3598 |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3599 ;;; Tag Management -- List of expanders: |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3600 ;; |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3601 (defun speedbar-fetch-dynamic-tags (file) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3602 "Return a list of tags generated dynamically from FILE. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3603 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
|
3604 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
|
3605 functions to do caching and flushing if appropriate." |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3606 (save-excursion |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3607 ;; 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
|
3608 ;; 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
|
3609 ;; 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
|
3610 ;; opening the file. |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3611 (if (get-file-buffer file) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3612 (set-buffer (get-file-buffer file))) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3613 ;; If there is a buffer-local value of |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3614 ;; 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
|
3615 (let ((dtf speedbar-dynamic-tags-function-list) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3616 (ret t)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3617 (while (and (eq ret t) dtf) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3618 (setq ret |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3619 (if (fboundp (car (car dtf))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3620 (funcall (car (car dtf)) file) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3621 t)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3622 (if (eq ret t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3623 (setq dtf (cdr dtf)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3624 (if (eq ret t) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3625 ;; No valid tag list, return nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3626 nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3627 ;; 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
|
3628 ;; prepended |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3629 (cons (cdr (car dtf)) ret))))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3630 |
21650 | 3631 ;;; Tag Management -- Imenu |
3632 ;; | |
3633 (if (not speedbar-use-imenu-flag) | |
3634 | |
3635 nil | |
3636 | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
3637 (eval-when-compile (condition-case nil (require 'imenu) (error nil))) |
21650 | 3638 |
3639 (defun speedbar-fetch-dynamic-imenu (file) | |
3640 "Load FILE into a buffer, and generate tags using Imenu. | |
3641 Returns the tag list, or t for an error." | |
3642 ;; Load this AND compile it in | |
3643 (require 'imenu) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3644 (set-buffer (find-file-noselect file)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3645 (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
|
3646 (condition-case nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3647 (let ((index-alist (imenu--make-index-alist t))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3648 (if speedbar-sort-tags |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3649 (sort (copy-alist index-alist) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3650 (lambda (a b) (string< (car a) (car b)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3651 index-alist)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3652 (error t))) |
21650 | 3653 ) |
3654 | |
3655 ;;; Tag Management -- etags (old XEmacs compatibility part) | |
3656 ;; | |
3657 (defvar speedbar-fetch-etags-parse-list | |
3658 '(;; 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
|
3659 ("\\.\\([cChH]\\|c\\+\\+\\|cpp\\|cc\\|hh\\|java\\|cxx\\|hxx\\)\\'" . |
21650 | 3660 speedbar-parse-c-or-c++tag) |
3661 ("^\\.emacs$\\|.\\(el\\|l\\|lsp\\)\\'" . | |
3662 "def[^i]+\\s-+\\(\\(\\w\\|[-_]\\)+\\)\\s-*\C-?") | |
22735 | 3663 ; ("\\.\\([fF]\\|for\\|FOR\\|77\\|90\\)\\'" . |
3664 ; speedbar-parse-fortran77-tag) | |
21650 | 3665 ("\\.tex\\'" . speedbar-parse-tex-string) |
3666 ("\\.p\\'" . | |
3667 "\\(\\(FUNCTION\\|function\\|PROCEDURE\\|procedure\\)\\s-+\\([a-zA-Z0-9_.:]+\\)\\)\\s-*(?^?") | |
3668 ) | |
3669 "Associations of file extensions and expressions for extracting tags. | |
3670 To add a new file type, you would want to add a new association to the | |
3671 list, where the car is the file match, and the cdr is the way to | |
3672 extract an element from the tags output. If the output is complex, | |
3673 use a function symbol instead of regexp. The function should expect | |
3674 to be at the beginning of a line in the etags buffer. | |
3675 | |
3676 This variable is ignored if `speedbar-use-imenu-flag' is non-nil.") | |
3677 | |
3678 (defvar speedbar-fetch-etags-command "etags" | |
3679 "*Command used to create an etags file. | |
3680 | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3681 This variable is ignored if `speedbar-use-imenu-flag' is t.") |
21650 | 3682 |
3683 (defvar speedbar-fetch-etags-arguments '("-D" "-I" "-o" "-") | |
3684 "*List of arguments to use with `speedbar-fetch-etags-command'. | |
3685 This creates an etags output buffer. Use `speedbar-toggle-etags' to | |
3686 modify this list conveniently. | |
3687 | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3688 This variable is ignored if `speedbar-use-imenu-flag' is t.") |
21650 | 3689 |
3690 (defun speedbar-toggle-etags (flag) | |
3691 "Toggle FLAG in `speedbar-fetch-etags-arguments'. | |
3692 FLAG then becomes a member of etags command line arguments. If flag | |
3693 is \"sort\", then toggle the value of `speedbar-sort-tags'. If its | |
3694 value is \"show\" then toggle the value of | |
3695 `speedbar-show-unknown-files'. | |
3696 | |
3697 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
|
3698 Farzin Guilak <farzin@protocol.com>." |
21650 | 3699 (interactive) |
3700 (cond | |
3701 ((equal flag "sort") | |
3702 (setq speedbar-sort-tags (not speedbar-sort-tags))) | |
3703 ((equal flag "show") | |
3704 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files))) | |
3705 ((or (equal flag "-C") | |
3706 (equal flag "-S") | |
3707 (equal flag "-D")) | |
3708 (if (member flag speedbar-fetch-etags-arguments) | |
3709 (setq speedbar-fetch-etags-arguments | |
3710 (delete flag speedbar-fetch-etags-arguments)) | |
3711 (add-to-list 'speedbar-fetch-etags-arguments flag))) | |
3712 (t nil))) | |
3713 | |
3714 (defun speedbar-fetch-dynamic-etags (file) | |
3715 "For FILE, run etags and create a list of symbols extracted. | |
3716 Each symbol will be associated with its line position in FILE." | |
3717 (let ((newlist nil)) | |
3718 (unwind-protect | |
3719 (save-excursion | |
3720 (if (get-buffer "*etags tmp*") | |
3721 (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
|
3722 (if (<= 1 speedbar-verbosity-level) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3723 (speedbar-message "Fetching etags...")) |
21650 | 3724 (set-buffer (get-buffer-create "*etags tmp*")) |
3725 (apply 'call-process speedbar-fetch-etags-command nil | |
3726 (current-buffer) nil | |
3727 (append speedbar-fetch-etags-arguments (list file))) | |
3728 (goto-char (point-min)) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3729 (if (<= 1 speedbar-verbosity-level) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3730 (speedbar-message "Fetching etags...")) |
21650 | 3731 (let ((expr |
3732 (let ((exprlst speedbar-fetch-etags-parse-list) | |
3733 (ans nil)) | |
3734 (while (and (not ans) exprlst) | |
3735 (if (string-match (car (car exprlst)) file) | |
3736 (setq ans (car exprlst))) | |
3737 (setq exprlst (cdr exprlst))) | |
3738 (cdr ans)))) | |
3739 (if expr | |
3740 (let (tnl) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3741 (set-buffer (get-buffer-create "*etags tmp*")) |
21650 | 3742 (while (not (save-excursion (end-of-line) (eobp))) |
3743 (save-excursion | |
3744 (setq tnl (speedbar-extract-one-symbol expr))) | |
3745 (if tnl (setq newlist (cons tnl newlist))) | |
3746 (forward-line 1))) | |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3747 (speedbar-message |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3748 "Sorry, no support for a file of that extension")))) |
21650 | 3749 ) |
3750 (if speedbar-sort-tags | |
3751 (sort newlist (lambda (a b) (string< (car a) (car b)))) | |
3752 (reverse newlist)))) | |
3753 | |
3754 ;; This bit donated by Farzin Guilak <farzin@protocol.com> but I'm not | |
3755 ;; sure it's needed with the different sorting method. | |
3756 ;; | |
3757 ;(defun speedbar-clean-etags() | |
3758 ; "Removes spaces before the ^? character, and removes `#define', | |
3759 ;return types, etc. preceding tags. This ensures that the sort operation | |
3760 ;works on the tags, not the return types." | |
3761 ; (save-excursion | |
3762 ; (goto-char (point-min)) | |
3763 ; (while | |
3764 ; (re-search-forward "(?[ \t](?\C-?" nil t) | |
3765 ; (replace-match "\C-?" nil nil)) | |
3766 ; (goto-char (point-min)) | |
3767 ; (while | |
3768 ; (re-search-forward "\\(.*[ \t]+\\)\\([^ \t\n]+.*\C-?\\)" nil t) | |
3769 ; (delete-region (match-beginning 1) (match-end 1))))) | |
3770 | |
3771 (defun speedbar-extract-one-symbol (expr) | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3772 "At point, return nil, or one alist in the form (SYMBOL . POSITION). |
21650 | 3773 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
|
3774 regular expression EXPR." |
21650 | 3775 (let* ((sym (if (stringp expr) |
3776 (if (save-excursion | |
3777 (re-search-forward expr (save-excursion | |
3778 (end-of-line) | |
3779 (point)) t)) | |
3780 (buffer-substring-no-properties (match-beginning 1) | |
3781 (match-end 1))) | |
3782 (funcall expr))) | |
3783 (pos (let ((j (re-search-forward "[\C-?\C-a]\\([0-9]+\\),\\([0-9]+\\)" | |
3784 (save-excursion | |
3785 (end-of-line) | |
3786 (point)) | |
3787 t))) | |
3788 (if (and j sym) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3789 (1+ (string-to-number (buffer-substring-no-properties |
21650 | 3790 (match-beginning 2) |
3791 (match-end 2)))) | |
3792 0)))) | |
3793 (if (/= pos 0) | |
3794 (cons sym pos) | |
3795 nil))) | |
3796 | |
3797 (defun speedbar-parse-c-or-c++tag () | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
3798 "Parse a C or C++ tag, which tends to be a little complex." |
21650 | 3799 (save-excursion |
3800 (let ((bound (save-excursion (end-of-line) (point)))) | |
3801 (cond ((re-search-forward "\C-?\\([^\C-a]+\\)\C-a" bound t) | |
3802 (buffer-substring-no-properties (match-beginning 1) | |
3803 (match-end 1))) | |
3804 ((re-search-forward "\\<\\([^ \t]+\\)\\s-+new(" bound t) | |
3805 (buffer-substring-no-properties (match-beginning 1) | |
3806 (match-end 1))) | |
3807 ((re-search-forward "\\<\\([^ \t(]+\\)\\s-*(\C-?" bound t) | |
3808 (buffer-substring-no-properties (match-beginning 1) | |
3809 (match-end 1))) | |
3810 (t nil)) | |
3811 ))) | |
3812 | |
3813 (defun speedbar-parse-tex-string () | |
3814 "Parse a Tex string. Only find data which is relevant." | |
3815 (save-excursion | |
3816 (let ((bound (save-excursion (end-of-line) (point)))) | |
3817 (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t) | |
3818 (buffer-substring-no-properties (match-beginning 0) | |
3819 (match-end 0))) | |
3820 (t nil))))) | |
3821 | |
3822 | |
22735 | 3823 ;;; BUFFER DISPLAY mode. |
3824 ;; | |
3825 (defvar speedbar-buffers-key-map nil | |
3826 "Keymap used when in the buffers display mode.") | |
3827 | |
3828 (if speedbar-buffers-key-map | |
3829 nil | |
3830 (setq speedbar-buffers-key-map (speedbar-make-specialized-keymap)) | |
3831 | |
3832 ;; Basic tree features | |
3833 (define-key speedbar-buffers-key-map "e" 'speedbar-edit-line) | |
3834 (define-key speedbar-buffers-key-map "\C-m" 'speedbar-edit-line) | |
3835 (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
|
3836 (define-key speedbar-buffers-key-map "=" 'speedbar-expand-line) |
22735 | 3837 (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
|
3838 (define-key speedbar-buffers-key-map " " 'speedbar-toggle-line-expansion) |
22735 | 3839 |
3840 ;; Buffer specific keybindings | |
3841 (define-key speedbar-buffers-key-map "k" 'speedbar-buffer-kill-buffer) | |
3842 (define-key speedbar-buffers-key-map "r" 'speedbar-buffer-revert-buffer) | |
3843 | |
3844 ) | |
3845 | |
3846 (defvar speedbar-buffer-easymenu-definition | |
3847 '(["Jump to buffer" speedbar-edit-line t] | |
3848 ["Expand File Tags" speedbar-expand-line | |
3849 (save-excursion (beginning-of-line) | |
3850 (looking-at "[0-9]+: *.\\+. "))] | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3851 ["Flush Cache & Expand" speedbar-flush-expand-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3852 (save-excursion (beginning-of-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3853 (looking-at "[0-9]+: *.\\+. "))] |
22735 | 3854 ["Contract File Tags" speedbar-contract-line |
3855 (save-excursion (beginning-of-line) | |
3856 (looking-at "[0-9]+: *.-. "))] | |
66163
ce5979f4b405
(speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents:
65949
diff
changeset
|
3857 "----" |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3858 ["Kill Buffer" speedbar-buffer-kill-buffer |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3859 (save-excursion (beginning-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3860 (looking-at "[0-9]+: *.[-+?]. "))] |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3861 ["Revert Buffer" speedbar-buffer-revert-buffer |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3862 (save-excursion (beginning-of-line) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3863 (looking-at "[0-9]+: *.[-+?]. "))] |
22735 | 3864 ) |
3865 "Menu item elements shown when displaying a buffer list.") | |
3866 | |
3867 (defun speedbar-buffer-buttons (directory zero) | |
3868 "Create speedbar buttons based on the buffers currently loaded. | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3869 DIRECTORY is the directory of the currently active buffer, and ZERO is 0." |
22735 | 3870 (speedbar-buffer-buttons-engine nil)) |
3871 | |
3872 (defun speedbar-buffer-buttons-temp (directory zero) | |
3873 "Create speedbar buttons based on the buffers currently loaded. | |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3874 DIRECTORY is the directory of the currently active buffer, and ZERO is 0." |
22735 | 3875 (speedbar-buffer-buttons-engine t)) |
3876 | |
3877 (defun speedbar-buffer-buttons-engine (temp) | |
3878 "Create speedbar buffer buttons. | |
3879 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
|
3880 (speedbar-insert-separator "Active Buffers:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3881 (let ((bl (buffer-list)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3882 (case-fold-search t)) |
22735 | 3883 (while bl |
3884 (if (string-match "^[ *]" (buffer-name (car bl))) | |
3885 nil | |
3886 (let* ((known (string-match speedbar-file-regexp | |
3887 (buffer-name (car bl)))) | |
3888 (expchar (if known ?+ ??)) | |
3889 (fn (if known 'speedbar-tag-file nil)) | |
3890 (fname (save-excursion (set-buffer (car bl)) | |
3891 (buffer-file-name)))) | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3892 (speedbar-make-tag-line 'bracket expchar fn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
3893 (if fname (file-name-nondirectory fname)) |
22735 | 3894 (buffer-name (car bl)) |
3895 'speedbar-buffer-click temp | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3896 'speedbar-file-face 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3897 (speedbar-buffers-tail-notes (car bl)))) |
22735 | 3898 (setq bl (cdr bl))) |
3899 (setq bl (buffer-list)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3900 (speedbar-insert-separator "Scratch Buffers:") |
22735 | 3901 (while bl |
3902 (if (not (string-match "^\\*" (buffer-name (car bl)))) | |
3903 nil | |
3904 (if (eq (car bl) speedbar-buffer) | |
3905 nil | |
3906 (speedbar-make-tag-line 'bracket ?? nil nil | |
3907 (buffer-name (car bl)) | |
3908 'speedbar-buffer-click temp | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3909 'speedbar-file-face 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3910 (speedbar-buffers-tail-notes (car bl)))) |
22735 | 3911 (setq bl (cdr bl))) |
3912 (setq bl (buffer-list)) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3913 ;;(speedbar-insert-separator "Hidden Buffers:") |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3914 ;;(while bl |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3915 ;; (if (not (string-match "^ " (buffer-name (car bl)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3916 ;; nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3917 ;; (if (eq (car bl) speedbar-buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3918 ;; nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3919 ;; (speedbar-make-tag-line 'bracket ?? nil nil |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3920 ;; (buffer-name (car bl)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3921 ;; 'speedbar-buffer-click temp |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3922 ;; 'speedbar-file-face 0) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3923 ;; (speedbar-buffers-tail-notes (car bl)))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3924 ;; (setq bl (cdr bl))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3925 )) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3926 |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3927 (defun speedbar-buffers-tail-notes (buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3928 "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
|
3929 Argument BUFFER is the buffer being tested." |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3930 (let (mod ro) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3931 (save-excursion |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3932 (set-buffer buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3933 (setq mod (buffer-modified-p) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3934 ro buffer-read-only)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3935 (if ro (speedbar-insert-button "%" nil nil nil nil t)))) |
22735 | 3936 |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3937 (defun speedbar-buffers-item-info () |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3938 "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
|
3939 (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
|
3940 (let* ((item (speedbar-line-text)) |
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3941 (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
|
3942 (and buffer |
24475
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3943 (speedbar-message "%s%s %S %d %s" |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3944 (if (buffer-modified-p buffer) "* " "") |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3945 item |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3946 (save-excursion (set-buffer buffer) major-mode) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3947 (save-excursion (set-buffer buffer) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3948 (buffer-size)) |
1e20dcb26ff7
Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents:
24321
diff
changeset
|
3949 (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
|
3950 |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3951 (defun speedbar-buffers-line-directory (&optional depth) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
3952 "Fetch the directory of 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
|
3953 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
|
3954 (save-excursion |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3955 (end-of-line) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3956 (let ((start (point))) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3957 ;; Buffers are always at level 0 |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3958 (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
|
3959 nil |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3960 (let* ((bn (speedbar-line-text)) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3961 (buffer (if bn (get-buffer bn)))) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3962 (if buffer |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3963 (if (save-excursion |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3964 (end-of-line) |
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3965 (eq start (point))) |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3966 (or (save-excursion (set-buffer buffer) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3967 default-directory) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3968 "") |
36047
e1126269be53
(speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents:
31562
diff
changeset
|
3969 (buffer-file-name buffer)))))))) |
24154
91c00b394901
(speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents:
23917
diff
changeset
|
3970 |
22735 | 3971 (defun speedbar-buffer-click (text token indent) |
3972 "When the users clicks on a buffer-button in speedbar. | |
3973 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
|
3974 (if dframe-power-click |
22735 | 3975 (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
|
3976 (dframe-select-attached-frame speedbar-frame) |
22735 | 3977 (switch-to-buffer text) |
3978 (if token (speedbar-change-initial-expansion-list | |
3979 speedbar-previously-used-expansion-list-name)))) | |
3980 | |
3981 (defun speedbar-buffer-kill-buffer () | |
3982 "Kill the buffer the cursor is on in the speedbar buffer." | |
3983 (interactive) | |
3984 (or (save-excursion | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3985 (let ((text (speedbar-line-text))) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3986 (if (and (get-buffer text) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3987 (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
|
3988 (kill-buffer text)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
3989 (speedbar-refresh))))) |
22735 | 3990 |
3991 (defun speedbar-buffer-revert-buffer () | |
3992 "Revert the buffer the cursor is on in the speedbar buffer." | |
3993 (interactive) | |
3994 (save-excursion | |
3995 (beginning-of-line) | |
3996 ;; If this fails, then it is a non-standard click, and as such, | |
3997 ;; perfectly allowed | |
22950
606be1490be7
(speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents:
22906
diff
changeset
|
3998 (if (re-search-forward "[]>?}] [^ ]" |
22735 | 3999 (save-excursion (end-of-line) (point)) |
4000 t) | |
4001 (let ((text (progn | |
4002 (forward-char -1) | |
4003 (buffer-substring (point) (save-excursion | |
4004 (end-of-line) | |
4005 (point)))))) | |
4006 (if (get-buffer text) | |
4007 (progn | |
4008 (set-buffer text) | |
4009 (revert-buffer t))))))) | |
4010 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4011 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4012 ;;; Useful hook values and such. |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4013 ;; |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4014 (defvar speedbar-highlight-one-tag-line nil |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4015 "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
|
4016 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4017 (defun speedbar-highlight-one-tag-line () |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4018 "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
|
4019 (speedbar-unhighlight-one-tag-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4020 (setq speedbar-highlight-one-tag-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4021 (speedbar-make-overlay (save-excursion (beginning-of-line) (point)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4022 (save-excursion (end-of-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4023 (forward-char 1) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4024 (point)))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4025 (speedbar-overlay-put speedbar-highlight-one-tag-line 'face |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4026 'speedbar-highlight-face) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4027 (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
|
4028 ) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4029 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4030 (defun speedbar-unhighlight-one-tag-line () |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
4031 "Unhighlight the currently highlighted line." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4032 (if speedbar-highlight-one-tag-line |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4033 (progn |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4034 (speedbar-delete-overlay speedbar-highlight-one-tag-line) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4035 (setq speedbar-highlight-one-tag-line nil))) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4036 (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
|
4037 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4038 (defun speedbar-recenter-to-top () |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
4039 "Recenter the current buffer so point is on the top of the window." |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4040 (recenter 1)) |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4041 |
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4042 (defun speedbar-recenter () |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
4043 "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
|
4044 (recenter (/ (window-height (selected-window)) 2))) |
22735 | 4045 |
4046 | |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4047 ;;; Color loading section. |
21650 | 4048 ;; |
4049 (defface speedbar-button-face '((((class color) (background light)) | |
4050 (:foreground "green4")) | |
4051 (((class color) (background dark)) | |
4052 (:foreground "green3"))) | |
4053 "Face used for +/- buttons." | |
4054 :group 'speedbar-faces) | |
4055 | |
4056 (defface speedbar-file-face '((((class color) (background light)) | |
4057 (:foreground "cyan4")) | |
4058 (((class color) (background dark)) | |
4059 (:foreground "cyan")) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4060 (t (:bold t))) |
21650 | 4061 "Face used for file names." |
4062 :group 'speedbar-faces) | |
4063 | |
4064 (defface speedbar-directory-face '((((class color) (background light)) | |
4065 (:foreground "blue4")) | |
4066 (((class color) (background dark)) | |
4067 (:foreground "light blue"))) | |
46282
015a7038f5db
(speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
44584
diff
changeset
|
4068 "Face used for directory names." |
21650 | 4069 :group 'speedbar-faces) |
4070 (defface speedbar-tag-face '((((class color) (background light)) | |
4071 (:foreground "brown")) | |
4072 (((class color) (background dark)) | |
4073 (:foreground "yellow"))) | |
4074 "Face used for displaying tags." | |
4075 :group 'speedbar-faces) | |
4076 | |
4077 (defface speedbar-selected-face '((((class color) (background light)) | |
4078 (:foreground "red" :underline t)) | |
4079 (((class color) (background dark)) | |
4080 (:foreground "red" :underline t)) | |
4081 (t (:underline t))) | |
4082 "Face used to underline the file in the active window." | |
4083 :group 'speedbar-faces) | |
4084 | |
4085 (defface speedbar-highlight-face '((((class color) (background light)) | |
4086 (:background "green")) | |
4087 (((class color) (background dark)) | |
4088 (:background "sea green")) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4089 (((class grayscale monochrome) |
21650 | 4090 (background light)) |
4091 (:background "black")) | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4092 (((class grayscale monochrome) |
21650 | 4093 (background dark)) |
4094 (:background "white"))) | |
4095 "Face used for highlighting buttons with the mouse." | |
4096 :group 'speedbar-faces) | |
4097 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4098 (defface speedbar-separator-face '((((class color) (background light)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4099 (:background "blue" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4100 :foreground "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4101 :overline "gray")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4102 (((class color) (background dark)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4103 (:background "blue" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4104 :foreground "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4105 :overline "gray")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4106 (((class grayscale monochrome) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4107 (background light)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4108 (:background "black" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4109 :foreground "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4110 :overline "white")) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4111 (((class grayscale monochrome) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4112 (background dark)) |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4113 (:background "white" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4114 :foreground "black" |
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4115 :overline "black"))) |
94291
171ae2941bb8
(speedbar-use-tool-tips-flag, speedbar-ignored-directory-regexp,
Juanma Barranquero <lekktu@gmail.com>
parents:
94277
diff
changeset
|
4116 "Face used for separator labels in a display." |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4117 :group 'speedbar-faces) |
28902
5292e9f1f2ca
Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents:
26659
diff
changeset
|
4118 |
21650 | 4119 ;; some edebug hooks |
4120 (add-hook 'edebug-setup-hook | |
4121 (lambda () | |
4122 (def-edebug-spec speedbar-with-writable def-body))) | |
4123 | |
65752
12e5c2513853
* speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
65296
diff
changeset
|
4124 ;; Fix a font lock problem for some versions of Emacs |
101922
8074f7b69818
Avoid messing up font-lock-global-modes.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
4125 (and (boundp 'font-lock-global-modes) |
8074f7b69818
Avoid messing up font-lock-global-modes.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
4126 font-lock-global-modes |
8074f7b69818
Avoid messing up font-lock-global-modes.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
4127 (if (eq font-lock-global-modes t) |
8074f7b69818
Avoid messing up font-lock-global-modes.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
4128 (setq font-lock-global-modes '(not speedbar-mode)) |
8074f7b69818
Avoid messing up font-lock-global-modes.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
4129 (if (eq (car font-lock-global-modes) 'not) |
101923
50624469b15a
Fix stupidity in previous change.
Glenn Morris <rgm@gnu.org>
parents:
101922
diff
changeset
|
4130 (add-to-list 'font-lock-global-modes 'speedbar-mode t) |
50624469b15a
Fix stupidity in previous change.
Glenn Morris <rgm@gnu.org>
parents:
101922
diff
changeset
|
4131 (setq font-lock-global-modes (delq 'speedbar-mode |
50624469b15a
Fix stupidity in previous change.
Glenn Morris <rgm@gnu.org>
parents:
101922
diff
changeset
|
4132 font-lock-global-modes))))) |
65809
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4133 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4134 ;;; Obsolete variables and functions |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4135 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4136 (define-obsolete-variable-alias |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4137 '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
|
4138 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4139 (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
|
4140 'speedbar-add-ignored-directory-regexp) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4141 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4142 (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
|
4143 'speedbar-line-directory) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4144 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4145 (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
|
4146 'speedbar-buffers-line-directory) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4147 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4148 (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
|
4149 'speedbar-directory-line) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4150 |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4151 (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
|
4152 'speedbar-buffers-line-directory) |
f528ccbc5de9
* speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents:
65780
diff
changeset
|
4153 |
21650 | 4154 (provide 'speedbar) |
4155 | |
4156 ;; run load-time hooks | |
4157 (run-hooks 'speedbar-load-hook) | |
65765
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
4158 |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
4159 ;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5 |
444ba3362b80
* speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents:
65752
diff
changeset
|
4160 ;;; speedbar ends here |