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