annotate lisp/speedbar.el @ 22677:a05b1e5f4389

(dos-printer): Obsolete variable deleted. (dos-ps-printer): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Fri, 03 Jul 1998 19:53:47 +0000
parents a77d473867b8
children ca02f300fc41
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1 ;;; speedbar --- quick access to files and tags
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3 ;;; Copyright (C) 1996, 97, 98 Free Software Foundation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <zappo@gnu.ai.mit.edu>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
6 ;; Version: 0.6.2
22250
a77d473867b8 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21658
diff changeset
7 ;; Keywords: file, tags, tools, convenience
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
8 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
10 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
14 ;; any later version.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
15 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
19 ;; GNU General Public License for more details.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
20 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
25
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
26 ;;; Commentary:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
27 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
28 ;; The speedbar provides a frame in which files, and locations in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
29 ;; files are displayed. These items can be clicked on with mouse-2
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
30 ;; in order to make the last active frame display that file location.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
31 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
32 ;; Starting Speedbar:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
33 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
34 ;; If speedbar came to you as a part of Emacs, simply type
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
35 ;; `M-x speedbar', and it will be autoloaded for you. A "Speedbar"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
36 ;; submenu will be added under "Tools".
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
37 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
38 ;; If speedbar is not a part of your distribution, then add
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
39 ;; this to your .emacs file:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
40 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
41 ;; (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
42 ;; (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
43 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
44 ;; If you want to choose it from a menu, you can do this:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
45 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
46 ;; Emacs:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
47 ;; (define-key-after (lookup-key global-map [menu-bar tools])
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
48 ;; [speedbar] '("Speedbar" . speedbar-frame-mode) [calendar])
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
49 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
50 ;; XEmacs:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
51 ;; (add-menu-button '("Tools")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
52 ;; ["Speedbar" speedbar-frame-mode
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
53 ;; :style toggle
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
54 ;; :selected (and (boundp 'speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
55 ;; (frame-live-p speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
56 ;; (frame-visible-p speedbar-frame))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
57 ;; "--")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
58 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
59 ;; If you want to access speedbar using only the keyboard, do this:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
60 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
61 ;; (global-set-key [(f4)] 'speedbar-get-focus)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
62 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
63 ;; This will let you hit f4 (or whatever key you choose) to jump
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
64 ;; focus to the speedbar frame. Pressing it again will bring you back
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
65 ;; to the attached frame. Pressing RET or e to jump to a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
66 ;; or tag will move you back to the attached frame. The command
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
67 ;; `speedbar-get-focus' will also create a speedbar frame if it does
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
68 ;; not exist.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
69 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
70 ;; Customizing Speedbar:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
71 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
72 ;; Once a speedbar frame is active, it takes advantage of idle time
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
73 ;; to keep its contents updated. The contents is usually a list of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
74 ;; files in the directory of the currently active buffer. When
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
75 ;; applicable, tags in the active file can be expanded.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
76 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
77 ;; To add new supported files types into speedbar, use the function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
78 ;; `speedbar-add-supported-extension' If speedbar complains that the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
79 ;; file type is not supported, that means there is no built in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
80 ;; support from imenu, and the etags part wasn't set up correctly. You
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
81 ;; may add elements to `speedbar-supported-extension-expressions' as long
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
82 ;; as it is done before speedbar is loaded.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
83 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
84 ;; To prevent speedbar from following you into certain directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
85 ;; use the function `speedbar-add-ignored-path-regexp' too add a new
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
86 ;; regular expression matching a type of path. You may add list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
87 ;; elements to `speedbar-ignored-path-expressions' as long as it is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
88 ;; done before speedbar is loaded.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
89 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
90 ;; To add new file types to imenu, see the documentation in the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
91 ;; file imenu.el that comes with emacs. To add new file types which
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
92 ;; etags supports, you need to modify the variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
93 ;; `speedbar-fetch-etags-parse-list'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
94 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
95 ;; If the updates are going too slow for you, modify the variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
96 ;; `speedbar-update-speed' to a longer idle time before updates.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
97 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
98 ;; If you navigate directories, you will probably notice that you
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
99 ;; will navigate to a directory which is eventually replaced after
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
100 ;; you go back to editing a file (unless you pull up a new file.)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
101 ;; The delay time before this happens is in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
102 ;; `speedbar-navigating-speed', and defaults to 10 seconds.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
103 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
104 ;; Users XEmacs previous to 20 may want to change the default
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
105 ;; timeouts for `speedbar-update-speed' to something longer as XEmacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
106 ;; doesn't have idle timers, the speedbar timer keeps going off
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
107 ;; arbitrarily while you're typing. It's quite pesky.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
108 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
109 ;; Users of really old emacsen without the needed timers will not
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
110 ;; have speedbar updating automatically. Use "r" to refresh the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
111 ;; display after changing directories. Remember, do not interrupt the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
112 ;; stealthy updates or your display may not be completely refreshed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
113 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
114 ;; See optional file `speedbspec.el' for additional configurations
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
115 ;; which allow speedbar to create specialized lists for special modes
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
116 ;; that are not file-related.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
117 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
118 ;; AUC-TEX users: The imenu tags for AUC-TEX mode don't work very
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
119 ;; well. Use the imenu keywords from tex-mode.el for better results.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
120 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
121 ;; This file requires the library package assoc (association lists)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
122 ;; and the package custom (for easy configuration of speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
123 ;; http://www.dina.kvl.dk/~abraham/custom/
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
124 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
125 ;; If you do not have custom installed, you can still get face colors
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
126 ;; by modifying the faces directly in your .emacs file, or setting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
127 ;; them in your .Xdefaults file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
128 ;; Here is an example .Xdefaults for a dark background:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
129 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
130 ;; emacs*speedbar-button-face.attributeForeground: Aquamarine
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
131 ;; emacs*speedbar-selected-face.attributeForeground: red
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
132 ;; emacs*speedbar-selected-face.attributeUnderline: true
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
133 ;; emacs*speedbar-directory-face.attributeForeground: magenta
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
134 ;; emacs*speedbar-file-face.attributeForeground: green3
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
135 ;; emacs*speedbar-highlight-face.attributeBackground: sea green
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
136 ;; emacs*speedbar-tag-face.attributeForeground: yellow
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
137
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
138 ;;; Speedbar updates can be found at:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
139 ;; ftp://ftp.ultranet.com/pub/zappo/speedbar*.tar.gz
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
140 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
141
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
142 ;;; Change log:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
143 ;; 0.1 Initial Revision
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
144 ;; 0.2 Fixed problem with x-pointer-shape causing future frames not
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
145 ;; to be created.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
146 ;; Fixed annoying habit of `speedbar-update-contents' to make
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
147 ;; it possible to accidentally kill the speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
148 ;; Clicking directory names now only changes the contents of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
149 ;; the speedbar, and does not cause a dired mode to appear.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
150 ;; Clicking the <+> next to the directory does cause dired to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
151 ;; be run.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
152 ;; Added XEmacs support, which means timer support moved to a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
153 ;; platform independant call.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
154 ;; Added imenu support. Now modes are supported by imenu
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
155 ;; first, and etags only if the imenu call doesn't work.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
156 ;; Imenu is a little faster than etags, and is more emacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
157 ;; friendly.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
158 ;; Added more user control variables described in the commentary.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
159 ;; Added smart recentering when nodes are opened and closed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
160 ;; 0.3 x-pointer-shape fixed for emacs 19.35, so I put that check in.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
161 ;; Added invisible codes to the beginning of each line.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
162 ;; Added list aproach to node expansion for easier addition of new
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
163 ;; types of things to expand by
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
164 ;; Added multi-level path name support
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
165 ;; Added multi-level tag name support.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
166 ;; Only mouse-2 is now used for node expansion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
167 ;; Added keys e + - to edit expand, and contract node lines
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
168 ;; Added longer legal file regexp for all those modes which support
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
169 ;; imenu. (pascal, fortran90, ada, pearl)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
170 ;; Added pascal support to etags from Dave Penkler <dave_penkler@grenoble.hp.com>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
171 ;; Fixed centering algorithm
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
172 ;; Tried to choose background independent colors. Made more robust.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
173 ;; Rearranged code into a more logical order
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
174 ;; 0.3.1 Fixed doc & broken keybindings
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
175 ;; Added mode hooks.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
176 ;; Improved color selection to be background mode smart
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
177 ;; `nil' passed to `speedbar-frame-mode' now toggles the frame as
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
178 ;; advertised in the doc string
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
179 ;; 0.4a Added modified patch from Dan Schmidt <dfan@lglass.com> allowing a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
180 ;; directory cache to be maintained speeding up revisiting of files.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
181 ;; Default raise-lower behavior is now off by default.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
182 ;; Added some menu items for edit expand and contract.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
183 ;; Pre 19.31 emacsen can run without idle timers.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
184 ;; Added some patch information from Farzin Guilak <farzin@protocol.com>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
185 ;; adding xemacs specifics, and some etags upgrades.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
186 ;; Added ability to set a faces symbol-value to a string
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
187 ;; representing the desired foreground color. (idea from
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
188 ;; Farzin Guilak, but implemented differently)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
189 ;; Fixed problem with 1 character buttons.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
190 ;; Added support for new Imenu marker technique.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
191 ;; Added `speedbar-load-hooks' for things to run only once on
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
192 ;; load such as updating one of the many lists.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
193 ;; Added `speedbar-supported-extension-expressions' which is a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
194 ;; list of extensions that speedbar will tag. This variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
195 ;; should only be updated with `speedbar-add-supported-extension'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
196 ;; Moved configure dialog support to a separate file so
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
197 ;; speedbar is not dependant on eieio to run
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
198 ;; Fixed list-contraction problem when the item was at the end
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
199 ;; of a sublist.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
200 ;; Fixed XEmacs multi-frame timer selecting bug problem.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
201 ;; Added `speedbar-ignored-modes' which is a list of major modes
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
202 ;; speedbar will not follow when it is displayed in the selected frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
203 ;; 0.4 When the file being edited is not in the list, and is a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
204 ;; that should be in the list, the speedbar cache is replaced.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
205 ;; Temp buffers are now shown in the attached frame not the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
206 ;; speedbar frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
207 ;; New variables `speedbar-vc-*' and `speedbar-stealthy-function-list'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
208 ;; added. `speedbar-update-current-file' is now a member of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
209 ;; the stealthy list. New function `speedbar-check-vc' will
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
210 ;; examine each file and mark it if it is checked out. To
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
211 ;; add new version control types, override the function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
212 ;; `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
213 ;; The stealth list is interruptible so that long operations
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
214 ;; do not interrupt someones editing flow. Other long
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
215 ;; speedbar updates will be added to the stealthy list in the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
216 ;; future should interesting ones be needed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
217 ;; Added many new functions including:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
218 ;; `speedbar-item-byte-compile' `speedbar-item-load'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
219 ;; `speedbar-item-copy' `speedbar-item-rename' `speedbar-item-delete'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
220 ;; and `speedbar-item-info'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
221 ;; If the user kills the speedbar buffer in some way, the frame will
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
222 ;; be removed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
223 ;; 0.4.1 Bug fixes
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
224 ;; <mark.jeffries@nomura.co.uk> added `speedbar-update-flag',
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
225 ;; XEmacs fixes for menus, and tag sorting, and quit key.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
226 ;; Modeline now updates itself based on window-width.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
227 ;; Frame is cached when closed to make pulling it up again faster.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
228 ;; Speedbars window is now marked as dedicated.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
229 ;; Added bindings: <grossjoh@charly.informatik.uni-dortmund.de>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
230 ;; Long directories are now span multiple lines autmoatically
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
231 ;; Added `speedbar-directory-button-trim-method' to specify how to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
232 ;; sorten the directory button to fit on the screen.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
233 ;; 0.4.2 Add one level of full-text cache.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
234 ;; Add `speedbar-get-focus' to switchto/raise the speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
235 ;; Editing thing-on-line will auto-raise the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
236 ;; Bound `U' to `speedbar-up-directory' command.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
237 ;; Refresh will now maintain all subdirectories that were open
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
238 ;; when the refresh was requested. (This does not include the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
239 ;; tags, only the directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
240 ;; 0.4.3 Bug fixes
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
241 ;; 0.4.4 Added `speedbar-ignored-path-expressions' and friends.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
242 ;; Configuration menu items not displayed if dialog-mode not present
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
243 ;; Speedbar buffer now starts with a space, and is not deleted
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
244 ;; ewhen the speedbar frame is closed. This prevents the invisible
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
245 ;; frame from preventing buffer switches with other buffers.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
246 ;; Fixed very bad bug in the -add-[extension|path] functions.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
247 ;; Added `speedbar-find-file-in-frame' which will always pop up a frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
248 ;; that is already display a buffer selected in the speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
249 ;; Added S-mouse2 as "power click" for always poping up a new frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
250 ;; and always rescanning with imenu (ditching the imenu cache), and
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
251 ;; always rescanning directories.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
252 ;; 0.4.5 XEmacs bugfixes and enhancements.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
253 ;; Window Title simplified.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
254 ;; 0.4.6 Fixed problems w/ dedicated minibuffer frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
255 ;; Fixed errors reported by checkdoc.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
256 ;; 0.5 Mode-specific contents added. Controlled w/ the variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
257 ;; `speedbar-mode-specific-contents-flag'. See speedbspec
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
258 ;; for info on enabling this feature.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
259 ;; `speedbar-load-hook' name change and pointer check against
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
260 ;; major-mode. Suggested by Sam Steingold <sds@ptc.com>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
261 ;; Quit auto-selects the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
262 ;; Ranamed `speedbar-do-updates' to `speedbar-update-flag'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
263 ;; Passes checkdoc.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
264 ;; 0.5.1 Advice from ptype@dra.hmg.gb:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
265 ;; Use `post-command-idle-hook' in older emacsen
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
266 ;; `speedbar-sort-tags' now works with imenu.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
267 ;; Unknown files (marked w/ ?) can now be operated on w/
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
268 ;; file commands.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
269 ;; `speedbar-vc-*-hook's for easilly adding new version control systems.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
270 ;; Checkin/out w/ vc will reset the scanners and update the * marker.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
271 ;; Fixed ange-ftp require compile time problem.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
272 ;; Fixed XEmacs menu bar bug.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
273 ;; Added `speedbar-activity-change-focus-flag' to control if the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
274 ;; focus changes w/ mouse events.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
275 ;; Added `speedbar-sort-tags' toggle to the menubar.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
276 ;; Added `speedbar-smart-directory-expand-flag' to toggle how
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
277 ;; new directories might be inserted into the speedbar hierarchy.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
278 ;; Added `speedbar-visiting-[tag|file]hook' which is called whenever
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
279 ;; speedbar pulls up a file or tag in the attached frame. Setting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
280 ;; this to `reposition-window' will do nice things to function tags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
281 ;; Fixed text-cache default-directory bug.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
282 ;; Emacs 20 char= support.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
283 ;; 0.5.2 Customization
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
284 ;; For older emacsen, you will need to download the new defcustom
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
285 ;; package to get nice faces for speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
286 ;; mouse1 Double-click is now the same as middle click.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
287 ;; No mouse pointer shape stuff for XEmacs (is there any?)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
288 ;; 0.5.3 Regressive support for non-custom enabled emacsen.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
289 ;; Fixed serious problem w/ 0.5.2 and ignored paths.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
290 ;; `condition-case' no longer used in timer fcn.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
291 ;; `speedbar-edit-line' is now smarter w/ special modes.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
292 ;; 0.5.4 Fixed more problems for Emacs 20 so speedbar loads correctly.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
293 ;; Updated some documentation strings.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
294 ;; Added customization menu item, and customized some more variables.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
295 ;; 0.5.5 Fixed so that there can be no ignored paths
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
296 ;; Added .l & .lsp as lisp, suggested by: sshteingold@cctrading.com
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
297 ;; You can now adjust height in `speedbar-frame-parameters'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
298 ;; XEmacs fix for use of `local-variable-p'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
299 ;; 0.5.6 Folded in XEmacs suggestions from Hrvoje Niksic <hniksic@srce.hr>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
300 ;; Several custom changes (group definitions, trim-method & others)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
301 ;; Keymap changes, and ways to add menu items.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
302 ;; Timer use changes for XEmacs 20.4
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
303 ;; Regular expression enhancements.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
304 ;; 0.6 Fixed up some frame definition stuff, use more convenience fns.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
305 ;; Rehashed frame creation code for better compatibility.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
306 ;; Fixed setting of kill-buffer hook.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
307 ;; Default speedbar has no menubar, mouse-3 is popup menu,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
308 ;; XEmacs double-click capability (Hrvoje Niksic <hniksic@srce.hr>)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
309 ;; General documentation fixup.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
310 ;; 0.6.1 Fixed button-3 menu for Emacs 20.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
311 ;; 0.6.2 Added autoload tag to `speedbar-get-focus'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
312
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
313 ;;; TODO:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
314 ;; - More functions to create buttons and options
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
315 ;; - filtering algorithms to reduce the number of tags/files displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
316 ;; - Timeout directories we haven't visited in a while.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
317 ;; - Remeber tags when refreshing the display. (Refresh tags too?)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
318 ;; - More 'special mode support.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
319 ;; - C- Mouse 3 menu too much indirection
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
320
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
321 (require 'assoc)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
322 (require 'easymenu)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
323
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
324 ;; From custom web page for compatibility between versions of custom:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
325 (eval-and-compile
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
326 (condition-case ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
327 (require 'custom)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
328 (error nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
329 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
330 nil ;; We've got what we needed
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
331 ;; We have the old custom-library, hack around it!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
332 (defmacro defgroup (&rest args)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
333 nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
334 (defmacro defface (var values doc &rest args)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
335 (` (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
336 (defvar (, var) (quote (, var)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
337 ;; To make colors for your faces you need to set your .Xdefaults
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
338 ;; or set them up ahead of time in your .emacs file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
339 (make-face (, var))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
340 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
341 (defmacro defcustom (var value doc &rest args)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
342 (` (defvar (, var) (, value) (, doc))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
343
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
344 ;; customization stuff
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
345 (defgroup speedbar nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
346 "File and tag browser frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
347 :group 'tags
21658
d8a81542dbf9 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21650
diff changeset
348 :group 'tools
22250
a77d473867b8 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21658
diff changeset
349 :group 'convenience
21658
d8a81542dbf9 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21650
diff changeset
350 :version "20.3")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
351
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
352 (defgroup speedbar-faces nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
353 "Faces used in speedbar."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
354 :prefix "speedbar-"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
355 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
356 :group 'faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
357
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
358 (defgroup speedbar-vc nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
359 "Version control display in speedbar."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
360 :prefix "speedbar-"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
361 :group 'speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
362
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
363 ;;; Code:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
364 (defvar speedbar-xemacsp (string-match "XEmacs" emacs-version)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
365 "Non-nil if we are running in the XEmacs environment.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
366 (defvar speedbar-xemacs20p (and speedbar-xemacsp (= emacs-major-version 20)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
367
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
368 (defvar speedbar-initial-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
369 '(speedbar-directory-buttons speedbar-default-directory-list)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
370 "List of functions to call to fill in the speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
371 Whenever a top level update is issued all functions in this list are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
372 run. These functions will always get the default directory to use
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
373 passed in as the first parameter, and a 0 as the second parameter.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
374 The 0 indicates the uppermost indentation level. They must assume
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
375 that the cursor is at the position where they start inserting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
376 buttons.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
377
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
378 (defvar speedbar-stealthy-function-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
379 '(speedbar-update-current-file speedbar-check-vc)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
380 "List of functions to periodically call stealthily.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
381 Each function must return nil if interrupted, or t if completed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
382 Stealthy functions which have a single operation should always return
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
383 t. Functions which take a long time should maintain a state (where
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
384 they are in their speedbar related calculations) and permit
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
385 interruption. See `speedbar-check-vc' as a good example.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
386
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
387 (defcustom speedbar-mode-specific-contents-flag t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
388 "*Non-nil means speedbar will show special mode contents.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
389 This permits some modes to create customized contents for the speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
390 frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
391 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
392 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
393
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
394 (defvar speedbar-special-mode-expansion-list nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
395 "Mode specific list of functions to call to fill in speedbar.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
396 Some modes, such as Info or RMAIL, do not relate quite as easily into
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
397 a simple list of files. When this variable is non-nil and buffer-local,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
398 then these functions are used, creating specialized contents. These
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
399 functions are called each time the speedbar timer is called. This
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
400 allows a mode to update its contents regularly.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
401
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
402 Each function is called with the default and frame belonging to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
403 speedbar, and with one parameter; the buffer requesting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
404 the speedbar display.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
405
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
406 (defcustom speedbar-visiting-file-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
407 "Hooks run when speedbar visits a file in the selected frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
408 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
409 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
410
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
411 (defcustom speedbar-visiting-tag-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
412 "Hooks run when speedbar visits a tag in the selected frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
413 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
414 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
415
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
416 (defcustom speedbar-load-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
417 "Hooks run when speedbar is loaded."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
418 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
419 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
420
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
421 (defcustom speedbar-show-unknown-files nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
422 "*Non-nil show files we can't expand with a ? in the expand button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
423 nil means don't show the file in the list."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
424 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
425 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
426
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
427 (defcustom speedbar-update-speed
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
428 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
429 (if speedbar-xemacs20p
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
430 2 ; 1 is too obrusive in XEmacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
431 5) ; when no idleness, need long delay
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
432 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
433 "*Idle time in seconds needed before speedbar will update itself.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
434 Updates occur to allow speedbar to display directory information
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
435 relevant to the buffer you are currently editing."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
436 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
437 :type 'integer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
438
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
439 (defcustom speedbar-navigating-speed 10
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
440 "*Idle time to wait after navigation commands in speedbar are executed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
441 Navigation commands included expanding/contracting nodes, and moving
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
442 between different directories."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
443 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
444 :type 'integer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
445
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
446 (defcustom speedbar-frame-parameters '((minibuffer . nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
447 (width . 20)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
448 (scroll-bar-width . 10)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
449 (border-width . 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
450 (menu-bar-lines . 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
451 (unsplittable . t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
452 "*Parameters to use when creating the speedbar frame in Emacs.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
453 Parameters not listed here which will be added automatically are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
454 `height' which will be initialized to the height of the frame speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
455 is attached to."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
456 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
457 :type '(repeat (sexp :tag "Parameter:")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
458
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
459 ;; These values by Hrvoje Niksic <hniksic@srce.hr>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
460 (defcustom speedbar-frame-plist
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
461 '(minibuffer nil width 20 border-width 0
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
462 internal-border-width 0 unsplittable t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
463 default-toolbar-visible-p nil has-modeline-p nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
464 menubar-visible-p nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
465 ;; I don't see the particular value of these three, but...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
466 text-pointer-glyph [cursor-font :data "top_left_arrow"]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
467 nontext-pointer-glyph [cursor-font :data "top_left_arrow"]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
468 selection-pointer-glyph [cursor-font :data "hand2"])
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
469 "*Parameters to use when creating the speedbar frame in XEmacs.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
470 Parameters not listed here which will be added automatically are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
471 `height' which will be initialized to the height of the frame speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
472 is attached to."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
473 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
474 :type '(repeat (group :inline t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
475 (symbol :tag "Property")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
476 (sexp :tag "Value"))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
477
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
478 (defcustom speedbar-use-imenu-flag (stringp (locate-library "imenu"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
479 "*Non-nil means use imenu for file parsing. nil to use etags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
480 XEmacs prior to 20.4 doesn't support imenu, therefore the default is to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
481 use etags instead. Etags support is not as robust as imenu support."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
482 :tag "User Imenu"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
483 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
484 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
485
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
486 (defcustom speedbar-sort-tags nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
487 "*If Non-nil, sort tags in the speedbar display."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
488 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
489 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
490
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
491 (defcustom speedbar-activity-change-focus-flag nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
492 "*Non-nil means the selected frame will change based on activity.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
493 Thus, if a file is selected for edit, the buffer will appear in the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
494 selected frame and the focus will change to that frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
495 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
496 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
497
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
498 (defcustom speedbar-directory-button-trim-method 'span
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
499 "*Indicates how the directory button will be displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
500 Possible values are:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
501 'span - span large directories over multiple lines.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
502 'trim - trim large directories to only show the last few.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
503 nil - no trimming."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
504 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
505 :type '(radio (const :tag "Span large directories over mutiple lines."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
506 span)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
507 (const :tag "Trim large directories to only show the last few."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
508 trim)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
509 (const :tag "No trimming." nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
510
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
511 (defcustom speedbar-smart-directory-expand-flag t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
512 "*Non-nil means speedbar should use smart expansion.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
513 Smart expansion only affects when speedbar wants to display a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
514 directory for a file in the attached frame. When smart expansion is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
515 enabled, new directories which are children of a displayed directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
516 are expanded in the current framework. If nil, then the current
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
517 hierarchy would be replaced with the new directory."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
518 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
519 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
520
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
521 (defcustom speedbar-before-popup-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
522 "*Hooks called before popping up the speedbar frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
523 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
524 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
525
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
526 (defcustom speedbar-before-delete-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
527 "*Hooks called before deleting the speedbar frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
528 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
529 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
530
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
531 (defcustom speedbar-mode-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
532 "*Hooks called after creating a speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
533 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
534 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
535
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
536 (defcustom speedbar-timer-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
537 "*Hooks called after running the speedbar timer function."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
538 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
539 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
540
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
541 (defcustom speedbar-verbosity-level 1
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
542 "*Verbosity level of the speedbar. 0 means say nothing.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
543 1 means medium level verbosity. 2 and higher are higher levels of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
544 verbosity."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
545 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
546 :type 'integer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
547
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
548 (defcustom speedbar-vc-do-check t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
549 "*Non-nil check all files in speedbar to see if they have been checked out.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
550 Any file checked out is marked with `speedbar-vc-indicator'"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
551 :group 'speedbar-vc
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
552 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
553
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
554 (defvar speedbar-vc-indicator " *"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
555 "Text used to mark files which are currently checked out.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
556 Currently only RCS is supported. Other version control systems can be
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
557 added by examining the function `speedbar-this-file-in-vc' and
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
558 `speedbar-vc-check-dir-p'")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
559
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
560 (defcustom speedbar-scanner-reset-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
561 "*Hook called whenever generic scanners are reset.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
562 Set this to implement your own scanning / rescan safe functions with
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
563 state data."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
564 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
565 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
566
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
567 (defcustom speedbar-vc-path-enable-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
568 "*Return non-nil if the current path should be checked for Version Control.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
569 Functions in this hook must accept one parameter which is the path
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
570 being checked."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
571 :group 'speedbar-vc
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
572 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
573
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
574 (defcustom speedbar-vc-in-control-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
575 "*Return non-nil if the specified file is under Version Control.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
576 Functions in this hook must accept two parameters. The PATH of the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
577 current file, and the FILENAME of the file being checked."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
578 :group 'speedbar-vc
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
579 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
580
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
581 (defvar speedbar-vc-to-do-point nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
582 "Local variable maintaining the current version control check position.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
583
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
584 (defvar speedbar-ignored-modes nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
585 "*List of major modes which speedbar will not switch directories for.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
586
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
587 (defun speedbar-extension-list-to-regex (extlist)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
588 "Takes EXTLIST, a list of extensions and transforms it into regexp.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
589 All the preceding . are stripped for an optimized expression starting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
590 with . followed by extensions, followed by full-filenames."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
591 (let ((regex1 nil) (regex2 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
592 (while extlist
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
593 (if (= (string-to-char (car extlist)) ?.)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
594 (setq regex1 (concat regex1 (if regex1 "\\|" "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
595 (substring (car extlist) 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
596 (setq regex2 (concat regex2 (if regex2 "\\|" "") (car extlist))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
597 (setq extlist (cdr extlist)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
598 ;; concat all the sub-exressions together, making sure all types
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
599 ;; of parts exist during concatination.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
600 (concat "\\("
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
601 (if regex1 (concat "\\(\\.\\(" regex1 "\\)\\)") "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
602 (if (and regex1 regex2) "\\|" "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
603 (if regex2 (concat "\\(" regex2 "\\)") "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
604 "\\)$")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
605
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
606 (defvar speedbar-ignored-path-regexp nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
607 "Regular expression matching paths speedbar will not switch to.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
608 Created from `speedbar-ignored-path-expressions' with the function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
609 `speedbar-extension-list-to-regex' (A misnamed function in this case.)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
610 Use the function `speedbar-add-ignored-path-regexp', or customize the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
611 variable `speedbar-ignored-path-expressions' to modify this variable.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
612
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
613 (defcustom speedbar-ignored-path-expressions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
614 '("/logs?/\\'")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
615 "*List of regular expressions matching directories speedbar will ignore.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
616 They should included paths to directories which are notoriously very
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
617 large and take a long time to load in. Use the function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
618 `speedbar-add-ignored-path-regexp' to add new items to this list after
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
619 speedbar is loaded. You may place anything you like in this list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
620 before speedbar has been loaded."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
621 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
622 :type '(repeat (regexp :tag "Path Regexp"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
623 :set (lambda (sym val)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
624 (setq speedbar-ignored-path-expressions val
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
625 speedbar-ignored-path-regexp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
626 (speedbar-extension-list-to-regex val))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
627
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
628 (defvar speedbar-file-unshown-regexp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
629 (let ((nstr "") (noext completion-ignored-extensions))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
630 (while noext
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
631 (setq nstr (concat nstr (regexp-quote (car noext)) "\\'"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
632 (if (cdr noext) "\\|" ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
633 noext (cdr noext)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
634 (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
635 "*Regexp matching files we don't want displayed in a speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
636 It is generated from the variable `completion-ignored-extensions'")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
637
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
638 ;; this is dangerous to customize, because the defaults will probably
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
639 ;; change in the future.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
640 (defcustom speedbar-supported-extension-expressions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
641 (append '(".[CcHh]\\(\\+\\+\\|pp\\|c\\|h\\)?" ".tex\\(i\\(nfo\\)?\\)?"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
642 ".el" ".emacs" ".l" ".lsp" ".p" ".java")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
643 (if speedbar-use-imenu-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
644 '(".f90" ".ada" ".pl" ".tcl" ".m"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
645 "Makefile\\(\\.in\\)?")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
646 "*List of regular expressions which will match files supported by tagging.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
647 Do not prefix the `.' char with a double \\ to quote it, as the period
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
648 will be stripped by a simplified optimizer when compiled into a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
649 singular expression. This variable will be turned into
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
650 `speedbar-file-regexp' for use with speedbar. You should use the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
651 function `speedbar-add-supported-extension' to add a new extension at
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
652 runtime, or use the configuration dialog to set it in your .emacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
653 file."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
654 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
655 :type '(repeat (regexp :tag "Extension Regexp"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
656 :set (lambda (sym val)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
657 (setq speedbar-supported-extension-expressions val
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
658 speedbar-file-regexp (speedbar-extension-list-to-regex val)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
659 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
660
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
661 (defvar speedbar-file-regexp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
662 (speedbar-extension-list-to-regex speedbar-supported-extension-expressions)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
663 "Regular expression matching files we know how to expand.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
664 Created from `speedbar-supported-extension-expression' with the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
665 function `speedbar-extension-list-to-regex'")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
666
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
667 (defun speedbar-add-supported-extension (extension)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
668 "Add EXTENSION as a new supported extension for speedbar tagging.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
669 This should start with a `.' if it is not a complete file name, and
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
670 the dot should NOT be quoted in with \\. Other regular expression
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
671 matchers are allowed however. EXTENSION may be a single string or a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
672 list of strings."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
673 (if (not (listp extension)) (setq extension (list extension)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
674 (while extension
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
675 (if (member (car extension) speedbar-supported-extension-expressions)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
676 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
677 (setq speedbar-supported-extension-expressions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
678 (cons (car extension) speedbar-supported-extension-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
679 (setq extension (cdr extension)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
680 (setq speedbar-file-regexp (speedbar-extension-list-to-regex
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
681 speedbar-supported-extension-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
682
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
683 (defun speedbar-add-ignored-path-regexp (path-expression)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
684 "Add PATH-EXPRESSION as a new ignored path for speedbar tracking.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
685 This function will modify `speedbar-ignored-path-regexp' and add
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
686 PATH-EXPRESSION to `speedbar-ignored-path-expressions'."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
687 (if (not (listp path-expression))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
688 (setq path-expression (list path-expression)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
689 (while path-expression
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
690 (if (member (car path-expression) speedbar-ignored-path-expressions)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
691 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
692 (setq speedbar-ignored-path-expressions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
693 (cons (car path-expression) speedbar-ignored-path-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
694 (setq path-expression (cdr path-expression)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
695 (setq speedbar-ignored-path-regexp (speedbar-extension-list-to-regex
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
696 speedbar-ignored-path-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
697
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
698 ;; If we don't have custom, then we set it here by hand.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
699 (if (not (fboundp 'custom-declare-variable))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
700 (setq speedbar-file-regexp (speedbar-extension-list-to-regex
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
701 speedbar-supported-extension-expressions)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
702 speedbar-ignored-path-regexp (speedbar-extension-list-to-regex
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
703 speedbar-ignored-path-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
704
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
705 (defvar speedbar-update-flag (or (fboundp 'run-with-idle-timer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
706 (fboundp 'start-itimer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
707 (boundp 'post-command-idle-hook))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
708 "*Non-nil means to automatically update the display.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
709 When this is nil then speedbar will not follow the attached frame's path.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
710 When speedbar is active, use:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
711
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
712 \\<speedbar-key-map> `\\[speedbar-toggle-updates]'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
713
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
714 to toggle this value.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
715
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
716 (defvar speedbar-syntax-table nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
717 "Syntax-table used on the speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
718
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
719 (if speedbar-syntax-table
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
720 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
721 (setq speedbar-syntax-table (make-syntax-table))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
722 ;; turn off paren matching around here.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
723 (modify-syntax-entry ?\' " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
724 (modify-syntax-entry ?\" " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
725 (modify-syntax-entry ?( " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
726 (modify-syntax-entry ?) " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
727 (modify-syntax-entry ?[ " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
728 (modify-syntax-entry ?] " " speedbar-syntax-table))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
729
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
730
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
731 (defvar speedbar-key-map nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
732 "Keymap used in speedbar buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
733
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
734 (if speedbar-key-map
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
735 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
736 (setq speedbar-key-map (make-keymap))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
737 (suppress-keymap speedbar-key-map t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
738
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
739 ;; control
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
740 (define-key speedbar-key-map "e" 'speedbar-edit-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
741 (define-key speedbar-key-map "\C-m" 'speedbar-edit-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
742 (define-key speedbar-key-map "+" 'speedbar-expand-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
743 (define-key speedbar-key-map "-" 'speedbar-contract-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
744 (define-key speedbar-key-map "g" 'speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
745 (define-key speedbar-key-map "t" 'speedbar-toggle-updates)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
746 (define-key speedbar-key-map "q" 'speedbar-close-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
747 (define-key speedbar-key-map "U" 'speedbar-up-directory)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
748
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
749 ;; navigation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
750 (define-key speedbar-key-map "n" 'speedbar-next)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
751 (define-key speedbar-key-map "p" 'speedbar-prev)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
752 (define-key speedbar-key-map " " 'speedbar-scroll-up)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
753 (define-key speedbar-key-map [delete] 'speedbar-scroll-down)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
754
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
755 ;; After much use, I suddenly desired in my heart to perform dired
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
756 ;; style operations since the directory was RIGHT THERE!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
757 (define-key speedbar-key-map "I" 'speedbar-item-info)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
758 (define-key speedbar-key-map "B" 'speedbar-item-byte-compile)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
759 (define-key speedbar-key-map "L" 'speedbar-item-load)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
760 (define-key speedbar-key-map "C" 'speedbar-item-copy)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
761 (define-key speedbar-key-map "D" 'speedbar-item-delete)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
762 (define-key speedbar-key-map "R" 'speedbar-item-rename)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
763
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
764 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
765 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
766 ;; mouse bindings so we can manipulate the items on each line
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
767 (define-key speedbar-key-map 'button2 'speedbar-click)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
768 (define-key speedbar-key-map '(shift button2) 'speedbar-power-click)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
769 (define-key speedbar-key-map 'button3 'speedbar-xemacs-popup-kludge)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
770 (define-key speedbar-key-map '(meta button3) 'speedbar-mouse-item-info))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
771 ;; mouse bindings so we can manipulate the items on each line
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
772 (define-key speedbar-key-map [down-mouse-1] 'speedbar-double-click)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
773 (define-key speedbar-key-map [mouse-2] 'speedbar-click)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
774 ;; This is the power click for new frames, or refreshing a cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
775 (define-key speedbar-key-map [S-mouse-2] 'speedbar-power-click)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
776 ;; This adds a small unecessary visual effect
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
777 ;;(define-key speedbar-key-map [down-mouse-2] 'speedbar-quick-mouse)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
778 (define-key speedbar-key-map [M-mouse-2] 'speedbar-mouse-item-info)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
779
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
780 (define-key speedbar-key-map [down-mouse-3] 'speedbar-emacs-popup-kludge)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
781
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
782 ;;***** Disable disabling: Remove menubar completely.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
783 ;; disable all menus - we don't have a lot of space to play with
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
784 ;; in such a skinny frame. This will cleverly find and nuke some
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
785 ;; user-defined menus as well if they are there. Too bad it
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
786 ;; rely's on the structure of a keymap to work.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
787 ; (let ((k (lookup-key global-map [menu-bar])))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
788 ; (while k
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
789 ; (if (and (listp (car k)) (listp (cdr (car k))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
790 ; (define-key speedbar-key-map (vector 'menu-bar (car (car k)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
791 ; 'undefined))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
792 ; (setq k (cdr k))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
793
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
794 ;; This lets the user scroll as if we had a scrollbar... well maybe not
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
795 (define-key speedbar-key-map [mode-line mouse-2] 'speedbar-mouse-hscroll)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
796 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
797
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
798 (defvar speedbar-easymenu-definition-base
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
799 '("Speedbar"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
800 ["Update" speedbar-refresh t]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
801 ["Auto Update" speedbar-toggle-updates
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
802 :style toggle :selected speedbar-update-flag]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
803 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
804 "Base part of the speedbar menu.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
805
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
806 (defvar speedbar-easymenu-definition-special
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
807 '(["Edit Item On Line" speedbar-edit-line t]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
808 ["Show All Files" speedbar-toggle-show-all-files
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
809 :style toggle :selected speedbar-show-unknown-files]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
810 ["Expand Item" speedbar-expand-line
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
811 (save-excursion (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
812 (looking-at "[0-9]+: *.\\+. "))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
813 ["Contract Item" speedbar-contract-line
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
814 (save-excursion (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
815 (looking-at "[0-9]+: *.-. "))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
816 ["Sort Tags" speedbar-toggle-sorting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
817 :style toggle :selected speedbar-sort-tags]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
818 "----"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
819 ["Item Information" speedbar-item-info t]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
820 ["Load Lisp File" speedbar-item-load
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
821 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
822 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
823 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\*\\)?$"))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
824 ["Byte Compile File" speedbar-item-byte-compile
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
825 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
826 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
827 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\*\\)?$"))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
828 ["Copy Item" speedbar-item-copy
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
829 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *\\["))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
830 ["Rename Item" speedbar-item-rename
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
831 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
832 ["Delete Item" speedbar-item-delete
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
833 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))])
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
834 "Additional menu items while in file-mode.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
835
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
836 (defvar speedbar-easymenu-definition-trailer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
837 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
838 '("----"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
839 ["Customize..." speedbar-customize t]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
840 ["Close" speedbar-close-frame t])
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
841 '("----"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
842 ["Close" speedbar-close-frame t]))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
843 "Menu items appearing at the end of the speedbar menu.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
844
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
845 (defvar speedbar-desired-buffer nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
846 "Non-nil when speedbar is showing buttons specific a special mode.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
847 In this case it is the originating buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
848 (defvar speedbar-buffer nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
849 "The buffer displaying the speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
850 (defvar speedbar-frame nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
851 "The frame displaying speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
852 (defvar speedbar-cached-frame nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
853 "The frame that was last created, then removed from the display.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
854 (defvar speedbar-full-text-cache nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
855 "The last open directory is saved in its entirety for ultra-fast switching.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
856 (defvar speedbar-timer nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
857 "The speedbar timer used for updating the buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
858 (defvar speedbar-attached-frame nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
859 "The frame which started speedbar mode.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
860 This is the frame from which all data displayed in the speedbar is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
861 gathered, and in which files and such are displayed.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
862
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
863 (defvar speedbar-last-selected-file nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
864 "The last file which was selected in speedbar buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
865
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
866 (defvar speedbar-shown-directories nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
867 "Maintain list of directories simultaneously open in the current speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
868
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
869 (defvar speedbar-directory-contents-alist nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
870 "An association list of directories and their contents.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
871 Each sublist was returned by `speedbar-file-lists'. This list is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
872 maintained to speed up the refresh rate when switching between
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
873 directories.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
874
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
875 (defvar speedbar-power-click nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
876 "Never set this by hand. Value is t when S-mouse activity occurs.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
877
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
878
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
879 ;;; Mode definitions/ user commands
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
880 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
881
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
882 ;;;###autoload
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
883 (defalias 'speedbar 'speedbar-frame-mode)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
884 ;;;###autoload
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
885 (defun speedbar-frame-mode (&optional arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
886 "Enable or disable speedbar. Positive ARG means turn on, negative turn off.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
887 nil means toggle. Once the speedbar frame is activated, a buffer in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
888 `speedbar-mode' will be displayed. Currently, only one speedbar is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
889 supported at a time.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
890 `speedbar-before-popup-hook' is called before popping up the speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
891 `speedbar-before-delete-hook' is called before the frame is deleted."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
892 (interactive "P")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
893 (if (if (and speedbar-xemacsp (fboundp 'console-on-window-system-p))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
894 (not (console-on-window-system-p))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
895 (not (symbol-value 'window-system)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
896 (error "Speedbar is not useful outside of a windowing environment"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
897 ;;; RMS says this should not modify the menu.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
898 ; (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
899 ; (add-menu-button '("Tools")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
900 ; ["Speedbar" speedbar-frame-mode
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
901 ; :style toggle
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
902 ; :selected (and (boundp 'speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
903 ; (frame-live-p speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
904 ; (frame-visible-p speedbar-frame))]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
905 ; "--")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
906 ; (define-key-after (lookup-key global-map [menu-bar tools])
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
907 ; [speedbar] '("Speedbar" . speedbar-frame-mode) [calendar]))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
908 ;; toggle frame on and off.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
909 (if (not arg) (if (and (frame-live-p speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
910 (frame-visible-p speedbar-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
911 (setq arg -1) (setq arg 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
912 ;; turn the frame off on neg number
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
913 (if (and (numberp arg) (< arg 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
914 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
915 (run-hooks 'speedbar-before-delete-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
916 (if (and speedbar-frame (frame-live-p speedbar-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
917 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
918 (setq speedbar-cached-frame speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
919 (make-frame-invisible speedbar-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
920 (setq speedbar-frame nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
921 (speedbar-set-timer nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
922 ;; Used to delete the buffer. This has the annoying affect of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
923 ;; preventing whatever took its place from ever appearing
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
924 ;; as the default after a C-x b was typed
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
925 ;;(if (bufferp speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
926 ;; (kill-buffer speedbar-buffer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
927 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
928 ;; Set this as our currently attached frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
929 (setq speedbar-attached-frame (selected-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
930 (run-hooks 'speedbar-before-popup-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
931 ;; Get the frame to work in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
932 (if (frame-live-p speedbar-cached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
933 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
934 (setq speedbar-frame speedbar-cached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
935 (make-frame-visible speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
936 ;; Get the buffer to play with
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
937 (speedbar-mode)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
938 (select-frame speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
939 (if (not (eq (current-buffer) speedbar-buffer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
940 (switch-to-buffer speedbar-buffer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
941 (set-window-dedicated-p (selected-window) t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
942 (raise-frame speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
943 (speedbar-set-timer speedbar-update-speed)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
944 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
945 (if (frame-live-p speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
946 (raise-frame speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
947 (setq speedbar-frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
948 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
949 (make-frame (nconc (list 'height
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
950 (speedbar-needed-height))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
951 speedbar-frame-plist))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
952 (let* ((mh (cdr (assoc 'menu-bar-lines (frame-parameters))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
953 (params (append speedbar-frame-parameters
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
954 (list (cons
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
955 'height
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
956 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
957 (speedbar-needed-height)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
958 (+ mh (frame-height))))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
959 (if (< emacs-major-version 20);;a bug is fixed in v20 & later
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
960 (make-frame params)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
961 (let ((x-pointer-shape x-pointer-top-left-arrow)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
962 (x-sensitive-text-pointer-shape x-pointer-hand2))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
963 (make-frame params))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
964 ;; reset the selection variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
965 (setq speedbar-last-selected-file nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
966 ;; Put the buffer into the frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
967 (save-window-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
968 ;; Get the buffer to play with
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
969 (speedbar-mode)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
970 (select-frame speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
971 (switch-to-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
972 (set-window-dedicated-p (selected-window) t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
973 (speedbar-set-timer speedbar-update-speed)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
974
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
975 ;;;###autoload
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
976 (defun speedbar-get-focus ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
977 "Change frame focus to or from the speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
978 If the selected frame is not speedbar, then speedbar frame is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
979 selected. If the speedbar frame is active, then select the attached frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
980 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
981 (if (eq (selected-frame) speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
982 (if (frame-live-p speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
983 (select-frame speedbar-attached-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
984 ;; make sure we have a frame
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
985 (if (not (frame-live-p speedbar-frame)) (speedbar-frame-mode 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
986 ;; go there
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
987 (select-frame speedbar-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
988 (other-frame 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
989
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
990 (defun speedbar-close-frame ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
991 "Turn off a currently active speedbar."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
992 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
993 (speedbar-frame-mode -1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
994 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
995 (other-frame 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
996
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
997 (defmacro speedbar-frame-width ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
998 "Return the width of the speedbar frame in characters.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
999 nil if it doesn't exist."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1000 '(frame-width speedbar-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1001
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1002 ;; XEmacs function only.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1003 (defun speedbar-needed-height (&optional frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1004 "The needed height for the tool bar FRAME (in characters)."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1005 (or frame (setq frame (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1006 ;; The 1 is the missing modeline/minibuffer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1007 (+ 1 (/ (frame-pixel-height frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1008 (face-height 'default frame))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1009
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1010 (defun speedbar-mode ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1011 "Major mode for managing a display of directories and tags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1012 \\<speedbar-key-map>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1013 The first line represents the default path of the speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1014 Each directory segment is a button which jumps speedbar's default
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1015 directory to that path. Buttons are activated by clicking `\\[speedbar-click]'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1016 In some situations using `\\[speedbar-power-click]' is a `power click' which will
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1017 rescan cached items, or pop up new frames.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1018
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1019 Each line starting with <+> represents a directory. Click on the <+>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1020 to insert the directory listing into the current tree. Click on the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1021 <-> to retract that list. Click on the directory name to go to that
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1022 directory as the default.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1023
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1024 Each line starting with [+] is a file. If the variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1025 `speedbar-show-unknown-files' is t, the lines starting with [?] are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1026 files which don't have imenu support, but are not expressly ignored.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1027 Files are completely ignored if they match `speedbar-file-unshown-regexp'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1028 which is generated from `completion-ignored-extensions'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1029
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1030 Files with a `*' character after their name are files checked out of a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1031 version control system. (currently only RCS is supported.) New
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1032 version control systems can be added by examining the documentation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1033 for `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1034
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1035 Click on the [+] to display a list of tags from that file. Click on
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1036 the [-] to retract the list. Click on the file name to edit the file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1037 in the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1038
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1039 If you open tags, you might find a node starting with {+}, which is a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1040 category of tags. Click the {+} to expand the category. Jump-able
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1041 tags start with >. Click the name of the tag to go to that position
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1042 in the selected file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1043
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1044 \\{speedbar-key-map}"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1045 ;; NOT interactive
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1046 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1047 (setq speedbar-buffer (set-buffer (get-buffer-create " SPEEDBAR")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1048 (kill-all-local-variables)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1049 (setq major-mode 'speedbar-mode)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1050 (setq mode-name "Speedbar")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1051 (use-local-map speedbar-key-map)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1052 (set-syntax-table speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1053 (setq font-lock-keywords nil) ;; no font-locking please
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1054 (setq truncate-lines t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1055 (make-local-variable 'frame-title-format)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1056 (setq frame-title-format "Speedbar")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1057 ;; Set this up special just for the speedbar buffer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1058 (if (null default-minibuffer-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1059 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1060 (make-local-variable 'default-minibuffer-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1061 (setq default-minibuffer-frame speedbar-attached-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1062 (make-local-variable 'temp-buffer-show-function)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1063 (setq temp-buffer-show-function 'speedbar-temp-buffer-show-function)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1064 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1065 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1066 ;; Argh! mouse-track-click-hook doesn't understand the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1067 ;; make-local-hook conventions.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1068 (make-local-variable 'mouse-track-click-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1069 (add-hook 'mouse-track-click-hook
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1070 (lambda (event count)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1071 (if (/= (event-button event) 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1072 nil ; Do normal operations.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1073 (cond ((eq count 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1074 (speedbar-quick-mouse event))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1075 ((or (eq count 2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1076 (eq count 3))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1077 (mouse-set-point event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1078 (speedbar-do-function-pointer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1079 (speedbar-quick-mouse event)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1080 ;; Don't do normal operations.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1081 t)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1082 (make-local-hook 'kill-buffer-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1083 (add-hook 'kill-buffer-hook (lambda () (let ((skilling (boundp 'skilling)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1084 (if skilling
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1085 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1086 (if (eq (current-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1087 speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1088 (speedbar-frame-mode -1)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1089 t t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1090 (speedbar-set-mode-line-format)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1091 (if (not speedbar-xemacsp)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1092 (setq auto-show-mode nil)) ;no auto-show for Emacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1093 (run-hooks 'speedbar-mode-hook))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1094 (speedbar-update-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1095 speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1096
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1097 (defun speedbar-set-mode-line-format ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1098 "Set the format of the mode line based on the current speedbar environment.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1099 This gives visual indications of what is up. It EXPECTS the speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1100 frame and window to be the currently active frame and window."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1101 (if (and (frame-live-p speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1102 (or (not speedbar-xemacsp)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1103 (specifier-instance has-modeline-p)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1104 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1105 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1106 (let* ((w (or (speedbar-frame-width) 20))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1107 (p1 "<<")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1108 (p5 ">>")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1109 (p3 (if speedbar-update-flag "SPEEDBAR" "SLOWBAR"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1110 (blank (- w (length p1) (length p3) (length p5)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1111 (if line-number-mode 4 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1112 (p2 (if (> blank 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1113 (make-string (/ blank 2) ? )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1114 ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1115 (p4 (if (> blank 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1116 (make-string (+ (/ blank 2) (% blank 2)) ? )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1117 ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1118 (tf
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1119 (if line-number-mode
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1120 (list (concat p1 p2 p3) '(line-number-mode " %3l")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1121 (concat p4 p5))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1122 (list (concat p1 p2 p3 p4 p5)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1123 (if (not (equal mode-line-format tf))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1124 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1125 (setq mode-line-format tf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1126 (force-mode-line-update)))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1127
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1128 (defun speedbar-temp-buffer-show-function (buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1129 "Placed in the variable `temp-buffer-show-function' in `speedbar-mode'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1130 If a user requests help using \\[help-command] <Key> the temp BUFFER will be
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1131 redirected into a window on the attached frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1132 (if speedbar-attached-frame (select-frame speedbar-attached-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1133 (pop-to-buffer buffer nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1134 (other-window -1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1135 (run-hooks 'temp-buffer-show-hook))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1136
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1137 (defun speedbar-reconfigure-menubar ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1138 "Reconfigure the menu-bar in a speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1139 Different menu items are displayed depending on the current display mode
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1140 and the existence of packages."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1141 (let ((md (append speedbar-easymenu-definition-base
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1142 (if speedbar-shown-directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1143 ;; file display mode version
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1144 speedbar-easymenu-definition-special
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1145 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1146 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1147 (if (local-variable-p
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1148 'speedbar-easymenu-definition-special
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1149 (current-buffer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1150 ;; If bound locally, we can use it
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1151 speedbar-easymenu-definition-special)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1152 ;; The trailer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1153 speedbar-easymenu-definition-trailer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1154 (easy-menu-define speedbar-menu-map speedbar-key-map "Speedbar menu" md)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1155 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1156 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1157 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1158 ;; For the benefit of button3
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1159 (if (and (not (assoc "Speedbar" mode-popup-menu)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1160 (easy-menu-add md))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1161 (set-buffer-menubar (list md)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1162 (easy-menu-add md))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1163
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1164
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1165 ;;; User Input stuff
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1166 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1167
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1168 ;; XEmacs: this can be implemented using modeline keymaps, but there
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1169 ;; is no use, as we have horizontal scrollbar (as the docstring
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1170 ;; hints.)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1171 (defun speedbar-mouse-hscroll (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1172 "Read a mouse event E from the mode line, and horizontally scroll.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1173 If the mouse is being clicked on the far left, or far right of the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1174 mode-line. This is only useful for non-XEmacs"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1175 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1176 (let* ((xp (car (nth 2 (car (cdr e)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1177 (cpw (/ (frame-pixel-width)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1178 (frame-width)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1179 (oc (1+ (/ xp cpw)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1180 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1181 (cond ((< oc 3)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1182 (scroll-left 2))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1183 ((> oc (- (window-width) 3))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1184 (scroll-right 2))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1185 (t (message "Click on the edge of the modeline to scroll left/right")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1186 ;;(message "X: Pixel %d Char Pixels %d On char %d" xp cpw oc)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1187 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1188
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1189 (defun speedbar-customize ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1190 "Customize speedbar using the Custom package."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1191 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1192 (let ((sf (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1193 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1194 (customize-group 'speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1195 (select-frame sf))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1196 (speedbar-maybee-jump-to-attached-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1197
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1198 ;; In XEmacs, we make popup menus work on the item over mouse (as
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1199 ;; opposed to where the point happens to be.) We attain this by
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1200 ;; temporarily moving the point to that place.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1201 ;; Hrvoje Niksic <hniksic@srce.hr>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1202 (defun speedbar-xemacs-popup-kludge (event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1203 "Pop up a menu related to the clicked on item.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1204 Must be bound to EVENT."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1205 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1206 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1207 (goto-char (event-closest-point event))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1208 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1209 (forward-char (min 5 (- (save-excursion (end-of-line) (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1210 (save-excursion (beginning-of-line) (point)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1211 (popup-mode-menu)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1212 ;; Wait for menu to bail out. `popup-mode-menu' (and other popup
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1213 ;; menu functions) return immediately.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1214 (let (new)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1215 (while (not (misc-user-event-p (setq new (next-event))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1216 (dispatch-event new))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1217 (dispatch-event new))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1218
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1219 (defun speedbar-emacs-popup-kludge (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1220 "Pop up a menu related to the clicked on item.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1221 Must be bound to event E."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1222 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1223 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1224 (mouse-set-point e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1225 ;; This gets the cursor where the user can see it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1226 (if (not (bolp)) (forward-char -1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1227 (sit-for 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1228 (if (< emacs-major-version 20)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1229 (mouse-major-mode-menu e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1230 (mouse-major-mode-menu e nil))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1231
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1232 (defun speedbar-next (arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1233 "Move to the next ARGth line in a speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1234 (interactive "p")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1235 (forward-line (or arg 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1236 (speedbar-item-info)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1237 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1238
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1239 (defun speedbar-prev (arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1240 "Move to the previous ARGth line in a speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1241 (interactive "p")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1242 (speedbar-next (if arg (- arg) -1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1243
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1244 (defun speedbar-scroll-up (&optional arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1245 "Page down one screen-full of the speedbar, or ARG lines."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1246 (interactive "P")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1247 (scroll-up arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1248 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1249
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1250 (defun speedbar-scroll-down (&optional arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1251 "Page up one screen-full of the speedbar, or ARG lines."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1252 (interactive "P")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1253 (scroll-down arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1254 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1255
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1256 (defun speedbar-up-directory ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1257 "Keyboard accelerator for moving the default directory up one.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1258 Assumes that the current buffer is the speedbar buffer"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1259 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1260 (setq default-directory (expand-file-name (concat default-directory "../")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1261 (speedbar-update-contents))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1262
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1263 ;;; Speedbar file activity (aka creeping featurism)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1264 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1265 (defun speedbar-refresh ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1266 "Refresh the current speedbar display, disposing of any cached data."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1267 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1268 (let ((dl speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1269 (while dl
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1270 (adelete 'speedbar-directory-contents-alist (car dl))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1271 (setq dl (cdr dl))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1272 (if (<= 1 speedbar-verbosity-level) (message "Refreshing speedbar..."))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1273 (speedbar-update-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1274 (speedbar-stealthy-updates)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1275 ;; Reset the timer in case it got really hosed for some reason...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1276 (speedbar-set-timer speedbar-update-speed)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1277 (if (<= 1 speedbar-verbosity-level) (message "Refreshing speedbar...done")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1278
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1279 (defun speedbar-item-load ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1280 "Load the item under the cursor or mouse if it is a lisp file."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1281 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1282 (let ((f (speedbar-line-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1283 (if (and (file-exists-p f) (string-match "\\.el\\'" f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1284 (if (and (file-exists-p (concat f "c"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1285 (y-or-n-p (format "Load %sc? " f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1286 ;; If the compiled version exists, load that instead...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1287 (load-file (concat f "c"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1288 (load-file f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1289 (error "Not a loadable file..."))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1290
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1291 (defun speedbar-item-byte-compile ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1292 "Byte compile the item under the cursor or mouse if it is a lisp file."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1293 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1294 (let ((f (speedbar-line-file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1295 (sf (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1296 (if (and (file-exists-p f) (string-match "\\.el\\'" f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1297 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1298 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1299 (byte-compile-file f nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1300 (select-frame sf)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1301 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1302
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1303 (defun speedbar-mouse-item-info (event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1304 "Provide information about what the user clicked on.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1305 This should be bound to a mouse EVENT."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1306 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1307 (mouse-set-point event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1308 (speedbar-item-info))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1309
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1310 (defun speedbar-item-info ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1311 "Display info in the mini-buffer about the button the mouse is over."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1312 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1313 (if (not speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1314 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1315 (let* ((item (speedbar-line-file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1316 (attr (if item (file-attributes item) nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1317 (if item (message "%s %d %s" (nth 8 attr) (nth 7 attr) item)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1318 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1319 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1320 (looking-at "\\([0-9]+\\):")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1321 (setq item (speedbar-line-path (string-to-int (match-string 1))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1322 (if (re-search-forward "> \\([^ ]+\\)$"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1323 (save-excursion(end-of-line)(point)) t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1324 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1325 (setq attr (get-text-property (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1326 'speedbar-token))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1327 (message "Tag %s in %s at position %s"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1328 (match-string 1) item (if attr attr 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1329 (message "No special info for this line.")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1330 ))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1331
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1332 (defun speedbar-item-copy ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1333 "Copy the item under the cursor.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1334 Files can be copied to new names or places."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1335 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1336 (let ((f (speedbar-line-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1337 (if (not f) (error "Not a file."))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1338 (if (file-directory-p f)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1339 (error "Cannot copy directory.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1340 (let* ((rt (read-file-name (format "Copy %s to: "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1341 (file-name-nondirectory f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1342 (file-name-directory f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1343 (refresh (member (expand-file-name (file-name-directory rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1344 speedbar-shown-directories)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1345 ;; Create the right file name part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1346 (if (file-directory-p rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1347 (setq rt
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1348 (concat (expand-file-name rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1349 (if (string-match "/$" rt) "" "/")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1350 (file-name-nondirectory f))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1351 (if (or (not (file-exists-p rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1352 (y-or-n-p (format "Overwrite %s with %s? " rt f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1353 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1354 (copy-file f rt t t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1355 ;; refresh display if the new place is currently displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1356 (if refresh
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1357 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1358 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1359 (if (not (speedbar-goto-this-file rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1360 (speedbar-goto-this-file f))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1361 ))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1362
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1363 (defun speedbar-item-rename ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1364 "Rename the item under the cursor or mouse.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1365 Files can be renamed to new names or moved to new directories."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1366 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1367 (let ((f (speedbar-line-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1368 (if f
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1369 (let* ((rt (read-file-name (format "Rename %s to: "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1370 (file-name-nondirectory f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1371 (file-name-directory f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1372 (refresh (member (expand-file-name (file-name-directory rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1373 speedbar-shown-directories)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1374 ;; Create the right file name part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1375 (if (file-directory-p rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1376 (setq rt
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1377 (concat (expand-file-name rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1378 (if (string-match "/\\'" rt) "" "/")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1379 (file-name-nondirectory f))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1380 (if (or (not (file-exists-p rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1381 (y-or-n-p (format "Overwrite %s with %s? " rt f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1382 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1383 (rename-file f rt t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1384 ;; refresh display if the new place is currently displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1385 (if refresh
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1386 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1387 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1388 (speedbar-goto-this-file rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1389 )))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1390 (error "Not a file."))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1391
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1392 (defun speedbar-item-delete ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1393 "Delete the item under the cursor. Files are removed from disk."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1394 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1395 (let ((f (speedbar-line-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1396 (if (not f) (error "Not a file."))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1397 (if (y-or-n-p (format "Delete %s? " f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1398 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1399 (if (file-directory-p f)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1400 (delete-directory f)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1401 (delete-file f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1402 (message "Okie dokie..")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1403 (let ((p (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1404 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1405 (goto-char p))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1406 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1407 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1408
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1409 (defun speedbar-enable-update ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1410 "Enable automatic updating in speedbar via timers."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1411 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1412 (setq speedbar-update-flag t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1413 (speedbar-set-mode-line-format)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1414 (speedbar-set-timer speedbar-update-speed))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1415
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1416 (defun speedbar-disable-update ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1417 "Disable automatic updating and stop consuming resources."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1418 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1419 (setq speedbar-update-flag nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1420 (speedbar-set-mode-line-format)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1421 (speedbar-set-timer nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1422
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1423 (defun speedbar-toggle-updates ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1424 "Toggle automatic update for the speedbar frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1425 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1426 (if speedbar-update-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1427 (speedbar-disable-update)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1428 (speedbar-enable-update)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1429
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1430 (defun speedbar-toggle-sorting ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1431 "Toggle automatic update for the speedbar frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1432 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1433 (setq speedbar-sort-tags (not speedbar-sort-tags)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1434
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1435 (defun speedbar-toggle-show-all-files ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1436 "Toggle display of files speedbar can not tag."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1437 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1438 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1439 (speedbar-refresh))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1440
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1441 ;;; Utility functions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1442 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1443 (defun speedbar-set-timer (timeout)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1444 "Apply a timer with TIMEOUT, or remove a timer if TIMOUT is nil.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1445 TIMEOUT is the number of seconds until the speedbar timer is called
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1446 again. When TIMEOUT is nil, turn off all timeouts.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1447 This function will also enable or disable the `vc-checkin-hook' used
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1448 to track file check ins, and will change the mode line to match
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1449 `speedbar-update-flag'."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1450 (cond
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1451 ;; XEmacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1452 (speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1453 (if speedbar-timer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1454 (progn (delete-itimer speedbar-timer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1455 (setq speedbar-timer nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1456 (if timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1457 (if (and speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1458 (or (>= emacs-major-version 20)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1459 (>= emacs-minor-version 15)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1460 (setq speedbar-timer (start-itimer "speedbar"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1461 'speedbar-timer-fn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1462 timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1463 timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1464 t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1465 (setq speedbar-timer (start-itimer "speedbar"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1466 'speedbar-timer-fn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1467 timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1468 nil)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1469 ;; Post 19.31 Emacs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1470 ((fboundp 'run-with-idle-timer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1471 (if speedbar-timer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1472 (progn (cancel-timer speedbar-timer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1473 (setq speedbar-timer nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1474 (if timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1475 (setq speedbar-timer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1476 (run-with-idle-timer timeout t 'speedbar-timer-fn))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1477 ;; Emacs 19.30 (Thanks twice: ptype@dra.hmg.gb)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1478 ((fboundp 'post-command-idle-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1479 (if timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1480 (add-hook 'post-command-idle-hook 'speedbar-timer-fn)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1481 (remove-hook 'post-command-idle-hook 'speedbar-timer-fn)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1482 ;; Older or other Emacsen with no timers. Set up so that its
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1483 ;; obvious this emacs can't handle the updates
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1484 (t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1485 (setq speedbar-update-flag nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1486 ;; Apply a revert hook that will reset the scanners. We attach to revert
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1487 ;; because most reverts occur during VC state change, and this lets our
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1488 ;; VC scanner fix itself.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1489 (if timeout
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1490 (add-hook 'after-revert-hook 'speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1491 (remove-hook 'after-revert-hook 'speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1492 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1493 ;; change this if it changed for some reason
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1494 (speedbar-set-mode-line-format))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1495
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1496 (defmacro speedbar-with-writable (&rest forms)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1497 "Allow the buffer to be writable and evaluate FORMS."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1498 (list 'let '((inhibit-read-only t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1499 '(toggle-read-only -1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1500 (cons 'progn forms)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1501 (put 'speedbar-with-writable 'lisp-indent-function 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1502
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1503 (defun speedbar-select-window (buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1504 "Select a window in which BUFFER is show.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1505 If it is not shown, force it to appear in the default window."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1506 (let ((win (get-buffer-window buffer speedbar-attached-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1507 (if win
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1508 (select-window win)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1509 (show-buffer (selected-window) buffer))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1510
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1511 (defmacro speedbar-with-attached-buffer (&rest forms)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1512 "Execute FORMS in the attached frame's special buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1513 Optionally select that frame if necessary."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1514 ;; Reset the timer with a new timeout when cliking a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1515 ;; in case the user was navigating directories, we can cancel
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1516 ;; that other timer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1517 (list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1518 'progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1519 '(speedbar-set-timer speedbar-update-speed)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1520 (list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1521 'let '((cf (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1522 '(select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1523 '(speedbar-select-window speedbar-desired-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1524 (cons 'progn forms)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1525 '(select-frame cf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1526 '(speedbar-maybee-jump-to-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1527 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1528
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1529 (defun speedbar-insert-button (text face mouse function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1530 &optional token prevline)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1531 "Insert TEXT as the next logical speedbar button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1532 FACE is the face to put on the button, MOUSE is the highlight face to use.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1533 When the user clicks on TEXT, FUNCTION is called with the TOKEN parameter.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1534 This function assumes that the current buffer is the speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1535 If PREVLINE, then put this button on the previous line.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1536
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1537 This is a convenience function for special mode that create their own
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1538 specialized speedbar displays."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1539 (goto-char (point-max))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1540 (if (/= (current-column) 0) (insert "\n"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1541 (if prevline (progn (delete-char -1) (insert " "))) ;back up if desired...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1542 (let ((start (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1543 (insert text)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1544 (speedbar-make-button start (point) face mouse function token))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1545 (let ((start (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1546 (insert "\n")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1547 (put-text-property start (point) 'face nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1548 (put-text-property start (point) 'mouse-face nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1549
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1550 (defun speedbar-make-button (start end face mouse function &optional token)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1551 "Create a button from START to END, with FACE as the display face.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1552 MOUSE is the mouse face. When this button is clicked on FUNCTION
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1553 will be run with the TOKEN parameter (any lisp object)"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1554 (put-text-property start end 'face face)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1555 (put-text-property start end 'mouse-face mouse)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1556 (put-text-property start end 'invisible nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1557 (if function (put-text-property start end 'speedbar-function function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1558 (if token (put-text-property start end 'speedbar-token token))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1559 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1560
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1561 ;;; File button management
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1562 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1563 (defun speedbar-file-lists (directory)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1564 "Create file lists for DIRECTORY.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1565 The car is the list of directories, the cdr is list of files not
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1566 matching ignored headers. Cache any directory files found in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1567 `speedbar-directory-contents-alist' and use that cache before scanning
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1568 the file-system"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1569 (setq directory (expand-file-name directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1570 ;; If in powerclick mode, then the directory we are getting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1571 ;; should be rescanned.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1572 (if speedbar-power-click
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1573 (adelete 'speedbar-directory-contents-alist directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1574 ;; find the directory, either in the cache, or build it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1575 (or (cdr-safe (assoc directory speedbar-directory-contents-alist))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1576 (let ((default-directory directory)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1577 (dir (directory-files directory nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1578 (dirs nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1579 (files nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1580 (while dir
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1581 (if (not (string-match speedbar-file-unshown-regexp (car dir)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1582 (if (file-directory-p (car dir))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1583 (setq dirs (cons (car dir) dirs))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1584 (setq files (cons (car dir) files))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1585 (setq dir (cdr dir)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1586 (let ((nl (cons (nreverse dirs) (list (nreverse files)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1587 (aput 'speedbar-directory-contents-alist directory nl)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1588 nl))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1589 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1590
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1591 (defun speedbar-directory-buttons (directory index)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1592 "Insert a single button group at point for DIRECTORY.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1593 Each directory path part is a different button. If part of the path
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1594 matches the user directory ~, then it is replaced with a ~.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1595 INDEX is not used, but is required by the caller."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1596 (let* ((tilde (expand-file-name "~"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1597 (dd (expand-file-name directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1598 (junk (string-match (regexp-quote tilde) dd))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1599 (displayme (if junk
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1600 (concat "~" (substring dd (match-end 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1601 dd))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1602 (p (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1603 (if (string-match "^~/?\\'" displayme) (setq displayme (concat tilde "/")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1604 (insert displayme)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1605 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1606 (goto-char p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1607 (while (re-search-forward "\\([^/]+\\)/" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1608 (speedbar-make-button (match-beginning 1) (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1609 'speedbar-directory-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1610 'speedbar-highlight-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1611 'speedbar-directory-buttons-follow
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1612 (if (= (match-beginning 1) p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1613 (expand-file-name "~/") ;the tilde
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1614 (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1615 p (match-end 0)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1616 ;; Nuke the beginning of the directory if it's too long...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1617 (cond ((eq speedbar-directory-button-trim-method 'span)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1618 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1619 (let ((ww (or (speedbar-frame-width) 20)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1620 (move-to-column ww nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1621 (while (>= (current-column) ww)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1622 (re-search-backward "/" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1623 (if (<= (current-column) 2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1624 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1625 (re-search-forward "/" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1626 (if (< (current-column) 4)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1627 (re-search-forward "/" nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1628 (forward-char -1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1629 (if (looking-at "/?$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1630 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1631 (insert "/...\n ")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1632 (move-to-column ww nil)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1633 ((eq speedbar-directory-button-trim-method 'trim)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1634 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1635 (let ((ww (or (speedbar-frame-width) 20))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1636 (tl (current-column)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1637 (if (< ww tl)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1638 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1639 (move-to-column (- tl ww))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1640 (if (re-search-backward "/" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1641 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1642 (delete-region (point-min) (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1643 (insert "$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1644 )))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1645 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1646 (if (string-match "\\`/[^/]+/\\'" displayme)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1647 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1648 (insert " ")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1649 (let ((p (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1650 (insert "<root>")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1651 (speedbar-make-button p (point)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1652 'speedbar-directory-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1653 'speedbar-highlight-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1654 'speedbar-directory-buttons-follow
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1655 "/"))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1656 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1657 (insert-char ?\n 1 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1658
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1659 (defun speedbar-make-tag-line (exp-button-type
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1660 exp-button-char exp-button-function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1661 exp-button-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1662 tag-button tag-button-function tag-button-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1663 tag-button-face depth)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1664 "Create a tag line with EXP-BUTTON-TYPE for the small expansion button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1665 This is the button that expands or contracts a node (if applicable),
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1666 and EXP-BUTTON-CHAR the character in it (+, -, ?, etc). EXP-BUTTON-FUNCTION
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1667 is the function to call if it's clicked on. Button types are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1668 'bracket, 'angle, 'curly, or nil. EXP-BUTTON-DATA is extra data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1669 attached to the text forming the expansion button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1670
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1671 Next, TAG-BUTTON is the text of the tag. TAG-BUTTON-FUNCTION is the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1672 function to call if clicked on, and TAG-BUTTON-DATA is the data to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1673 attach to the text field (such a tag positioning, etc).
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1674 TAG-BUTTON-FACE is a face used for this type of tag.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1675
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1676 Lastly, DEPTH shows the depth of expansion.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1677
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1678 This function assumes that the cursor is in the speedbar window at the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1679 position to insert a new item, and that the new item will end with a CR"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1680 (let ((start (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1681 (end (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1682 (insert (int-to-string depth) ":")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1683 (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1684 (put-text-property start end 'invisible t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1685 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1686 (insert-char ? depth nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1687 (put-text-property (- (point) depth) (point) 'invisible nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1688 (let* ((exp-button (cond ((eq exp-button-type 'bracket) "[%c]")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1689 ((eq exp-button-type 'angle) "<%c>")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1690 ((eq exp-button-type 'curly) "{%c}")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1691 (t ">")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1692 (buttxt (format exp-button exp-button-char))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1693 (start (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1694 (end (progn (insert buttxt) (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1695 (bf (if exp-button-type 'speedbar-button-face nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1696 (mf (if exp-button-function 'speedbar-highlight-face nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1697 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1698 (speedbar-make-button start end bf mf exp-button-function exp-button-data)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1699 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1700 (insert-char ? 1 nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1701 (put-text-property (1- (point)) (point) 'invisible nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1702 (let ((start (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1703 (end (progn (insert tag-button) (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1704 (insert-char ?\n 1 nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1705 (put-text-property (1- (point)) (point) 'invisible nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1706 (speedbar-make-button start end tag-button-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1707 (if tag-button-function 'speedbar-highlight-face nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1708 tag-button-function tag-button-data))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1709 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1710
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1711 (defun speedbar-change-expand-button-char (char)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1712 "Change the expansion button character to CHAR for the current line."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1713 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1714 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1715 (if (re-search-forward ":\\s-*.\\([-+?]\\)" (save-excursion (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1716 (point)) t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1717 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1718 (goto-char (match-beginning 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1719 (delete-char 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1720 (insert-char char 1 t)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1721
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1722
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1723 ;;; Build button lists
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1724 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1725 (defun speedbar-insert-files-at-point (files level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1726 "Insert list of FILES starting at point, and indenting all files to LEVEL.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1727 Tag expandable items with a +, otherwise a ?. Don't highlight ? as we
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1728 don't know how to manage them. The input parameter FILES is a cons
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1729 cell of the form ( 'DIRLIST . 'FILELIST )"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1730 ;; Start inserting all the directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1731 (let ((dirs (car files)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1732 (while dirs
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1733 (speedbar-make-tag-line 'angle ?+ 'speedbar-dired (car dirs)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1734 (car dirs) 'speedbar-dir-follow nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1735 'speedbar-directory-face level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1736 (setq dirs (cdr dirs))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1737 (let ((lst (car (cdr files))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1738 (while lst
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1739 (let* ((known (string-match speedbar-file-regexp (car lst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1740 (expchar (if known ?+ ??))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1741 (fn (if known 'speedbar-tag-file nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1742 (if (or speedbar-show-unknown-files (/= expchar ??))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1743 (speedbar-make-tag-line 'bracket expchar fn (car lst)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1744 (car lst) 'speedbar-find-file nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1745 'speedbar-file-face level)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1746 (setq lst (cdr lst)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1747
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1748 (defun speedbar-default-directory-list (directory index)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1749 "Insert files for DIRECTORY with level INDEX at point."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1750 (speedbar-insert-files-at-point
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1751 (speedbar-file-lists directory) index)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1752 (speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1753 (if (= index 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1754 ;; If the shown files variable has extra directories, then
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1755 ;; it is our responsibility to redraw them all
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1756 ;; Luckilly, the nature of inserting items into this list means
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1757 ;; that by reversing it, we can easilly go in the right order
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1758 (let ((sf (cdr (reverse speedbar-shown-directories))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1759 (setq speedbar-shown-directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1760 (list (expand-file-name default-directory)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1761 ;; exand them all as we find them
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1762 (while sf
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1763 (if (speedbar-goto-this-file (car sf))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1764 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1765 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1766 (if (looking-at "[0-9]+:[ ]*<")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1767 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1768 (goto-char (match-end 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1769 (speedbar-do-function-pointer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1770 (setq sf (cdr sf)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1771 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1772
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1773 (defun speedbar-insert-generic-list (level lst expand-fun find-fun)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1774 "At LEVEL, insert a generic multi-level alist LST.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1775 Associations with lists get {+} tags (to expand into more nodes) and
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1776 those with positions just get a > as the indicator. {+} buttons will
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1777 have the function EXPAND-FUN and the token is the CDR list. The token
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1778 name will have the function FIND-FUN and not token."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1779 ;; Remove imenu rescan button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1780 (if (string= (car (car lst)) "*Rescan*")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1781 (setq lst (cdr lst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1782 ;; insert the parts
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1783 (while lst
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1784 (cond ((null (car-safe lst)) nil) ;this would be a separator
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1785 ((or (numberp (cdr-safe (car-safe lst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1786 (markerp (cdr-safe (car-safe lst))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1787 (speedbar-make-tag-line nil nil nil nil ;no expand button data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1788 (car (car lst)) ;button name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1789 find-fun ;function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1790 (cdr (car lst)) ;token is position
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1791 'speedbar-tag-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1792 (1+ level)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1793 ((listp (cdr-safe (car-safe lst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1794 (speedbar-make-tag-line 'curly ?+ expand-fun (cdr (car lst))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1795 (car (car lst)) ;button name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1796 nil nil 'speedbar-tag-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1797 (1+ level)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1798 (t (message "Ooops!")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1799 (setq lst (cdr lst))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1800
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1801 ;;; Timed functions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1802 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1803 (defun speedbar-update-contents ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1804 "Generically update the contents of the speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1805 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1806 ;; Set the current special buffer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1807 (setq speedbar-desired-buffer nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1808 (if (and speedbar-mode-specific-contents-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1809 speedbar-special-mode-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1810 (local-variable-p
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1811 'speedbar-special-mode-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1812 (current-buffer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1813 ;;(eq (get major-mode 'mode-class 'special)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1814 (speedbar-update-special-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1815 (speedbar-update-directory-contents)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1816
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1817 (defun speedbar-update-directory-contents ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1818 "Update the contents of the speedbar buffer based on the current directory."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1819 (let ((cbd (expand-file-name default-directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1820 cbd-parent
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1821 (funclst speedbar-initial-expansion-list)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1822 (cache speedbar-full-text-cache)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1823 ;; disable stealth during update
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1824 (speedbar-stealthy-function-list nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1825 (use-cache nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1826 (expand-local nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1827 ;; Because there is a bug I can't find just yet
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1828 (inhibit-quit nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1829 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1830 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1831 ;; If we are updating contents to where we are, then this is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1832 ;; really a request to update existing contents, so we must be
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1833 ;; careful with our text cache!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1834 (if (member cbd speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1835 (setq cache nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1836
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1837 ;; Build cbd-parent, and see if THAT is in the current shown
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1838 ;; directories. First, go through pains to get the parent directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1839 (if (and speedbar-smart-directory-expand-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1840 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1841 (setq cbd-parent cbd)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1842 (if (string-match "/$" cbd-parent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1843 (setq cbd-parent (substring cbd-parent 0 (match-beginning 0))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1844 (setq cbd-parent (file-name-directory cbd-parent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1845 (member cbd-parent speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1846 (setq expand-local t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1847
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1848 ;; If this directory is NOT in the current list of available
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1849 ;; paths, then use the cache, and set the cache to our new
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1850 ;; value. Make sure to unhighlight the current file, or if we
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1851 ;; come back to this directory, it might be a different file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1852 ;; and then we get a mess!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1853 (if (> (point-max) 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1854 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1855 (speedbar-clear-current-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1856 (setq speedbar-full-text-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1857 (cons speedbar-shown-directories (buffer-string)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1858
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1859 ;; Check if our new directory is in the list of directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1860 ;; shown in the text-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1861 (if (member cbd (car cache))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1862 (setq speedbar-shown-directories (car cache)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1863 use-cache t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1864 ;; default the shown directories to this list...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1865 (setq speedbar-shown-directories (list cbd)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1866 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1867 (setq speedbar-last-selected-file nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1868 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1869 (if (and expand-local
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1870 ;; Find this directory as a speedbar node.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1871 (speedbar-path-line cbd))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1872 ;; Open it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1873 (speedbar-expand-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1874 (erase-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1875 (cond (use-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1876 (setq default-directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1877 (nth (1- (length speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1878 speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1879 (insert (cdr cache)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1880 (t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1881 (while funclst
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1882 (setq default-directory cbd)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1883 (funcall (car funclst) cbd 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1884 (setq funclst (cdr funclst))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1885 (goto-char (point-min)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1886 (speedbar-reconfigure-menubar))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1887
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1888 (defun speedbar-update-special-contents ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1889 "Used the mode-specific variable to fill in the speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1890 This should only be used by modes classified as special."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1891 (let ((funclst speedbar-special-mode-expansion-list)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1892 (specialbuff (current-buffer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1893 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1894 (setq speedbar-desired-buffer specialbuff)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1895 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1896 ;; If we are leaving a directory, cache it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1897 (if (not speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1898 ;; Do nothing
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1899 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1900 ;; Clean up directory maintenance stuff
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1901 (speedbar-clear-current-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1902 (setq speedbar-full-text-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1903 (cons speedbar-shown-directories (buffer-string))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1904 speedbar-shown-directories nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1905 ;; Now fill in the buffer with our newly found specialized list.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1906 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1907 (while funclst
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1908 ;; We do not erase the buffer because these functions may
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1909 ;; decide NOT to update themselves.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1910 (funcall (car funclst) specialbuff)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1911 (setq funclst (cdr funclst))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1912 (goto-char (point-min))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1913 (speedbar-reconfigure-menubar))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1914
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1915 (defun speedbar-timer-fn ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1916 "Run whenever emacs is idle to update the speedbar item."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1917 (if (not (and (frame-live-p speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1918 (frame-live-p speedbar-attached-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1919 (speedbar-set-timer nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1920 ;; Save all the match data so that we don't mess up executing fns
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1921 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1922 (if (and (frame-visible-p speedbar-frame) speedbar-update-flag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1923 (let ((af (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1924 (save-window-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1925 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1926 ;; make sure we at least choose a window to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1927 ;; get a good directory from
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1928 (if (string-match "\\*Minibuf-[0-9]+\\*" (buffer-name))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1929 (other-window 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1930 ;; Update for special mode all the time!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1931 (if (and speedbar-mode-specific-contents-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1932 speedbar-special-mode-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1933 (local-variable-p
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1934 'speedbar-special-mode-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1935 (current-buffer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1936 ;;(eq (get major-mode 'mode-class 'special)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1937 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1938 (if (<= 2 speedbar-verbosity-level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1939 (message "Updating speedbar to special mode: %s..."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1940 major-mode))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1941 (speedbar-update-special-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1942 (if (<= 2 speedbar-verbosity-level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1943 (message "Updating speedbar to special mode: %s...done"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1944 major-mode)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1945 ;; Update all the contents if directories change!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1946 (if (or (member (expand-file-name default-directory)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1947 speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1948 (and speedbar-ignored-path-regexp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1949 (string-match
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1950 speedbar-ignored-path-regexp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1951 (expand-file-name default-directory)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1952 (member major-mode speedbar-ignored-modes)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1953 (eq af speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1954 (not (buffer-file-name)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1955 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1956 (if (<= 1 speedbar-verbosity-level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1957 (message "Updating speedbar to: %s..."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1958 default-directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1959 (speedbar-update-directory-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1960 (if (<= 1 speedbar-verbosity-level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1961 (message "Updating speedbar to: %s...done"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1962 default-directory))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1963 (select-frame af))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1964 ;; Now run stealthy updates of time-consuming items
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1965 (speedbar-stealthy-updates)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1966 (run-hooks 'speedbar-timer-hook))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1967
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1968
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1969 ;;; Stealthy activities
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1970 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1971 (defun speedbar-stealthy-updates ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1972 "For a given speedbar, run all items in the stealthy function list.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1973 Each item returns t if it completes successfully, or nil if
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1974 interrupted by the user."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1975 (let ((l speedbar-stealthy-function-list))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1976 (unwind-protect
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1977 (while (and l (funcall (car l)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1978 (sit-for 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1979 (setq l (cdr l)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1980 ;(message "Exit with %S" (car l))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1981 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1982
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1983 (defun speedbar-reset-scanners ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1984 "Reset any variables used by functions in the stealthy list as state.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1985 If new functions are added, their state needs to be updated here."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1986 (setq speedbar-vc-to-do-point t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1987 (run-hooks 'speedbar-scanner-reset-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1988 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1989
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1990 (defun speedbar-clear-current-file ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1991 "Locate the file thought to be current, and remove its highlighting."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1992 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1993 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1994 (if speedbar-last-selected-file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1995 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1996 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1997 (if (and
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1998 speedbar-last-selected-file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1999 (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2000 (concat " \\(" (regexp-quote speedbar-last-selected-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2001 "\\)\\(" (regexp-quote speedbar-vc-indicator)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2002 "\\)?\n")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2003 nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2004 (put-text-property (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2005 (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2006 'face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2007 'speedbar-file-face))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2008
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2009 (defun speedbar-update-current-file ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2010 "Find the current file, and update our visuals to indicate its name.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2011 This is specific to file names. If the file name doesn't show up, but
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2012 it should be in the list, then the directory cache needs to be
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2013 updated."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2014 (let* ((lastf (selected-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2015 (newcfd (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2016 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2017 (let ((rf (if (buffer-file-name)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2018 (buffer-file-name)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2019 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2020 (select-frame lastf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2021 rf)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2022 (newcf (if newcfd (file-name-nondirectory newcfd)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2023 (lastb (current-buffer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2024 (sucf-recursive (boundp 'sucf-recursive)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2025 (if (and newcf
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2026 ;; check here, that way we won't refresh to newcf until
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2027 ;; its been written, thus saving ourselves some time
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2028 (file-exists-p newcf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2029 (not (string= newcf speedbar-last-selected-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2030 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2031 ;; It is important to select the frame, otherwise the window
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2032 ;; we want the cursor to move in will not be updated by the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2033 ;; search-forward command.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2034 (select-frame speedbar-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2035 ;; Remove the old file...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2036 (speedbar-clear-current-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2037 ;; now highlight the new one.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2038 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2039 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2040 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2041 (if (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2042 (concat " \\(" (regexp-quote newcf) "\\)\\("
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2043 (regexp-quote speedbar-vc-indicator)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2044 "\\)?\n") nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2045 ;; put the property on it
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2046 (put-text-property (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2047 (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2048 'face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2049 'speedbar-selected-face)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2050 ;; Oops, it's not in the list. Should it be?
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2051 (if (and (string-match speedbar-file-regexp newcf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2052 (string= (file-name-directory newcfd)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2053 (expand-file-name default-directory)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2054 ;; yes, it is (we will ignore unknowns for now...)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2055 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2056 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2057 (if (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2058 (concat " \\(" (regexp-quote newcf) "\\)\n") nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2059 ;; put the property on it
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2060 (put-text-property (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2061 (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2062 'face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2063 'speedbar-selected-face)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2064 ;; if it's not in there now, whatever...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2065 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2066 (setq speedbar-last-selected-file newcf))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2067 (if (not sucf-recursive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2068 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2069 (forward-line -1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2070 (speedbar-position-cursor-on-line)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2071 (set-buffer lastb)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2072 (select-frame lastf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2073 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2074 ;; return that we are done with this activity.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2075 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2076
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2077 ;; Load ange-ftp only if compiling to remove errors.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2078 ;; Steven L Baur <steve@xemacs.org> said this was important:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2079 (eval-when-compile (or (featurep 'xemacs) (require 'ange-ftp)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2080
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2081 (defun speedbar-check-vc ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2082 "Scan all files in a directory, and for each see if it's checked out.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2083 See `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p' for how
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2084 to add more types of version control systems."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2085 ;; Check for to-do to be reset. If reset but no RCS is available
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2086 ;; then set to nil (do nothing) otherwise, start at the beginning
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2087 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2088 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2089 (if (and speedbar-vc-do-check (eq speedbar-vc-to-do-point t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2090 (speedbar-vc-check-dir-p default-directory)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2091 (not (and (featurep 'ange-ftp)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2092 (string-match (car
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2093 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2094 ange-ftp-path-format
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2095 ange-ftp-name-format))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2096 (expand-file-name default-directory)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2097 (setq speedbar-vc-to-do-point 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2098 (if (numberp speedbar-vc-to-do-point)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2099 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2100 (goto-char speedbar-vc-to-do-point)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2101 (while (and (not (input-pending-p))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2102 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-]\\] "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2103 nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2104 (setq speedbar-vc-to-do-point (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2105 (if (speedbar-check-vc-this-line (match-string 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2106 (if (not (looking-at (regexp-quote speedbar-vc-indicator)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2107 (speedbar-with-writable (insert speedbar-vc-indicator)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2108 (if (looking-at (regexp-quote speedbar-vc-indicator))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2109 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2110 (delete-region (match-beginning 0) (match-end 0))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2111 (if (input-pending-p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2112 ;; return that we are incomplete
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2113 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2114 ;; we are done, set to-do to nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2115 (setq speedbar-vc-to-do-point nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2116 ;; and return t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2117 t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2118 t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2119
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2120 (defun speedbar-check-vc-this-line (depth)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2121 "Return t if the file on this line is check of of a version control system.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2122 Parameter DEPTH is a string with the current depth of indentation of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2123 the file being checked."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2124 (let* ((d (string-to-int depth))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2125 (f (speedbar-line-path d))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2126 (fn (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2127 ;; Skip-chars: thanks ptype@dra.hmg.gb
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2128 (point) (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2129 (skip-chars-forward "^ "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2130 (save-excursion (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2131 (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2132 (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2133 (fulln (concat f fn)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2134 (if (<= 2 speedbar-verbosity-level)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2135 (message "Speedbar vc check...%s" fulln))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2136 (and (file-writable-p fulln)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2137 (speedbar-this-file-in-vc f fn))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2138
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2139 (defun speedbar-vc-check-dir-p (path)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2140 "Return t if we should bother checking PATH for version control files.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2141 This can be overloaded to add new types of version control systems."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2142 (or
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2143 ;; Local RCS
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2144 (file-exists-p (concat path "RCS/"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2145 ;; Local SCCS
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2146 (file-exists-p (concat path "SCCS/"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2147 ;; Remote SCCS project
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2148 (let ((proj-dir (getenv "PROJECTDIR")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2149 (if proj-dir
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2150 (file-exists-p (concat proj-dir "/SCCS"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2151 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2152 ;; User extension
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2153 (run-hook-with-args 'speedbar-vc-path-enable-hook path)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2154 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2155
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2156 (defun speedbar-this-file-in-vc (path name)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2157 "Check to see if the file in PATH with NAME is in a version control system.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2158 You can add new VC systems by overriding this function. You can
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2159 optimize this function by overriding it and only doing those checks
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2160 that will occur on your system."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2161 (or
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2162 ;; RCS file name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2163 (file-exists-p (concat path "RCS/" name ",v"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2164 ;; Local SCCS file name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2165 (file-exists-p (concat path "SCCS/p." name))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2166 ;; Remote SCCS file name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2167 (let ((proj-dir (getenv "PROJECTDIR")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2168 (if proj-dir
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2169 (file-exists-p (concat proj-dir "/SCCS/p." name))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2170 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2171 ;; User extension
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2172 (run-hook-with-args 'speedbar-vc-in-control-hook path name)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2173 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2174
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2175 ;;; Clicking Activity
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2176 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2177 (defun speedbar-quick-mouse (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2178 "Since mouse events are strange, this will keep the mouse nicely positioned.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2179 This should be bound to mouse event E."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2180 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2181 (mouse-set-point e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2182 (speedbar-position-cursor-on-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2183 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2184
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2185 (defun speedbar-position-cursor-on-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2186 "Position the cursor on a line."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2187 (let ((oldpos (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2188 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2189 (if (looking-at "[0-9]+:\\s-*..?.? ")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2190 (goto-char (1- (match-end 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2191 (goto-char oldpos))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2192
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2193 (defun speedbar-power-click (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2194 "Activate any speedbar button as a power click.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2195 This should be bound to mouse event E."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2196 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2197 (let ((speedbar-power-click t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2198 (speedbar-click e)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2199
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2200 (defun speedbar-click (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2201 "Activate any speedbar buttons where the mouse is clicked.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2202 This must be bound to a mouse event. A button is any location of text
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2203 with a mouse face that has a text property called `speedbar-function'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2204 This should be bound to mouse event E."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2205 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2206 (mouse-set-point e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2207 (speedbar-do-function-pointer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2208 (speedbar-quick-mouse e))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2209
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2210 (defun speedbar-double-click (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2211 "Activate any speedbar buttons where the mouse is clicked.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2212 This must be bound to a mouse event. A button is any location of text
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2213 with a mouse face that has a text property called `speedbar-function'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2214 This should be bound to mouse event E."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2215 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2216 ;; Emacs only. XEmacs handles this via `mouse-track-click-hook'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2217 (cond ((eq (car e) 'down-mouse-1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2218 (mouse-set-point e))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2219 ((eq (car e) 'mouse-1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2220 (speedbar-quick-mouse e))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2221 ((or (eq (car e) 'double-down-mouse-1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2222 (eq (car e) 'tripple-down-mouse-1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2223 (mouse-set-point e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2224 (speedbar-do-function-pointer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2225 (speedbar-quick-mouse e))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2226
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2227 (defun speedbar-do-function-pointer ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2228 "Look under the cursor and examine the text properties.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2229 From this extract the file/tag name, token, indentation level and call
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2230 a function if appropriate"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2231 (let* ((fn (get-text-property (point) 'speedbar-function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2232 (tok (get-text-property (point) 'speedbar-token))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2233 ;; The 1-,+ is safe because scaning starts AFTER the point
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2234 ;; specified. This lets the search include the character the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2235 ;; cursor is on.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2236 (tp (previous-single-property-change
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2237 (1+ (point)) 'speedbar-function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2238 (np (next-single-property-change
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2239 (point) 'speedbar-function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2240 (txt (buffer-substring-no-properties (or tp (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2241 (or np (point-max))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2242 (dent (save-excursion (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2243 (string-to-number
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2244 (if (looking-at "[0-9]+")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2245 (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2246 (match-beginning 0) (match-end 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2247 "0")))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2248 ;;(message "%S:%S:%S:%s" fn tok txt dent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2249 (and fn (funcall fn txt tok dent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2250 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2251
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2252 ;;; Reading info from the speedbar buffer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2253 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2254 (defun speedbar-line-file (&optional p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2255 "Retrieve the file or whatever from the line at P point.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2256 The return value is a string representing the file. If it is a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2257 directory, then it is the directory name."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2258 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2259 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2260 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2261 (if (looking-at (concat
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2262 "\\([0-9]+\\): *[[<][-+?][]>] \\([^ \n]+\\)\\("
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2263 (regexp-quote speedbar-vc-indicator)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2264 "\\)?"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2265 (let* ((depth (string-to-int (match-string 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2266 (path (speedbar-line-path depth))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2267 (f (match-string 2)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2268 (concat path f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2269 nil))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2270
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2271 (defun speedbar-goto-this-file (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2272 "If FILE is displayed, goto this line and return t.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2273 Otherwise do not move and return nil."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2274 (let ((path (substring (file-name-directory (expand-file-name file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2275 (length (expand-file-name default-directory))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2276 (dest (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2277 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2278 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2279 ;; scan all the directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2280 (while (and path (not (eq path t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2281 (if (string-match "^/?\\([^/]+\\)" path)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2282 (let ((pp (match-string 1 path)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2283 (if (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2284 (re-search-forward (concat "> " (regexp-quote pp) "$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2285 nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2286 (setq path (substring path (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2287 (setq path nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2288 (setq path t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2289 ;; find the file part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2290 (if (or (not path) (string= (file-name-nondirectory file) ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2291 ;; only had a dir part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2292 (if path
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2293 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2294 (speedbar-position-cursor-on-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2295 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2296 (goto-char dest) nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2297 ;; find the file part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2298 (let ((nd (file-name-nondirectory file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2299 (if (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2300 (concat "] \\(" (regexp-quote nd)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2301 "\\)\\(" (regexp-quote speedbar-vc-indicator) "\\)?$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2302 nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2303 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2304 (speedbar-position-cursor-on-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2305 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2306 (goto-char dest)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2307 nil))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2308
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2309 (defun speedbar-line-path (depth)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2310 "Retrieve the pathname associated with the current line.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2311 This may require traversing backwards from DEPTH and combining the default
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2312 directory with these items."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2313 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2314 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2315 (let ((path nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2316 (setq depth (1- depth))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2317 (while (/= depth -1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2318 (if (not (re-search-backward (format "^%d:" depth) nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2319 (error "Error building path of tag")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2320 (cond ((looking-at "[0-9]+:\\s-*<->\\s-+\\([^\n]+\\)$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2321 (setq path (concat (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2322 (match-beginning 1) (match-end 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2323 "/"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2324 path)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2325 ((looking-at "[0-9]+:\\s-*[-]\\s-+\\([^\n]+\\)$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2326 ;; This is the start of our path.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2327 (setq path (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2328 (match-beginning 1) (match-end 1))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2329 (setq depth (1- depth)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2330 (if (and path
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2331 (string-match (concat (regexp-quote speedbar-vc-indicator) "$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2332 path))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2333 (setq path (substring path 0 (match-beginning 0))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2334 (concat default-directory path)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2335
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2336 (defun speedbar-path-line (path)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2337 "Position the cursor on the line specified by PATH."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2338 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2339 (if (string-match "/$" path)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2340 (setq path (substring path 0 (match-beginning 0))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2341 (let ((nomatch t) (depth 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2342 (fname (file-name-nondirectory path))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2343 (pname (file-name-directory path)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2344 (if (not (member pname speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2345 (error "Internal Error: File %s not shown in speedbar." path))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2346 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2347 (while (and nomatch
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2348 (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2349 (concat "[]>] \\(" (regexp-quote fname)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2350 "\\)\\(" (regexp-quote speedbar-vc-indicator) "\\)?$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2351 nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2352 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2353 (looking-at "\\([0-9]+\\):")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2354 (setq depth (string-to-int (match-string 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2355 nomatch (not (string= pname (speedbar-line-path depth))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2356 (end-of-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2357 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2358 (not nomatch))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2359
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2360 (defun speedbar-edit-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2361 "Edit whatever tag or file is on the current speedbar line."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2362 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2363 (or (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2364 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2365 ;; If this fails, then it is a non-standard click, and as such,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2366 ;; perfectly allowed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2367 (if (re-search-forward "[]>}] [a-zA-Z0-9]"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2368 (save-excursion (end-of-line) (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2369 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2370 (speedbar-do-function-pointer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2371 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2372 (speedbar-do-function-pointer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2373
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2374 (defun speedbar-expand-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2375 "Expand the line under the cursor."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2376 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2377 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2378 (re-search-forward ":\\s-*.\\+. " (save-excursion (end-of-line) (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2379 (forward-char -2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2380 (speedbar-do-function-pointer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2381
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2382 (defun speedbar-contract-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2383 "Contract the line under the cursor."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2384 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2385 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2386 (re-search-forward ":\\s-*.-. " (save-excursion (end-of-line) (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2387 (forward-char -2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2388 (speedbar-do-function-pointer))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2389
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2390 (if speedbar-xemacsp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2391 (defalias 'speedbar-mouse-event-p 'button-press-event-p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2392 (defun speedbar-mouse-event-p (event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2393 "Return t if the event is a mouse related event"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2394 ;; And Emacs does it this way
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2395 (if (and (listp event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2396 (member (event-basic-type event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2397 '(mouse-1 mouse-2 mouse-3)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2398 t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2399 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2400
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2401 (defun speedbar-maybee-jump-to-attached-frame ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2402 "Jump to the attached frame ONLY if this was not a mouse event."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2403 (if (or (not (speedbar-mouse-event-p last-input-event))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2404 speedbar-activity-change-focus-flag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2405 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2406 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2407 (other-frame 0))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2408
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2409 (defun speedbar-find-file (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2410 "Speedbar click handler for filenames.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2411 TEXT, the file will be displayed in the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2412 TOKEN is unused, but required by the click handler. INDENT is the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2413 current indentation level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2414 (let ((cdd (speedbar-line-path indent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2415 (speedbar-find-file-in-frame (concat cdd text))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2416 (speedbar-stealthy-updates)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2417 (run-hooks 'speedbar-visiting-file-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2418 ;; Reset the timer with a new timeout when cliking a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2419 ;; in case the user was navigating directories, we can cancel
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2420 ;; that other timer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2421 (speedbar-set-timer speedbar-update-speed))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2422 (speedbar-maybee-jump-to-attached-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2423
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2424 (defun speedbar-dir-follow (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2425 "Speedbar click handler for directory names.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2426 Clicking a directory will cause the speedbar to list files in the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2427 the subdirectory TEXT. TOKEN is an unused requirement. The
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2428 subdirectory chosen will be at INDENT level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2429 (setq default-directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2430 (concat (expand-file-name (concat (speedbar-line-path indent) text))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2431 "/"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2432 ;; Because we leave speedbar as the current buffer,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2433 ;; update contents will change directory without
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2434 ;; having to touch the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2435 (speedbar-update-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2436 (speedbar-set-timer speedbar-navigating-speed)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2437 (setq speedbar-last-selected-file nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2438 (speedbar-stealthy-updates))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2439
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2440 (defun speedbar-delete-subblock (indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2441 "Delete text from point to indentation level INDENT or greater.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2442 Handles end-of-sublist smartly."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2443 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2444 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2445 (end-of-line) (forward-char 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2446 (while (and (not (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2447 (re-search-forward (format "^%d:" indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2448 nil t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2449 (>= indent 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2450 (setq indent (1- indent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2451 (delete-region (point) (if (>= indent 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2452 (match-beginning 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2453 (point-max))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2454
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2455 (defun speedbar-dired (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2456 "Speedbar click handler for directory expand button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2457 Clicking this button expands or contracts a directory. TEXT is the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2458 button clicked which has either a + or -. TOKEN is the directory to be
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2459 expanded. INDENT is the current indentation level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2460 (cond ((string-match "+" text) ;we have to expand this dir
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2461 (setq speedbar-shown-directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2462 (cons (expand-file-name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2463 (concat (speedbar-line-path indent) token "/"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2464 speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2465 (speedbar-change-expand-button-char ?-)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2466 (speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2467 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2468 (end-of-line) (forward-char 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2469 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2470 (speedbar-default-directory-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2471 (concat (speedbar-line-path indent) token "/")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2472 (1+ indent)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2473 ((string-match "-" text) ;we have to contract this node
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2474 (speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2475 (let ((oldl speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2476 (newl nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2477 (td (expand-file-name
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2478 (concat (speedbar-line-path indent) token))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2479 (while oldl
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2480 (if (not (string-match (concat "^" (regexp-quote td)) (car oldl)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2481 (setq newl (cons (car oldl) newl)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2482 (setq oldl (cdr oldl)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2483 (setq speedbar-shown-directories newl))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2484 (speedbar-change-expand-button-char ?+)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2485 (speedbar-delete-subblock indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2486 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2487 (t (error "Ooops... not sure what to do.")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2488 (speedbar-center-buffer-smartly)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2489 (setq speedbar-last-selected-file nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2490 (save-excursion (speedbar-stealthy-updates)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2491
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2492 (defun speedbar-directory-buttons-follow (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2493 "Speedbar click handler for default directory buttons.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2494 TEXT is the button clicked on. TOKEN is the directory to follow.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2495 INDENT is the current indentation level and is unused."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2496 (setq default-directory token)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2497 ;; Because we leave speedbar as the current buffer,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2498 ;; update contents will change directory without
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2499 ;; having to touch the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2500 (speedbar-update-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2501 (speedbar-set-timer speedbar-navigating-speed))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2502
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2503 (defun speedbar-tag-file (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2504 "The cursor is on a selected line. Expand the tags in the specified file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2505 The parameter TEXT and TOKEN are required, where TEXT is the button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2506 clicked, and TOKEN is the file to expand. INDENT is the current
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2507 indentation level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2508 (cond ((string-match "+" text) ;we have to expand this file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2509 (let* ((fn (expand-file-name (concat (speedbar-line-path indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2510 token)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2511 (lst (if speedbar-use-imenu-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2512 (let ((tim (speedbar-fetch-dynamic-imenu fn)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2513 (if (eq tim t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2514 (speedbar-fetch-dynamic-etags fn)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2515 tim))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2516 (speedbar-fetch-dynamic-etags fn))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2517 ;; if no list, then remove expando button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2518 (if (not lst)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2519 (speedbar-change-expand-button-char ??)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2520 (speedbar-change-expand-button-char ?-)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2521 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2522 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2523 (end-of-line) (forward-char 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2524 (speedbar-insert-generic-list indent
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2525 lst 'speedbar-tag-expand
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2526 'speedbar-tag-find))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2527 ((string-match "-" text) ;we have to contract this node
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2528 (speedbar-change-expand-button-char ?+)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2529 (speedbar-delete-subblock indent))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2530 (t (error "Ooops... not sure what to do.")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2531 (speedbar-center-buffer-smartly))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2532
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2533 (defun speedbar-tag-find (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2534 "For the tag TEXT in a file TOKEN, goto that position.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2535 INDENT is the current indentation level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2536 (let ((file (speedbar-line-path indent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2537 (speedbar-find-file-in-frame file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2538 (save-excursion (speedbar-stealthy-updates))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2539 ;; Reset the timer with a new timeout when cliking a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2540 ;; in case the user was navigating directories, we can cancel
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2541 ;; that other timer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2542 (speedbar-set-timer speedbar-update-speed)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2543 (goto-char token)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2544 (run-hooks 'speedbar-visiting-tag-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2545 ;;(recenter)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2546 (speedbar-maybee-jump-to-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2547 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2548
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2549 (defun speedbar-tag-expand (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2550 "Expand a tag sublist. Imenu will return sub-lists of specialized tag types.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2551 Etags does not support this feature. TEXT will be the button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2552 string. TOKEN will be the list, and INDENT is the current indentation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2553 level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2554 (cond ((string-match "+" text) ;we have to expand this file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2555 (speedbar-change-expand-button-char ?-)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2556 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2557 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2558 (end-of-line) (forward-char 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2559 (speedbar-insert-generic-list indent
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2560 token 'speedbar-tag-expand
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2561 'speedbar-tag-find))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2562 ((string-match "-" text) ;we have to contract this node
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2563 (speedbar-change-expand-button-char ?+)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2564 (speedbar-delete-subblock indent))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2565 (t (error "Ooops... not sure what to do.")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2566 (speedbar-center-buffer-smartly))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2567
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2568 ;;; Loading files into the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2569 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2570 (defun speedbar-find-file-in-frame (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2571 "This will load FILE into the speedbar attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2572 If the file is being displayed in a different frame already, then raise that
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2573 frame instead."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2574 (let* ((buff (find-file-noselect file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2575 (bwin (get-buffer-window buff 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2576 (if bwin
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2577 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2578 (select-window bwin)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2579 (raise-frame (window-frame bwin)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2580 (if speedbar-power-click
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2581 (let ((pop-up-frames t)) (select-window (display-buffer buff)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2582 (select-frame speedbar-attached-frame)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2583 (switch-to-buffer buff))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2584 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2585
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2586 ;;; Centering Utility
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2587 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2588 (defun speedbar-center-buffer-smartly ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2589 "Recenter a speedbar buffer so the current indentation level is all visible.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2590 This assumes that the cursor is on a file, or tag of a file which the user is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2591 interested in."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2592 (if (<= (count-lines (point-min) (point-max))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2593 (window-height (selected-window)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2594 ;; whole buffer fits
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2595 (let ((cp (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2596 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2597 (recenter 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2598 (goto-char cp))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2599 ;; too big
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2600 (let (depth start end exp p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2601 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2602 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2603 (setq depth (if (looking-at "[0-9]+")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2604 (string-to-int (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2605 (match-beginning 0) (match-end 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2606 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2607 (setq exp (format "^%d:\\s-*[[{<]\\([?+-]\\)[]>}]" depth)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2608 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2609 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2610 (if (re-search-backward exp nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2611 (setq start (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2612 (error "Center error"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2613 (save-excursion ;Not sure about this part.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2614 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2615 (setq p (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2616 (while (and (not (re-search-forward exp nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2617 (>= depth 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2618 (setq depth (1- depth))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2619 (setq exp (format "^%d:\\s-*[[{<]\\([?+-]\\)[]>}]" depth)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2620 (if (/= (point) p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2621 (setq end (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2622 (setq end (point-max)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2623 ;; Now work out the details of centering
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2624 (let ((nl (count-lines start end))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2625 (cp (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2626 (if (> nl (window-height (selected-window)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2627 ;; We can't fit it all, so just center on cursor
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2628 (progn (goto-char start)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2629 (recenter 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2630 ;; we can fit everything on the screen, but...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2631 (if (and (pos-visible-in-window-p start (selected-window))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2632 (pos-visible-in-window-p end (selected-window)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2633 ;; we are all set!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2634 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2635 ;; we need to do something...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2636 (goto-char start)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2637 (let ((newcent (/ (- (window-height (selected-window)) nl) 2))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2638 (lte (count-lines start (point-max))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2639 (if (and (< (+ newcent lte) (window-height (selected-window)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2640 (> (- (window-height (selected-window)) lte 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2641 newcent))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2642 (setq newcent (- (window-height (selected-window))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2643 lte 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2644 (recenter newcent))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2645 (goto-char cp)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2646
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2647
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2648 ;;; Tag Management -- Imenu
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2649 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2650 (if (not speedbar-use-imenu-flag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2651
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2652 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2653
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2654 (eval-when-compile (if (locate-library "imenu") (require 'imenu)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2655
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2656 (defun speedbar-fetch-dynamic-imenu (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2657 "Load FILE into a buffer, and generate tags using Imenu.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2658 Returns the tag list, or t for an error."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2659 ;; Load this AND compile it in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2660 (require 'imenu)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2661 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2662 (set-buffer (find-file-noselect file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2663 (if speedbar-power-click (setq imenu--index-alist nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2664 (condition-case nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2665 (let ((index-alist (imenu--make-index-alist t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2666 (if speedbar-sort-tags
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2667 (sort (copy-alist index-alist)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2668 (lambda (a b) (string< (car a) (car b))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2669 index-alist))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2670 (error t))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2671 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2672
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2673 ;;; Tag Management -- etags (old XEmacs compatibility part)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2674 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2675 (defvar speedbar-fetch-etags-parse-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2676 '(;; Note that java has the same parse-group as c
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2677 ("\\.\\([cChH]\\|c\\+\\+\\|cpp\\|cc\\|hh\\|java\\)\\'" .
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2678 speedbar-parse-c-or-c++tag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2679 ("^\\.emacs$\\|.\\(el\\|l\\|lsp\\)\\'" .
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2680 "def[^i]+\\s-+\\(\\(\\w\\|[-_]\\)+\\)\\s-*\C-?")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2681 ("\\.tex\\'" . speedbar-parse-tex-string)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2682 ("\\.p\\'" .
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2683 "\\(\\(FUNCTION\\|function\\|PROCEDURE\\|procedure\\)\\s-+\\([a-zA-Z0-9_.:]+\\)\\)\\s-*(?^?")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2684 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2685 "Associations of file extensions and expressions for extracting tags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2686 To add a new file type, you would want to add a new association to the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2687 list, where the car is the file match, and the cdr is the way to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2688 extract an element from the tags output. If the output is complex,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2689 use a function symbol instead of regexp. The function should expect
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2690 to be at the beginning of a line in the etags buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2691
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2692 This variable is ignored if `speedbar-use-imenu-flag' is non-nil.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2693
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2694 (defvar speedbar-fetch-etags-command "etags"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2695 "*Command used to create an etags file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2696
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2697 This variable is ignored if `speedbar-use-imenu-flag' is t")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2698
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2699 (defvar speedbar-fetch-etags-arguments '("-D" "-I" "-o" "-")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2700 "*List of arguments to use with `speedbar-fetch-etags-command'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2701 This creates an etags output buffer. Use `speedbar-toggle-etags' to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2702 modify this list conveniently.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2703
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2704 This variable is ignored if `speedbar-use-imenu-flag' is t")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2705
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2706 (defun speedbar-toggle-etags (flag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2707 "Toggle FLAG in `speedbar-fetch-etags-arguments'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2708 FLAG then becomes a member of etags command line arguments. If flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2709 is \"sort\", then toggle the value of `speedbar-sort-tags'. If its
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2710 value is \"show\" then toggle the value of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2711 `speedbar-show-unknown-files'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2712
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2713 This function is a convenience function for XEmacs menu created by
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2714 Farzin Guilak <farzin@protocol.com>"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2715 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2716 (cond
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2717 ((equal flag "sort")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2718 (setq speedbar-sort-tags (not speedbar-sort-tags)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2719 ((equal flag "show")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2720 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2721 ((or (equal flag "-C")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2722 (equal flag "-S")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2723 (equal flag "-D"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2724 (if (member flag speedbar-fetch-etags-arguments)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2725 (setq speedbar-fetch-etags-arguments
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2726 (delete flag speedbar-fetch-etags-arguments))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2727 (add-to-list 'speedbar-fetch-etags-arguments flag)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2728 (t nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2729
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2730 (defun speedbar-fetch-dynamic-etags (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2731 "For FILE, run etags and create a list of symbols extracted.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2732 Each symbol will be associated with its line position in FILE."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2733 (let ((newlist nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2734 (unwind-protect
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2735 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2736 (if (get-buffer "*etags tmp*")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2737 (kill-buffer "*etags tmp*")) ;kill to clean it up
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2738 (if (<= 1 speedbar-verbosity-level) (message "Fetching etags..."))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2739 (set-buffer (get-buffer-create "*etags tmp*"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2740 (apply 'call-process speedbar-fetch-etags-command nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2741 (current-buffer) nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2742 (append speedbar-fetch-etags-arguments (list file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2743 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2744 (if (<= 1 speedbar-verbosity-level) (message "Fetching etags..."))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2745 (let ((expr
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2746 (let ((exprlst speedbar-fetch-etags-parse-list)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2747 (ans nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2748 (while (and (not ans) exprlst)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2749 (if (string-match (car (car exprlst)) file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2750 (setq ans (car exprlst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2751 (setq exprlst (cdr exprlst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2752 (cdr ans))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2753 (if expr
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2754 (let (tnl)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2755 (while (not (save-excursion (end-of-line) (eobp)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2756 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2757 (setq tnl (speedbar-extract-one-symbol expr)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2758 (if tnl (setq newlist (cons tnl newlist)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2759 (forward-line 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2760 (message "Sorry, no support for a file of that extension"))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2761 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2762 (if speedbar-sort-tags
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2763 (sort newlist (lambda (a b) (string< (car a) (car b))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2764 (reverse newlist))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2765
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2766 ;; This bit donated by Farzin Guilak <farzin@protocol.com> but I'm not
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2767 ;; sure it's needed with the different sorting method.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2768 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2769 ;(defun speedbar-clean-etags()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2770 ; "Removes spaces before the ^? character, and removes `#define',
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2771 ;return types, etc. preceding tags. This ensures that the sort operation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2772 ;works on the tags, not the return types."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2773 ; (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2774 ; (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2775 ; (while
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2776 ; (re-search-forward "(?[ \t](?\C-?" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2777 ; (replace-match "\C-?" nil nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2778 ; (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2779 ; (while
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2780 ; (re-search-forward "\\(.*[ \t]+\\)\\([^ \t\n]+.*\C-?\\)" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2781 ; (delete-region (match-beginning 1) (match-end 1)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2782
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2783 (defun speedbar-extract-one-symbol (expr)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2784 "At point, return nil, or one alist in the form: ( symbol . position )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2785 The line should contain output from etags. Parse the output using the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2786 regular expression EXPR"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2787 (let* ((sym (if (stringp expr)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2788 (if (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2789 (re-search-forward expr (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2790 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2791 (point)) t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2792 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2793 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2794 (funcall expr)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2795 (pos (let ((j (re-search-forward "[\C-?\C-a]\\([0-9]+\\),\\([0-9]+\\)"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2796 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2797 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2798 (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2799 t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2800 (if (and j sym)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2801 (1+ (string-to-int (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2802 (match-beginning 2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2803 (match-end 2))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2804 0))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2805 (if (/= pos 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2806 (cons sym pos)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2807 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2808
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2809 (defun speedbar-parse-c-or-c++tag ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2810 "Parse a c or c++ tag, which tends to be a little complex."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2811 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2812 (let ((bound (save-excursion (end-of-line) (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2813 (cond ((re-search-forward "\C-?\\([^\C-a]+\\)\C-a" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2814 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2815 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2816 ((re-search-forward "\\<\\([^ \t]+\\)\\s-+new(" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2817 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2818 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2819 ((re-search-forward "\\<\\([^ \t(]+\\)\\s-*(\C-?" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2820 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2821 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2822 (t nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2823 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2824
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2825 (defun speedbar-parse-tex-string ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2826 "Parse a Tex string. Only find data which is relevant."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2827 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2828 (let ((bound (save-excursion (end-of-line) (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2829 (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2830 (buffer-substring-no-properties (match-beginning 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2831 (match-end 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2832 (t nil)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2833
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2834
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2835 ;;; Color loading section This is messy *Blech!*
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2836 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2837 (defface speedbar-button-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2838 (:foreground "green4"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2839 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2840 (:foreground "green3")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2841 "Face used for +/- buttons."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2842 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2843
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2844 (defface speedbar-file-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2845 (:foreground "cyan4"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2846 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2847 (:foreground "cyan"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2848 (t (:bold t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2849 "Face used for file names."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2850 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2851
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2852 (defface speedbar-directory-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2853 (:foreground "blue4"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2854 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2855 (:foreground "light blue")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2856 "Faced used for directory names."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2857 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2858 (defface speedbar-tag-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2859 (:foreground "brown"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2860 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2861 (:foreground "yellow")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2862 "Face used for displaying tags."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2863 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2864
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2865 (defface speedbar-selected-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2866 (:foreground "red" :underline t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2867 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2868 (:foreground "red" :underline t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2869 (t (:underline t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2870 "Face used to underline the file in the active window."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2871 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2872
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2873 (defface speedbar-highlight-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2874 (:background "green"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2875 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2876 (:background "sea green"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2877 (((class grayscale monochrome)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2878 (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2879 (:background "black"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2880 (((class grayscale monochrome)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2881 (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2882 (:background "white")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2883 "Face used for highlighting buttons with the mouse."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2884 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2885
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2886 ;; some edebug hooks
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2887 (add-hook 'edebug-setup-hook
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2888 (lambda ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2889 (def-edebug-spec speedbar-with-writable def-body)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2890
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2891 (provide 'speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2892 ;;; speedbar ends here
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2893
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2894 ;; run load-time hooks
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2895 (run-hooks 'speedbar-load-hook)