annotate lisp/speedbar.el @ 66683:b34febff3030

(command-line): Use `custom-reevaluate-setting' for mouse-wheel-down-event and mouse-wheel-up-event.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Fri, 04 Nov 2005 02:15:49 +0000
parents ce5979f4b405
children d02e0d3b5db9 0ca0d9181b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1 ;;; speedbar --- quick access to files and tags in a frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3 ;;; Copyright (C) 1996, 97, 98, 99, 00, 01, 02, 03, 04, 05 Free Software Foundation
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
4
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
6 ;; Keywords: file, tags, tools
65765
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
7
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
8 (defvar speedbar-version "1.0"
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
9 "The current version of speedbar.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
10 (defvar speedbar-incompatible-version "0.14beta4"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
11 "This version of speedbar is incompatible with this version.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
12 Due to massive API changes (removing the use of the word PATH)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
13 this version is not backward compatible to 0.14 or earlier.")
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
14
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
15 ;; This file is part of GNU Emacs.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
16
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
17 ;; GNU Emacs is free software; you can redistribute it and/or modify
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
18 ;; 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
19 ;; the Free Software Foundation; either version 2, or (at your option)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
20 ;; any later version.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
21
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
22 ;; GNU Emacs is distributed in the hope that it will be useful,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
25 ;; GNU General Public License for more details.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
26
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
27 ;; You should have received a copy of the GNU General Public License
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
28 ;; along with GNU Emacs; see the file COPYING. If not, write to the
65780
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
29 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
30 ;; Boston, MA 02110-1301, USA.
21650
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 ;;; Commentary:
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 ;; The speedbar provides a frame in which files, and locations in
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
35 ;; files are displayed. These items can be clicked on with mouse-2 in
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
36 ;; to display that file location.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
37 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
38 ;;; Customizing and Developing for speedbar
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
39 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
40 ;; Please see the speedbar manual for informaion.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
41 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
42 ;;; Notes:
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
43 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
44 ;; Users of really old emacsen without the need timer functions
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
45 ;; will not have speedbar updating automatically. Use "g" to refresh
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
46 ;; the display after changing directories. Remember, do not interrupt
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
47 ;; the stealthy updates or your display may not be completely
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
48 ;; refreshed.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
49 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
50 ;; AUC-TEX users: The imenu tags for AUC-TEX mode don't work very
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
51 ;; well. Use the imenu keywords from tex-mode.el for better results.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
52 ;;
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
53 ;; This file requires the library package assoc (association lists)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
54 ;; assoc should be available in all modern versions of Emacs.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
55 ;; The custom package is optional (for easy configuration of speedbar)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
56 ;; http://www.dina.kvl.dk/~abraham/custom/
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
57 ;; custom is available in all versions of Emacs version 20 or better.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
58 ;;
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
59
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
60 ;;; TODO:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
61 ;; - Timeout directories we haven't visited in a while.
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 (require 'assoc)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
64 (require 'easymenu)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
65 (require 'dframe)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
66 (require 'sb-image)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
67
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
68 ;; customization stuff
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
69 (defgroup speedbar nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
70 "File and tag browser frame."
48380
d2b6a3d52d08 (defgroup speedbar): Use group 'etags instead of nonexisting group
Markus Rost <rost@math.uni-bielefeld.de>
parents: 47627
diff changeset
71 :group 'etags
21658
d8a81542dbf9 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21650
diff changeset
72 :group 'tools
22250
a77d473867b8 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21658
diff changeset
73 :group 'convenience
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
74 ; :version "20.3"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
75 )
21650
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 (defgroup speedbar-faces nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
78 "Faces used in speedbar."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
79 :prefix "speedbar-"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
80 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
81 :group 'faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
82
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
83 (defgroup speedbar-vc nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
84 "Version control display in speedbar."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
85 :prefix "speedbar-"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
86 :group 'speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
87
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
88 ;;; Code:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
89
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
90 ;; Note: `inversion-test' requires parts of the CEDET package that are
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
91 ;; not included with Emacs.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
92 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
93 ;; (defun speedbar-require-version (major minor &optional beta)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
94 ;; "Non-nil if this version of SPEEDBAR does not satisfy a specific version.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
95 ;; Arguments can be:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
96 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
97 ;; (MAJOR MINOR &optional BETA)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
98 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
99 ;; Values MAJOR and MINOR must be integers. BETA can be an integer, or
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
100 ;; excluded if a released version is required.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
101 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
102 ;; It is assumed that if the current version is newer than that specified,
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
103 ;; everything passes. Exceptions occur when known incompatibilities are
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
104 ;; introduced."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
105 ;; (inversion-test 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
106 ;; (concat major "." minor
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
107 ;; (when beta (concat "beta" beta)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
108
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
109 (defvar speedbar-initial-expansion-mode-alist
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
110 '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
111 speedbar-buffer-buttons)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
112 ("quick buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
113 speedbar-buffer-buttons-temp)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
114 ;; Files last, means first in the Displays menu
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
115 ("files" speedbar-easymenu-definition-special speedbar-file-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
116 speedbar-directory-buttons speedbar-default-directory-list)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
117 )
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
118 "List of named expansion elements for filling the speedbar frame.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
119 These expansion lists are only valid for regular files. Special modes
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
120 still get to override this list on a mode-by-mode basis. This list of
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
121 lists is of the form (NAME MENU KEYMAP FN1 FN2 ...). NAME is a string
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
122 representing the types of things to be displayed. MENU is an easymenu
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
123 structure used when in this mode. KEYMAP is a local keymap to install
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
124 over the regular speedbar keymap. FN1 ... are functions that will be
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
125 called in order. These functions will always get the default
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
126 directory to use passed in as the first parameter, and a 0 as the
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
127 second parameter. The 0 indicates the uppermost indentation level.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
128 They must assume that the cursor is at the position where they start
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
129 inserting buttons.")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
130
23372
64e80b07376b (speedbar-frame-mode): Check if cfx or cfy is a list, and make sure it
Eric M. Ludlam <zappo@gnu.org>
parents: 23275
diff changeset
131 (defvar speedbar-initial-expansion-list-name "files"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
132 "A symbol name representing the expansion list to use.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
133 The expansion list `speedbar-initial-expansion-mode-alist' contains
23372
64e80b07376b (speedbar-frame-mode): Check if cfx or cfy is a list, and make sure it
Eric M. Ludlam <zappo@gnu.org>
parents: 23275
diff changeset
134 the names and associated functions to use for buttons in speedbar.")
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
135
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
136 (defvar speedbar-previously-used-expansion-list-name "files"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
137 "Save the last expansion list method.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
138 This is used for returning to a previous expansion list method when
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
139 the user is done with the current expansion list.")
21650
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 (defvar speedbar-stealthy-function-list
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
142 '(("files"
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
143 speedbar-update-current-file
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
144 speedbar-check-read-only
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
145 speedbar-check-vc
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
146 speedbar-check-objects)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
147 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
148 "List of functions to periodically call stealthily.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
149 This list is of the form:
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
150 '( (\"NAME\" FUNCTION ...)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
151 ...)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
152 where NAME is the name of the major display mode these functions are
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
153 for, and the remaining elements FUNCTION are functions to call in order.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
154 Each function must return nil if interrupted, or t if completed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
155 Stealthy functions which have a single operation should always return
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
156 t. Functions which take a long time should maintain a state (where
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
157 they are in their speedbar related calculations) and permit
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
158 interruption. See `speedbar-check-vc' as a good example.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
159
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
160 (defvar speedbar-mode-functions-list
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
161 '(("files" (speedbar-item-info . speedbar-files-item-info)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
162 (speedbar-line-directory . speedbar-files-line-directory))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
163 ("buffers" (speedbar-item-info . speedbar-buffers-item-info)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
164 (speedbar-line-directory . speedbar-buffers-line-directory))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
165 ("quick buffers" (speedbar-item-info . speedbar-buffers-item-info)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
166 (speedbar-line-directory . speedbar-buffers-line-directory))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
167 )
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
168 "List of function tables to use for different major display modes.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
169 It is not necessary to define any functions for a specialized mode.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
170 This just provides a simple way of adding lots of customizations.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
171 Each sublist is of the form:
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
172 (\"NAME\" (FUNCTIONSYMBOL . REPLACEMENTFUNCTION) ...)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
173 Where NAME is the name of the specialized mode. The rest of the list
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
174 is a set of dotted pairs of the form FUNCTIONSYMBOL, which is the name
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
175 of a function you would like to replace, and REPLACEMENTFUNCTION,
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
176 which is a function you can call instead. Not all functions can be
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
177 replaced this way. Replaceable functions must provide that
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
178 functionality individually.")
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
179
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
180 (defcustom speedbar-mode-specific-contents-flag t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
181 "*Non-nil means speedbar will show special mode contents.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
182 This permits some modes to create customized contents for the speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
183 frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
184 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
185 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
186
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
187 (defcustom speedbar-query-confirmation-method 'all
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
188 "*Query control for file operations.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
189 The 'always flag means to always query before file operations.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
190 The 'none-but-delete flag means to not query before any file
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
191 operations, except before a file deletion."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
192 :group 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
193 :type '(radio (const :tag "Always Query before some file operations."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
194 all)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
195 (const :tag "Never Query before file operations, except for deletions."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
196 none-but-delete)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
197 ;;;; (const :tag "Never Every Query."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
198 ;;;; none)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
199 ))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
200
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
201 (defvar speedbar-special-mode-expansion-list nil
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
202 "Default function list for creating specialized button lists.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
203 This list is set by modes that wish to have special speedbar displays.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
204 The list is of function names. Each function is called with one
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
205 parameter BUFFER, the originating buffer. The current buffer is the
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
206 speedbar buffer.")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
207
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
208 (defvar speedbar-special-mode-key-map nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
209 "Default keymap used when identifying a specialized display mode.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
210 This keymap is local to each buffer that wants to define special keybindings
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
211 effective when its display is shown.")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
212
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
213 (defcustom speedbar-before-visiting-file-hook '(push-mark)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
214 "*Hooks run before speedbar visits a file in the selected frame.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
215 The default buffer is the buffer in the selected window in the attached frame."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
216 :group 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
217 :type 'hook)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
218
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
219 (defcustom speedbar-visiting-file-hook nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
220 "*Hooks run when speedbar visits a file in the selected frame."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
221 :group 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
222 :type 'hook)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
223
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
224 (defcustom speedbar-before-visiting-tag-hook '(push-mark)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
225 "*Hooks run before speedbar visits a tag in the selected frame.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
226 The default buffer is the buffer in the selected window in the attached frame."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
227 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
228 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
229
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
230 (defcustom speedbar-visiting-tag-hook '(speedbar-highlight-one-tag-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
231 "*Hooks run when speedbar visits a tag in the selected frame."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
232 :group 'speedbar
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
233 :type 'hook
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
234 :options '(speedbar-highlight-one-tag-line
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
235 speedbar-recenter-to-top
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
236 speedbar-recenter
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
237 ))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
238
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
239 (defcustom speedbar-load-hook nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
240 "*Hooks run when speedbar is loaded."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
241 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
242 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
243
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
244 (defcustom speedbar-reconfigure-keymaps-hook nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
245 "*Hooks run when the keymaps are regenerated."
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
246 :group 'speedbar
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
247 :type 'hook)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
248
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
249 (defcustom speedbar-show-unknown-files nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
250 "*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
251 nil means don't show the file in the list."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
252 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
253 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
254
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
255 ;;; EVENTUALLY REMOVE THESE
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
256
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
257 ;; When I moved to a repeating timer, I had the horrible missfortune
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
258 ;; of loosing the ability for adaptive speed choice. This update
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
259 ;; speed currently causes long delays when it should have been turned off.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
260 (defvar speedbar-update-speed dframe-update-speed
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
261 "*Obsoleted variable. Use `dframe-update-speed'.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
262
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
263 (defvar speedbar-navigating-speed dframe-update-speed
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
264 "*Obsoleted variable. Use `dframe-update-speed'.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
265 ;;; END REMOVE THESE
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
266
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
267 (defcustom speedbar-frame-parameters '((minibuffer . nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
268 (width . 20)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
269 (border-width . 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
270 (menu-bar-lines . 0)
36047
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
271 (tool-bar-lines . 0)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
272 (unsplittable . t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
273 (left-fringe . 0)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
274 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
275 "*Parameters to use when creating the speedbar frame in Emacs.
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
276 Any parameter supported by a frame may be added. The parameter `height'
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
277 will be initialized to the height of the frame speedbar is
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
278 attached to and added to this list before the new frame is initialized."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
279 :group 'speedbar
65765
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
280 :type '(repeat (cons :format "%v"
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
281 (symbol :tag "Parameter")
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
282 (sexp :tag "Value"))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
283
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
284 ;; These values by Hrvoje Niksic <hniksic@srce.hr>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
285 (defcustom speedbar-frame-plist
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
286 '(minibuffer nil width 20 border-width 0
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
287 internal-border-width 0 unsplittable t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
288 default-toolbar-visible-p nil has-modeline-p nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
289 menubar-visible-p nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
290 default-gutter-visible-p nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
291 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
292 "*Parameters to use when creating the speedbar frame in XEmacs.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
293 Parameters not listed here which will be added automatically are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
294 `height' which will be initialized to the height of the frame speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
295 is attached to."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
296 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
297 :type '(repeat (group :inline t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
298 (symbol :tag "Property")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
299 (sexp :tag "Value"))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
300
65765
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
301 (defcustom speedbar-use-imenu-flag (fboundp 'imenu)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
302 "*Non-nil means use imenu for file parsing. nil to use etags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
303 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
304 use etags instead. Etags support is not as robust as imenu support."
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
305 :tag "Use Imenu for tags"
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
306 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
307 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
308
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
309 (defvar speedbar-dynamic-tags-function-list
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
310 '((speedbar-fetch-dynamic-imenu . speedbar-insert-imenu-list)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
311 (speedbar-fetch-dynamic-etags . speedbar-insert-etags-list))
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
312 "Set to a list of functions which will return and insert a list of tags.
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
313 Each element is of the form ( FETCH . INSERT ) where FETCH
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
314 is a function which takes one parameter (the file to tag) and returns a
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
315 list of tags. The tag list can be of any form as long as the
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
316 corresponding insert method can handle it. If it returns t, then an
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
317 error occurred, and the next fetch routine is tried.
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
318 INSERT is a function which takes an INDENTation level, and a LIST of
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
319 tags to insert. It will then create the speedbar buttons.")
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
320
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
321 (defcustom speedbar-use-tool-tips-flag (and (not (featurep 'xemacs))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
322 (>= emacs-major-version 21))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
323 "*Non-nil means to use tool tips if they are avaialble.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
324 When tooltips are not available, mouse-tracking and minibuffer
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
325 display is used instead."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
326 :group 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
327 :type 'boolean)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
328
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
329 (defcustom speedbar-track-mouse-flag (not speedbar-use-tool-tips-flag)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
330 "*Non-nil means to display info about the line under the mouse."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
331 :group 'speedbar
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
332 :type 'boolean)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
333
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
334 (defcustom speedbar-sort-tags nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
335 "*If non-nil, sort tags in the speedbar display. *Obsolete*.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
336 Use `semantic-tag-hierarchy-method' instead."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
337 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
338 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
339
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
340 (defcustom speedbar-tag-hierarchy-method
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
341 '(speedbar-prefix-group-tag-hierarchy
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
342 speedbar-trim-words-tag-hierarchy)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
343 "*List of hooks which speedbar will use to organize tags into groups.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
344 Groups are defined as expandable meta-tags. Imenu supports
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
345 such things in some languages, such as separating variables from
46286
6117ca314143 (speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 46282
diff changeset
346 functions. Each hook takes one argument LST, and may destructively
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
347 create a new list of the same form. LST is a list of elements of the
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
348 form:
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
349 (ELT1 ELT2 ... ELTn)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
350 where each ELT is of the form
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
351 (TAG-NAME-STRING . NUMBER-OR-MARKER)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
352 or
46286
6117ca314143 (speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 46282
diff changeset
353 (GROUP-NAME-STRING ELT1 ELT2... ELTn)"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
354 :group 'speedbar
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
355 :type 'hook
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
356 :options '(speedbar-prefix-group-tag-hierarchy
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
357 speedbar-trim-words-tag-hierarchy
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
358 speedbar-simple-group-tag-hierarchy
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
359 speedbar-sort-tag-hierarchy)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
360 )
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
361
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
362 (defcustom speedbar-tag-group-name-minimum-length 4
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
363 "*The minimum length of a prefix group name before expanding.
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
364 Thus, if the `speedbar-tag-hierarchy-method' includes `prefix-group'
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
365 and one such groups common characters is less than this number of
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
366 characters, then the group name will be changed to the form of:
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
367 worda to wordb
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
368 instead of just
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
369 word
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
370 This way we won't get silly looking listings."
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
371 :group 'speedbar
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
372 :type 'integer)
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
373
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
374 (defcustom speedbar-tag-split-minimum-length 20
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
375 "*Minimum length before we stop trying to create sub-lists in tags.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
376 This is used by all tag-hierarchy methods that break large lists into
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
377 sub-lists."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
378 :group 'speedbar
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
379 :type 'integer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
380
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
381 (defcustom speedbar-tag-regroup-maximum-length 10
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
382 "*Maximum length of submenus that are regrouped.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
383 If the regrouping option is used, then if two or more short subgroups
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
384 are next to each other, then they are combined until this number of
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
385 items is reached."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
386 :group 'speedbar
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
387 :type 'integer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
388
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
389 (defcustom speedbar-directory-button-trim-method 'span
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
390 "*Indicates how the directory button will be displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
391 Possible values are:
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
392 'span - span large directories over multiple lines.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
393 'trim - trim large directories to only show the last few.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
394 nil - no trimming."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
395 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
396 :type '(radio (const :tag "Span large directories over mutiple lines."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
397 span)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
398 (const :tag "Trim large directories to only show the last few."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
399 trim)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
400 (const :tag "No trimming." nil)))
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 (defcustom speedbar-smart-directory-expand-flag t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
403 "*Non-nil means speedbar should use smart expansion.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
404 Smart expansion only affects when speedbar wants to display a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
405 directory for a file in the attached frame. When smart expansion is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
406 enabled, new directories which are children of a displayed directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
407 are expanded in the current framework. If nil, then the current
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
408 hierarchy would be replaced with the new directory."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
409 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
410 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
411
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
412 (defcustom speedbar-indentation-width 1
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
413 "*When sub-nodes are expanded, the number of spaces used for indentation."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
414 :group 'speedbar
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
415 :type 'integer)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
416
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
417 (defcustom speedbar-hide-button-brackets-flag nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
418 "*Non-nil means speedbar will hide the brackets around the + or -."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
419 :group 'speedbar
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
420 :type 'boolean)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
421
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
422 (defcustom speedbar-before-popup-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
423 "*Hooks called before popping up the speedbar frame."
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 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
426
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
427 (defcustom speedbar-after-create-hook '(speedbar-frame-reposition-smartly)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
428 "*Hooks called before popping up the speedbar frame."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
429 :group 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
430 :type 'hook)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
431
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
432 (defcustom speedbar-before-delete-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
433 "*Hooks called before deleting the speedbar frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
434 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
435 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
436
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
437 (defcustom speedbar-mode-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
438 "*Hooks called after creating a speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
439 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
440 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
441
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
442 (defcustom speedbar-timer-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
443 "*Hooks called after running the speedbar timer function."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
444 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
445 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
446
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
447 (defcustom speedbar-verbosity-level 1
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
448 "*Verbosity level of the speedbar. 0 means say nothing.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
449 1 means medium level verbosity. 2 and higher are higher levels of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
450 verbosity."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
451 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
452 :type 'integer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
453
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
454 (defvar speedbar-indicator-separator " "
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
455 "String separating file text from indicator characters.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
456
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
457 (defcustom speedbar-vc-do-check t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
458 "*Non-nil check all files in speedbar to see if they have been checked out.
46286
6117ca314143 (speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 46282
diff changeset
459 Any file checked out is marked with `speedbar-vc-indicator'."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
460 :group 'speedbar-vc
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
461 :type 'boolean)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
462
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
463 (defvar speedbar-vc-indicator "*"
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
464 "Text used to mark files which are currently checked out.
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
465 Other version control systems can be added by examining the function
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
466 `speedbar-vc-directory-enable-hook' and `speedbar-vc-in-control-hook'.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
467
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
468 (defcustom speedbar-vc-directory-enable-hook nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
469 "*Return non-nil if the current directory should be checked for Version Control.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
470 Functions in this hook must accept one parameter which is the directory
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
471 being checked."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
472 :group 'speedbar-vc
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
473 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
474
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
475 (defcustom speedbar-vc-in-control-hook nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
476 "*Return non-nil if the specified file is under Version Control.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
477 Functions in this hook must accept two parameters. The DIRECTORY of the
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
478 current file, and the FILENAME of the file being checked."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
479 :group 'speedbar-vc
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
480 :type 'hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
481
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
482 (defvar speedbar-vc-to-do-point nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
483 "Local variable maintaining the current version control check position.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
484
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
485 (defcustom speedbar-obj-do-check t
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
486 "*Non-nil check all files in speedbar to see if they have an object file.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
487 Any file checked out is marked with `speedbar-obj-indicator', and the
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
488 marking is based on `speedbar-obj-alist'"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
489 :group 'speedbar-vc
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
490 :type 'boolean)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
491
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
492 (defvar speedbar-obj-to-do-point nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
493 "Local variable maintaining the current version control check position.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
494
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
495 (defvar speedbar-obj-indicator '("#" . "!")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
496 "Text used to mark files that have a corresponding hidden object file.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
497 The car is for an up-to-date object. The cdr is for an out of date object.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
498 The expression `speedbar-obj-alist' defines who gets tagged.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
499
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
500 (defvar speedbar-obj-alist
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
501 '(("\\.\\([cpC]\\|cpp\\|cc\\|cxx\\)$" . ".o")
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
502 ("\\.el$" . ".elc")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
503 ("\\.java$" . ".class")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
504 ("\\.f\\(or\\|90\\|77\\)?$" . ".o")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
505 ("\\.tex$" . ".dvi")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
506 ("\\.texi$" . ".info"))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
507 "Alist of file extensions, and their corresponding object file type.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
508
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
509 (defvar speedbar-ro-to-do-point nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
510 "Local variable maintaining the current read only check position.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
511
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
512 (defvar speedbar-object-read-only-indicator "%"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
513 "Indicator to append onto a line if that item is Read Only.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
514
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
515 ;; Note: Look for addition place to add indicator lists that
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
516 ;; use skip-chars instead of a regular expression.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
517 (defvar speedbar-indicator-regex
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
518 (concat (regexp-quote speedbar-indicator-separator)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
519 "\\("
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
520 (regexp-quote speedbar-vc-indicator)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
521 "\\|"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
522 (regexp-quote (car speedbar-obj-indicator))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
523 "\\|"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
524 (regexp-quote (cdr speedbar-obj-indicator))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
525 "\\|"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
526 (regexp-quote speedbar-object-read-only-indicator)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
527 "\\)*")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
528 "Regular expression used when identifying files.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
529 Permits stripping of indicator characters from a line.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
530
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
531 (defcustom speedbar-scanner-reset-hook nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
532 "*Hook called whenever generic scanners are reset.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
533 Set this to implement your own scanning / rescan safe functions with
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
534 state data."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
535 :group 'speedbar
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
536 :type 'hook)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
537
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
538 (defvar speedbar-ignored-modes '(fundamental-mode)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
539 "*List of major modes which speedbar will not switch directories for.")
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 (defun speedbar-extension-list-to-regex (extlist)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
542 "Takes EXTLIST, a list of extensions and transforms it into regexp.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
543 All the preceding `.' are stripped for an optimized expression starting
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
544 with `.' followed by extensions, followed by full-filenames."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
545 (let ((regex1 nil) (regex2 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
546 (while extlist
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
547 (if (= (string-to-char (car extlist)) ?.)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
548 (setq regex1 (concat regex1 (if regex1 "\\|" "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
549 (substring (car extlist) 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
550 (setq regex2 (concat regex2 (if regex2 "\\|" "") (car extlist))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
551 (setq extlist (cdr extlist)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
552 ;; concat all the sub-exressions together, making sure all types
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
553 ;; of parts exist during concatination.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
554 (concat "\\("
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
555 (if regex1 (concat "\\(\\.\\(" regex1 "\\)\\)") "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
556 (if (and regex1 regex2) "\\|" "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
557 (if regex2 (concat "\\(" regex2 "\\)") "")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
558 "\\)$")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
559
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
560 (defvar speedbar-ignored-directory-regexp nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
561 "Regular expression matching directorys speedbar will not switch to.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
562 Created from `speedbar-ignored-directory-expressions' with the function
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
563 `speedbar-extension-list-to-regex' (A misnamed function in this case.)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
564 Use the function `speedbar-add-ignored-directory-regexp', or customize the
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
565 variable `speedbar-ignored-directory-expressions' to modify this variable.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
566
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
567 (defcustom speedbar-ignored-directory-expressions
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
568 '("[/\\]logs?[/\\]\\'")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
569 "*List of regular expressions matching directories speedbar will ignore.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
570 They should included directorys to directories which are notoriously very
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
571 large and take a long time to load in. Use the function
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
572 `speedbar-add-ignored-directory-regexp' to add new items to this list after
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
573 speedbar is loaded. You may place anything you like in this list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
574 before speedbar has been loaded."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
575 :group 'speedbar
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
576 :type '(repeat (regexp :tag "Directory Regexp"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
577 :set (lambda (sym val)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
578 (setq speedbar-ignored-directory-expressions val
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
579 speedbar-ignored-directory-regexp
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
580 (speedbar-extension-list-to-regex val))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
581
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
582 (defcustom speedbar-directory-unshown-regexp "^\\(CVS\\|RCS\\|SCCS\\|\\..*\\)\\'"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
583 "*Regular expression matching directories not to show in speedbar.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
584 They should include commonly existing directories which are not
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
585 useful, such as version control."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
586 :group 'speedbar
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
587 :type 'string)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
588
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
589 (defvar speedbar-file-unshown-regexp
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
590 (let ((nstr "") (noext completion-ignored-extensions))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
591 (while noext
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
592 (setq nstr (concat nstr (regexp-quote (car noext)) "\\'"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
593 (if (cdr noext) "\\|" ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
594 noext (cdr noext)))
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
595 ;; backup refdir lockfile
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
596 (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
597 "*Regexp matching files we don't want displayed in a speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
598 It is generated from the variable `completion-ignored-extensions'")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
599
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
600 (defvar speedbar-file-regexp nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
601 "Regular expression matching files we know how to expand.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
602 Created from `speedbar-supported-extension-expressions' with the
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
603 function `speedbar-extension-list-to-regex'")
56762
85c0c238dbbf (speedbar-file-regexp): Definition moved up.
Richard M. Stallman <rms@gnu.org>
parents: 56754
diff changeset
604
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
605 ;; this is dangerous to customize, because the defaults will probably
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
606 ;; change in the future.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
607 (defcustom speedbar-supported-extension-expressions
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
608 (append '(".[ch]\\(\\+\\+\\|pp\\|c\\|h\\|xx\\)?" ".tex\\(i\\(nfo\\)?\\)?"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
609 ".el" ".emacs" ".l" ".lsp" ".p" ".java" ".f\\(90\\|77\\|or\\)?")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
610 (if speedbar-use-imenu-flag
38377
308a2e8895e3 (speedbar-supported-extension-expressions): Add .g to the extension list,
Eli Zaretskii <eliz@gnu.org>
parents: 37891
diff changeset
611 '(".ada" ".p[lm]" ".tcl" ".m" ".scm" ".pm" ".py" ".g"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
612 ;; html is not supported by default, but an imenu tags package
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
613 ;; is available. Also, html files are nice to be able to see.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
614 ".s?html"
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
615 ".ma?k" "[Mm]akefile\\(\\.in\\)?")))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
616 "*List of regular expressions which will match files supported by tagging.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
617 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
618 will be stripped by a simplified optimizer when compiled into a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
619 singular expression. This variable will be turned into
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
620 `speedbar-file-regexp' for use with speedbar. You should use the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
621 function `speedbar-add-supported-extension' to add a new extension at
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
622 runtime, or use the configuration dialog to set it in your .emacs
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
623 file.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
624 If you add an extension to this list, and it does not appear, you may
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
625 need to also modify `completion-ignored-extension' which will also help
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
626 file completion."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
627 :group 'speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
628 :type '(repeat (regexp :tag "Extension Regexp"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
629 :set (lambda (sym val)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
630 (set 'speedbar-supported-extension-expressions val)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
631 (set 'speedbar-file-regexp (speedbar-extension-list-to-regex val))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
632
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
633 (setq speedbar-file-regexp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
634 (speedbar-extension-list-to-regex speedbar-supported-extension-expressions))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
635
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
636 (defun speedbar-add-supported-extension (extension)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
637 "Add EXTENSION as a new supported extension for speedbar tagging.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
638 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
639 the dot should NOT be quoted in with \\. Other regular expression
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
640 matchers are allowed however. EXTENSION may be a single string or a
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
641 list of strings."
44578
9c2b72b4b303 (speedbar-generic-item-info)
Pavel Janík <Pavel@Janik.cz>
parents: 44225
diff changeset
642 (interactive "sExtension: ")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
643 (if (not (listp extension)) (setq extension (list extension)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
644 (while extension
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
645 (if (member (car extension) speedbar-supported-extension-expressions)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
646 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
647 (setq speedbar-supported-extension-expressions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
648 (cons (car extension) speedbar-supported-extension-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
649 (setq extension (cdr extension)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
650 (setq speedbar-file-regexp (speedbar-extension-list-to-regex
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
651 speedbar-supported-extension-expressions)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
652
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
653 (defun speedbar-add-ignored-directory-regexp (directory-expression)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
654 "Add DIRECTORY-EXPRESSION as a new ignored directory for speedbar tracking.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
655 This function will modify `speedbar-ignored-directory-regexp' and add
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
656 DIRECTORY-EXPRESSION to `speedbar-ignored-directory-expressions'."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
657 (interactive "sDirectory regex: ")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
658 (if (not (listp directory-expression))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
659 (setq directory-expression (list directory-expression)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
660 (while directory-expression
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
661 (if (member (car directory-expression) speedbar-ignored-directory-expressions)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
662 nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
663 (setq speedbar-ignored-directory-expressions
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
664 (cons (car directory-expression) speedbar-ignored-directory-expressions)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
665 (setq directory-expression (cdr directory-expression)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
666 (setq speedbar-ignored-directory-regexp (speedbar-extension-list-to-regex
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
667 speedbar-ignored-directory-expressions)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
668
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
669 ;; 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
670 (if (not (fboundp 'custom-declare-variable))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
671 (setq speedbar-file-regexp (speedbar-extension-list-to-regex
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
672 speedbar-supported-extension-expressions)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
673 speedbar-ignored-directory-regexp (speedbar-extension-list-to-regex
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
674 speedbar-ignored-directory-expressions)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
675
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
676 (defvar speedbar-update-flag dframe-have-timer-flag
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
677 "*Non-nil means to automatically update the display.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
678 When this is nil then speedbar will not follow the attached frame's directory.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
679 When speedbar is active, use:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
680
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
681 \\<speedbar-key-map> `\\[speedbar-toggle-updates]'
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
682
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
683 to toggle this value.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
684
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
685 (defvar speedbar-update-flag-disable nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
686 "Permanently disable changing of the update flag.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
687
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
688 (defvar speedbar-syntax-table nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
689 "Syntax-table used on the speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
690
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
691 (if speedbar-syntax-table
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
692 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
693 (setq speedbar-syntax-table (make-syntax-table))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
694 ;; turn off paren matching around here.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
695 (modify-syntax-entry ?\' " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
696 (modify-syntax-entry ?\" " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
697 (modify-syntax-entry ?( " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
698 (modify-syntax-entry ?) " " speedbar-syntax-table)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
699 (modify-syntax-entry ?{ " " speedbar-syntax-table)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
700 (modify-syntax-entry ?} " " speedbar-syntax-table)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
701 (modify-syntax-entry ?[ " " speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
702 (modify-syntax-entry ?] " " speedbar-syntax-table))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
703
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
704 (defvar speedbar-key-map nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
705 "Keymap used in speedbar buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
706
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
707 (if speedbar-key-map
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
708 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
709 (setq speedbar-key-map (make-keymap))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
710 (suppress-keymap speedbar-key-map t)
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 ;; control
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
713 (define-key speedbar-key-map "t" 'speedbar-toggle-updates)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
714 (define-key speedbar-key-map "g" 'speedbar-refresh)
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 ;; navigation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
717 (define-key speedbar-key-map "n" 'speedbar-next)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
718 (define-key speedbar-key-map "p" 'speedbar-prev)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
719 (define-key speedbar-key-map "\M-n" 'speedbar-restricted-next)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
720 (define-key speedbar-key-map "\M-p" 'speedbar-restricted-prev)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
721 (define-key speedbar-key-map "\C-\M-n" 'speedbar-forward-list)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
722 (define-key speedbar-key-map "\C-\M-p" 'speedbar-backward-list)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
723 ;; These commands never seemed useful.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
724 ;; (define-key speedbar-key-map " " 'speedbar-scroll-up)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
725 ;; (define-key speedbar-key-map [delete] 'speedbar-scroll-down)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
726
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
727 ;; Short cuts I happen to find useful
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
728 (define-key speedbar-key-map "r"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
729 (lambda () (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
730 (speedbar-change-initial-expansion-list
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
731 speedbar-previously-used-expansion-list-name)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
732 (define-key speedbar-key-map "b"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
733 (lambda () (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
734 (speedbar-change-initial-expansion-list "quick buffers")))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
735 (define-key speedbar-key-map "f"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
736 (lambda () (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
737 (speedbar-change-initial-expansion-list "files")))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
738
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
739 (dframe-update-keymap speedbar-key-map)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
740 )
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
741
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
742 (defun speedbar-make-specialized-keymap ()
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
743 "Create a keymap for use with a speedbar major or minor display mode.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
744 This basically creates a sparse keymap, and makes it's parent be
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
745 `speedbar-key-map'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
746 (let ((k (make-sparse-keymap)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
747 (set-keymap-parent k speedbar-key-map)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
748 k))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
749
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
750 (defvar speedbar-file-key-map nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
751 "Keymap used in speedbar buffer while files are displayed.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
752
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
753 (if speedbar-file-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
754 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
755 (setq speedbar-file-key-map (speedbar-make-specialized-keymap))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
756
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
757 ;; Basic tree features
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
758 (define-key speedbar-file-key-map "e" 'speedbar-edit-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
759 (define-key speedbar-file-key-map "\C-m" 'speedbar-edit-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
760 (define-key speedbar-file-key-map "+" 'speedbar-expand-line)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
761 (define-key speedbar-file-key-map "=" 'speedbar-expand-line)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
762 (define-key speedbar-file-key-map "-" 'speedbar-contract-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
763
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
764 (define-key speedbar-file-key-map "[" 'speedbar-expand-line-descendants)
65949
0900c0c906d7 * speedbar.el (speedbar-file-key-map): Fix typo.
Chong Yidong <cyd@stupidchicken.com>
parents: 65809
diff changeset
765 (define-key speedbar-file-key-map "]" 'speedbar-contract-line-descendants)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
766
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
767 (define-key speedbar-file-key-map " " 'speedbar-toggle-line-expansion)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
768
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
769 ;; file based commands
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
770 (define-key speedbar-file-key-map "U" 'speedbar-up-directory)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
771 (define-key speedbar-file-key-map "I" 'speedbar-item-info)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
772 (define-key speedbar-file-key-map "B" 'speedbar-item-byte-compile)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
773 (define-key speedbar-file-key-map "L" 'speedbar-item-load)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
774 (define-key speedbar-file-key-map "C" 'speedbar-item-copy)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
775 (define-key speedbar-file-key-map "D" 'speedbar-item-delete)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
776 (define-key speedbar-file-key-map "O" 'speedbar-item-object-delete)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
777 (define-key speedbar-file-key-map "R" 'speedbar-item-rename)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
778 (define-key speedbar-file-key-map "M" 'speedbar-create-directory)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
779 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
780
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
781 (defvar speedbar-easymenu-definition-base
29130
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
782 (append
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
783 '("Speedbar"
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
784 ["Update" speedbar-refresh t]
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
785 ["Auto Update" speedbar-toggle-updates
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
786 :active (not speedbar-update-flag-disable)
29130
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
787 :style toggle :selected speedbar-update-flag])
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
788 (if (and (or (fboundp 'defimage)
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
789 (fboundp 'make-image-specifier))
29260
7f1b3013a136 (speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents: 29130
diff changeset
790 (if (fboundp 'display-graphic-p)
7f1b3013a136 (speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents: 29130
diff changeset
791 (display-graphic-p)
7f1b3013a136 (speedbar-use-images, speedbar-update-flag)
Eli Zaretskii <eliz@gnu.org>
parents: 29130
diff changeset
792 window-system))
29130
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
793 (list
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
794 ["Use Images" speedbar-toggle-images
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
795 :style toggle :selected speedbar-use-images]))
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
796 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
797 "Base part of the speedbar menu.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
798
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
799 (defvar speedbar-easymenu-definition-special
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
800 '(["Edit Item On Line" speedbar-edit-line t]
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
801 ["Show All Files" speedbar-toggle-show-all-files
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
802 :style toggle :selected speedbar-show-unknown-files]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
803 ["Expand File Tags" speedbar-expand-line
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
804 (save-excursion (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
805 (looking-at "[0-9]+: *.\\+. "))]
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
806 ["Flush Cache & Expand" speedbar-flush-expand-line
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
807 (save-excursion (beginning-of-line)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
808 (looking-at "[0-9]+: *.\\+. "))]
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
809 ["Expand All Descendants" speedbar-expand-line-descendants
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
810 (save-excursion (beginning-of-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
811 (looking-at "[0-9]+: *.\\+. ")) ]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
812 ["Contract File Tags" speedbar-contract-line
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
813 (save-excursion (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
814 (looking-at "[0-9]+: *.-. "))]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
815 ; ["Sort Tags" speedbar-toggle-sorting
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
816 ; :style toggle :selected speedbar-sort-tags]
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
817 "----"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
818 ["File/Tag Information" speedbar-item-info t]
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
819 ["Load Lisp File" speedbar-item-load
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
820 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
821 (beginning-of-line)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
822 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\|$\\)"))]
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
823 ["Byte Compile File" speedbar-item-byte-compile
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
824 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
825 (beginning-of-line)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
826 (looking-at "[0-9]+: *\\[[+-]\\] .+\\(\\.el\\)\\( \\|$\\)"))]
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
827 ["Copy File" speedbar-item-copy
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
828 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *\\["))]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
829 ["Rename File" speedbar-item-rename
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
830 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))]
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
831 ["Create Directory" speedbar-create-directory
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
832 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
833 ["Delete File" speedbar-item-delete
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
834 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
835 ["Delete Object" speedbar-item-object-delete
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
836 (save-excursion (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
837 (looking-at "[0-9]+: *\\[[+-]\\] [^ \n]+ \\*?[!#]$"))]
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
838 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
839 "Additional menu items while in file-mode.")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
840
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
841 (defvar speedbar-easymenu-definition-trailer
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
842 (append
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
843 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
844 (list ["Customize..." speedbar-customize t]))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
845 (list
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
846 ["Detach" speedbar-detach (and speedbar-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
847 (eq (selected-frame) speedbar-frame)) ]
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
848 ["Close" dframe-close-frame t]
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
849 ["Quit" delete-frame t] ))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
850 "Menu items appearing at the end of the speedbar menu.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
851
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
852 (defvar speedbar-desired-buffer nil
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
853 "Non-nil when speedbar is showing buttons specific to a special mode.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
854 In this case it is the originating buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
855 (defvar speedbar-buffer nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
856 "The buffer displaying the speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
857 (defvar speedbar-frame nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
858 "The frame displaying speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
859 (defvar speedbar-cached-frame nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
860 "The frame that was last created, then removed from the display.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
861 (defvar speedbar-full-text-cache nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
862 "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
863
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
864 (defvar speedbar-last-selected-file nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
865 "The last file which was selected in speedbar buffer.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
866
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
867 (defvar speedbar-shown-directories nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
868 "Maintain list of directories simultaneously open in the current speedbar.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
869
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
870 (defvar speedbar-directory-contents-alist nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
871 "An association list of directories and their contents.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
872 Each sublist was returned by `speedbar-file-lists'. This list is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
873 maintained to speed up the refresh rate when switching between
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
874 directories.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
875
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
876 (defvar speedbar-power-click nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
877 "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
878
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
879
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
880 ;;; Compatibility
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
881 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
882 (defalias 'speedbar-make-overlay
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
883 (if (featurep 'xemacs) 'make-extent 'make-overlay))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
884
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
885 (defalias 'speedbar-overlay-put
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
886 (if (featurep 'xemacs) 'set-extent-property 'overlay-put))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
887
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
888 (defalias 'speedbar-delete-overlay
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
889 (if (featurep 'xemacs) 'delete-extent 'delete-overlay))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
890
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
891 (defalias 'speedbar-mode-line-update
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
892 (if (featurep 'xemacs) 'redraw-modeline 'force-mode-line-update))
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
893
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
894 ;;; Mode definitions/ user commands
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
895 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
896
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
897 ;;;###autoload
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
898 (defalias 'speedbar 'speedbar-frame-mode)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
899 ;;;###autoload
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
900 (defun speedbar-frame-mode (&optional arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
901 "Enable or disable speedbar. Positive ARG means turn on, negative turn off.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
902 nil means toggle. Once the speedbar frame is activated, a buffer in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
903 `speedbar-mode' will be displayed. Currently, only one speedbar is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
904 supported at a time.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
905 `speedbar-before-popup-hook' is called before popping up the speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
906 `speedbar-before-delete-hook' is called before the frame is deleted."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
907 (interactive "P")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
908 ;; Get the buffer to play with
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
909 (if (not (buffer-live-p speedbar-buffer))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
910 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
911 (setq speedbar-buffer (get-buffer-create " SPEEDBAR"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
912 (set-buffer speedbar-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
913 (speedbar-mode)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
914 ;; Do the frame thing
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
915 (dframe-frame-mode arg
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
916 'speedbar-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
917 'speedbar-cached-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
918 'speedbar-buffer
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
919 "Speedbar"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
920 #'speedbar-frame-mode
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
921 (if dframe-xemacsp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
922 (append speedbar-frame-plist
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
923 ;; This is a hack to get speedbar to iconfiy
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
924 ;; with the selected frame.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
925 (list 'parent (selected-frame)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
926 speedbar-frame-parameters)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
927 speedbar-before-delete-hook
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
928 speedbar-before-popup-hook
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
929 speedbar-after-create-hook)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
930 ;; Start up the timer
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
931 (if (not speedbar-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
932 (speedbar-set-timer nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
933 (speedbar-reconfigure-keymaps)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
934 (speedbar-update-contents)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
935 (speedbar-set-timer dframe-update-speed)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
936 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
937 ;; Frame modifications
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
938 (set (make-local-variable 'dframe-delete-frame-function)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
939 'speedbar-handle-delete-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
940 ;; hscroll
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
941 (set (make-local-variable 'automatic-hscrolling) nil) ; Emacs 21
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
942 ;; reset the selection variable
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
943 (setq speedbar-last-selected-file nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
944
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
945 (defun speedbar-frame-reposition-smartly ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
946 "Reposition the speedbar frame to be next to the attached frame."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
947 (cond ((and dframe-xemacsp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
948 (or (member 'left speedbar-frame-plist)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
949 (member 'top speedbar-frame-plist)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
950 (dframe-reposition-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
951 speedbar-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
952 (dframe-attached-frame speedbar-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
953 (cons (car (cdr (member 'left speedbar-frame-plist)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
954 (car (cdr (member 'top speedbar-frame-plist)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
955 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
956 ((and (not dframe-xemacsp)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
957 (or (assoc 'left speedbar-frame-parameters)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
958 (assoc 'top speedbar-frame-parameters)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
959 ;; if left/top were specified in the parameters, pass them
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
960 ;; down to the reposition function
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
961 (dframe-reposition-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
962 speedbar-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
963 (dframe-attached-frame speedbar-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
964 (cons (cdr (assoc 'left speedbar-frame-parameters))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
965 (cdr (assoc 'top speedbar-frame-parameters))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
966 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
967 (t
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
968 (dframe-reposition-frame speedbar-frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
969 (dframe-attached-frame speedbar-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
970 'left-right))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
971
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
972 (defun speedbar-detach ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
973 "Detach the current Speedbar from auto-updating.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
974 Doing this allows the creation of a second speedbar."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
975 (interactive)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
976 (let ((buffer speedbar-buffer))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
977 (dframe-detach 'speedbar-frame 'speedbar-cached-frame 'speedbar-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
978 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
979 (set-buffer buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
980 ;; Permanently disable auto-updating in this speedbar buffer.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
981 (set (make-local-variable 'speedbar-update-flag) nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
982 (set (make-local-variable 'speedbar-update-flag-disable) t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
983 ;; Make local copies of all the different variables to prevent
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
984 ;; funny stuff later...
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
985 )))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
986
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
987 (defsubst speedbar-current-frame ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
988 "Return the frame to use for speedbar based on current context."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
989 (dframe-current-frame 'speedbar-frame 'speedbar-mode))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
990
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
991 (defun speedbar-handle-delete-frame (e)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
992 "Handle a delete frame event E.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
993 If the deleted frame is the frame SPEEDBAR is attached to,
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
994 we need to delete speedbar also."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
995 (let ((frame-to-be-deleted (car (car (cdr e)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
996 (if (eq frame-to-be-deleted dframe-attached-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
997 (delete-frame speedbar-frame)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
998 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
999
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1000 ;;;###autoload
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1001 (defun speedbar-get-focus ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1002 "Change frame focus to or from the speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1003 If the selected frame is not speedbar, then speedbar frame is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1004 selected. If the speedbar frame is active, then select the attached frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1005 (interactive)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1006 (speedbar-reset-scanners)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1007 (dframe-get-focus 'speedbar-frame 'speedbar-frame-mode
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1008 (lambda () (let ((speedbar-update-flag t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1009 (speedbar-timer-fn)))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1010
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1011 (defmacro speedbar-frame-width ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1012 "Return the width of the speedbar frame in characters.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1013 nil if it doesn't exist."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1014 '(window-width (get-buffer-window speedbar-buffer)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1015
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1016 (defun speedbar-mode ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1017 "Major mode for managing a display of directories and tags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1018 \\<speedbar-key-map>
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1019 The first line represents the default directory of the speedbar frame.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1020 Each directory segment is a button which jumps speedbar's default
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1021 directory to that directory. Buttons are activated by clicking `\\[speedbar-click]'.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1022 In some situations using `\\[dframe-power-click]' is a `power click' which will
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1023 rescan cached items, or pop up new frames.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1024
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1025 Each line starting with <+> represents a directory. Click on the <+>
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1026 to insert the directory listing into the current tree. Click on the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1027 <-> 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
1028 directory as the default.
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 Each line starting with [+] is a file. If the variable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1031 `speedbar-show-unknown-files' is t, the lines starting with [?] are
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1032 files which don't have imenu support, but are not expressly ignored.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1033 Files are completely ignored if they match `speedbar-file-unshown-regexp'
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1034 which is generated from `completion-ignored-extensions'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1035
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1036 Files with a `*' character after their name are files checked out of a
47286
4f937ab8ad22 (speedbar-mode): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 47267
diff changeset
1037 version control system. (Currently only RCS is supported.) New
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1038 version control systems can be added by examining the documentation
47286
4f937ab8ad22 (speedbar-mode): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 47267
diff changeset
1039 for `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p'.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1040
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1041 Files with a `#' or `!' character after them are source files that
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1042 have an object file associated with them. The `!' indicates that the
47267
8b5ff870e329 (speedbar-mode): Fix spacing.
Juanma Barranquero <lekktu@gmail.com>
parents: 46288
diff changeset
1043 files is out of date. You can control what source/object associations
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1044 exist through the variable `speedbar-obj-alist'.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1045
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1046 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
1047 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
1048 in the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1049
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1050 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
1051 category of tags. Click the {+} to expand the category. Jump-able
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1052 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
1053 in the selected file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1054
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1055 \\{speedbar-key-map}"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1056 ;; NOT interactive
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1057 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1058 (kill-all-local-variables)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1059 (setq major-mode 'speedbar-mode)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1060 (setq mode-name "Speedbar")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1061 (set-syntax-table speedbar-syntax-table)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1062 (setq font-lock-keywords nil) ;; no font-locking please
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1063 (setq truncate-lines t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1064 (make-local-variable 'frame-title-format)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1065 (setq frame-title-format (concat "Speedbar " speedbar-version))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1066 (setq case-fold-search nil)
23083
2dea437fe88a (speedbar-with-writable): remove `toggle-read-only'.
Eric M. Ludlam <zappo@gnu.org>
parents: 23080
diff changeset
1067 (toggle-read-only 1)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1068 (speedbar-set-mode-line-format)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1069 ;; Add in our dframe hooks.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1070 (if speedbar-track-mouse-flag
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1071 (setq dframe-track-mouse-function #'speedbar-track-mouse))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1072 (setq dframe-help-echo-function #'speedbar-item-info
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1073 dframe-mouse-click-function #'speedbar-click
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1074 dframe-mouse-position-function #'speedbar-position-cursor-on-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1075 (run-hooks 'speedbar-mode-hook))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1076 speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1077
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1078 (defmacro speedbar-message (fmt &rest args)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1079 "Like message, but for use in the speedbar frame.
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1080 Argument FMT is the format string, and ARGS are the arguments for message."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1081 `(dframe-message ,fmt ,@args))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1082
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1083 (defsubst speedbar-y-or-n-p (prompt &optional deleting)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1084 "Like `y-or-n-p', but for use in the speedbar frame.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1085 Argument PROMPT is the prompt to use.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1086 Optional argument DELETING means this is a query that will delete something.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1087 The variable `speedbar-query-confirmation-method' can cause this to
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1088 return true without a query."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1089 (or (and (not deleting)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1090 (eq speedbar-query-confirmation-method 'none-but-delete))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1091 (dframe-y-or-n-p prompt)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1092
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1093 (defsubst speedbar-select-attached-frame ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1094 "Select the frame attached to this speedbar."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1095 (dframe-select-attached-frame (speedbar-current-frame)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1096
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1097 ;; Backwards compatibility
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1098 (defalias 'speedbar-with-attached-buffer 'dframe-with-attached-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1099 (defalias 'speedbar-maybee-jump-to-attached-frame 'dframe-maybee-jump-to-attached-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1100
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1101 (defun speedbar-set-mode-line-format ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1102 "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
1103 This gives visual indications of what is up. It EXPECTS the speedbar
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1104 frame and window to be the currently active frame and window."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1105 (if (and (frame-live-p (speedbar-current-frame))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1106 (or (not dframe-xemacsp)
56762
85c0c238dbbf (speedbar-file-regexp): Definition moved up.
Richard M. Stallman <rms@gnu.org>
parents: 56754
diff changeset
1107 (with-no-warnings
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1108 (specifier-instance has-modeline-p)))
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1109 speedbar-buffer)
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1110 (save-excursion
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1111 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1112 (let* ((w (or (speedbar-frame-width) 20))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1113 (p1 "<<")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1114 (p5 ">>")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1115 (p3 (if speedbar-update-flag "#" "!"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1116 (p35 (capitalize speedbar-initial-expansion-list-name))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1117 (blank (- w (length p1) (length p3) (length p5) (length p35)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1118 (if line-number-mode 5 1)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1119 (p2 (if (> blank 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1120 (make-string (/ blank 2) ? )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1121 ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1122 (p4 (if (> blank 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1123 (make-string (+ (/ blank 2) (% blank 2)) ? )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1124 ""))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1125 (tf
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1126 (if line-number-mode
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1127 (list (concat p1 p2 p3 " " p35) '(line-number-mode " %3l")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1128 (concat p4 p5))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1129 (list (concat p1 p2 p3 p4 p5)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1130 (if (not (equal mode-line-format tf))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1131 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1132 (setq mode-line-format tf)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1133 (speedbar-mode-line-update)))))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1134
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1135 (defvar speedbar-previous-menu nil
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1136 "The menu before the last `speedbar-reconfigure-keymaps' was called.")
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1137
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1138 (defun speedbar-reconfigure-keymaps ()
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1139 "Reconfigure the menu-bar in a speedbar frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1140 Different menu items are displayed depending on the current display mode
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1141 and the existence of packages."
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1142 (let ((md (append
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1143 speedbar-easymenu-definition-base
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1144 (if speedbar-shown-directories
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1145 ;; file display mode version
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1146 (speedbar-initial-menu)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1147 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1148 (dframe-select-attached-frame speedbar-frame)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1149 (if (local-variable-p
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1150 'speedbar-easymenu-definition-special
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1151 (current-buffer))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1152 ;; If bound locally, we can use it
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1153 speedbar-easymenu-definition-special)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1154 ;; Dynamic menu stuff
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1155 '("-")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1156 (list (cons "Displays"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1157 (let ((displays nil)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1158 (alist speedbar-initial-expansion-mode-alist))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1159 (while alist
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1160 (setq displays
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1161 (cons
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1162 (vector
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1163 (capitalize (car (car alist)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1164 (list
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1165 'speedbar-change-initial-expansion-list
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1166 (car (car alist)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1167 :style 'radio
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1168 :selected
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1169 `(string= ,(car (car alist))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1170 speedbar-initial-expansion-list-name)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1171 )
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1172 displays))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1173 (setq alist (cdr alist)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1174 displays)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1175 ;; The trailer
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1176 speedbar-easymenu-definition-trailer))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1177 (localmap (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1178 (let ((cf (selected-frame)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1179 (prog2
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1180 (dframe-select-attached-frame speedbar-frame)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1181 (if (local-variable-p
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1182 'speedbar-special-mode-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1183 (current-buffer))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1184 speedbar-special-mode-key-map)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1185 (select-frame cf))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1186 (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1187 (set-buffer speedbar-buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1188 (use-local-map (or localmap
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1189 (speedbar-initial-keymap)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1190 ;; This creates a small keymap we can glom the
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1191 ;; menu adjustments into.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1192 (speedbar-make-specialized-keymap)))
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1193 ;; Delete the old menu if applicable.
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1194 (if speedbar-previous-menu (easy-menu-remove speedbar-previous-menu))
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1195 (setq speedbar-previous-menu md)
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1196 ;; Now add the new menu
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1197 (if (not dframe-xemacsp)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1198 (easy-menu-define speedbar-menu-map (current-local-map)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1199 "Speedbar menu" md)
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1200 (easy-menu-add md (current-local-map))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1201 ;; XEmacs-specific:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1202 (if (fboundp 'set-buffer-menubar)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1203 (set-buffer-menubar (list md)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1204
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1205 (run-hooks 'speedbar-reconfigure-keymaps-hook)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1206
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1207
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1208 ;;; User Input stuff
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1209 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1210 (defun speedbar-customize ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1211 "Customize speedbar using the Custom package."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1212 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1213 (let ((sf (selected-frame)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1214 (dframe-select-attached-frame speedbar-frame)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1215 (customize-group 'speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1216 (select-frame sf))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1217 (dframe-maybee-jump-to-attached-frame))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1218
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1219 (defun speedbar-track-mouse (event)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1220 "For motion EVENT, display info about the current line."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1221 (if (not speedbar-track-mouse-flag)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1222 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1223 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1224 (save-window-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1225 (condition-case nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1226 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1227 (mouse-set-point event)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1228 (if (eq major-mode 'speedbar-mode)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1229 ;; XEmacs may let us get in here in other mode buffers.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1230 (speedbar-item-info)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1231 (t (speedbar-message nil)))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1232
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1233 (defun speedbar-show-info-under-mouse ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1234 "Call the info function for the line under the mouse.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1235 Optional EVENT is currently not used."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1236 (let ((pos (mouse-position))) ; we ignore event until I use it later.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1237 (if (equal (car pos) speedbar-frame)
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1238 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1239 (save-window-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1240 (apply 'set-mouse-position pos)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1241 (speedbar-item-info))))))
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1242
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1243 (defun speedbar-next (arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1244 "Move to the next ARGth line in a speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1245 (interactive "p")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1246 (forward-line (or arg 1))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1247 (speedbar-item-info)
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-prev (arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1251 "Move to the previous ARGth line in a speedbar buffer."
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 (speedbar-next (if arg (- arg) -1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1254
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1255 (defun speedbar-restricted-move (arg)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1256 "Move to the next ARGth line in a speedbar buffer at the same depth.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1257 This means that movement is restricted to a subnode, and that siblings
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1258 of intermediate nodes are skipped."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1259 (if (not (numberp arg)) (signal 'wrong-type-argument (list arg 'numberp)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1260 ;; First find the extent for which we are allowed to move.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1261 (let ((depth (save-excursion (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1262 (if (looking-at "[0-9]+:")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1263 (string-to-number (match-string 0))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1264 0)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1265 (crement (if (< arg 0) 1 -1)) ; decrement or increment
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1266 (lastmatch (point)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1267 (while (/= arg 0)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1268 (forward-line (- crement))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1269 (let ((subdepth (save-excursion (beginning-of-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1270 (if (looking-at "[0-9]+:")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1271 (string-to-number (match-string 0))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1272 0))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1273 (cond ((or (< subdepth depth)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1274 (progn (end-of-line) (eobp))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1275 (progn (beginning-of-line) (bobp)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1276 ;; We have reached the end of this block.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1277 (goto-char lastmatch)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1278 (setq arg 0)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1279 (error "End of sub-list"))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1280 ((= subdepth depth)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1281 (setq lastmatch (point)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1282 arg (+ arg crement))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1283 (speedbar-position-cursor-on-line)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1284
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1285 (defun speedbar-restricted-next (arg)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1286 "Move to the next ARGth line in a speedbar buffer at the same depth.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1287 This means that movement is restricted to a subnode, and that siblings
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1288 of intermediate nodes are skipped."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1289 (interactive "p")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1290 (speedbar-restricted-move (or arg 1))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1291 (speedbar-item-info))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1292
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1293 (defun speedbar-restricted-prev (arg)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1294 "Move to the previous ARGth line in a speedbar buffer at the same depth.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1295 This means that movement is restricted to a subnode, and that siblings
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1296 of intermediate nodes are skipped."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1297 (interactive "p")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1298 (speedbar-restricted-move (if arg (- arg) -1))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1299 (speedbar-item-info))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1300
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1301 (defun speedbar-navigate-list (arg)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1302 "Move across ARG groups of similarly typed items in speedbar.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1303 Stop on the first line of the next type of item, or on the last or first item
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1304 if we reach a buffer boundary."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1305 (interactive "p")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1306 (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1307 (if (looking-at "[0-9]+: *[[<{][-+?][]>}] ")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1308 (let ((str (regexp-quote (match-string 0))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1309 (while (looking-at str)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1310 (speedbar-restricted-move arg)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1311 (beginning-of-line))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1312 (speedbar-position-cursor-on-line))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1313
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1314 (defun speedbar-forward-list ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1315 "Move forward over the current list.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1316 A LIST in speedbar is a group of similarly typed items, such as directories,
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1317 files, or the directory button."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1318 (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1319 (speedbar-navigate-list 1)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1320 (speedbar-item-info))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1321
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1322 (defun speedbar-backward-list ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1323 "Move backward over the current list.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1324 A LIST in speedbar is a group of similarly typed items, such as directories,
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1325 files, or the directory button."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1326 (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1327 (speedbar-navigate-list -1)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1328 (speedbar-item-info))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1329
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1330 (defun speedbar-scroll-up (&optional arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1331 "Page down one screen-full of the speedbar, or ARG lines."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1332 (interactive "P")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1333 (scroll-up arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1334 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1335
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1336 (defun speedbar-scroll-down (&optional arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1337 "Page up one screen-full of the speedbar, or ARG lines."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1338 (interactive "P")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1339 (scroll-down arg)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1340 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1341
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1342 (defun speedbar-up-directory ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1343 "Keyboard accelerator for moving the default directory up one.
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
1344 Assumes that the current buffer is the speedbar buffer."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1345 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1346 (setq default-directory (expand-file-name (concat default-directory "../")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1347 (speedbar-update-contents))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1348
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1349 ;;; Speedbar file activity (aka creeping featurism)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1350 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1351 (defun speedbar-refresh (&optional arg)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1352 "Refresh the current speedbar display, disposing of any cached data.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1353 Argument ARG represents to force a refresh past any caches that may exist."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1354 (interactive "P")
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1355 (let ((dl speedbar-shown-directories)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1356 (dframe-power-click arg)
47627
33bcb75e91e8 (speedbar-refresh): Simply bind deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents: 47286
diff changeset
1357 deactivate-mark)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1358 ;; We need to hack something so this works in detached frames.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1359 (while dl
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1360 (adelete 'speedbar-directory-contents-alist (car dl))
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1361 (setq dl (cdr dl)))
22906
adfc04c48002 Updated refresh messages to clear themselves.
Eric M. Ludlam <zappo@gnu.org>
parents: 22893
diff changeset
1362 (if (<= 1 speedbar-verbosity-level)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1363 (speedbar-message "Refreshing speedbar..."))
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1364 (speedbar-update-contents)
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1365 (speedbar-stealthy-updates)
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1366 ;; Reset the timer in case it got really hosed for some reason...
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1367 (speedbar-set-timer dframe-update-speed)
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
1368 (if (<= 1 speedbar-verbosity-level)
47627
33bcb75e91e8 (speedbar-refresh): Simply bind deactivate-mark.
Richard M. Stallman <rms@gnu.org>
parents: 47286
diff changeset
1369 (speedbar-message "Refreshing speedbar...done"))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1370
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1371 (defun speedbar-item-load ()
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1372 "Load the item under the cursor or mouse if it is a Lisp file."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1373 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1374 (let ((f (speedbar-line-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1375 (if (and (file-exists-p f) (string-match "\\.el\\'" f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1376 (if (and (file-exists-p (concat f "c"))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1377 (speedbar-y-or-n-p (format "Load %sc? " f)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1378 ;; If the compiled version exists, load that instead...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1379 (load-file (concat f "c"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1380 (load-file f))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1381 (error "Not a loadable file"))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1382
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1383 (defun speedbar-item-byte-compile ()
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1384 "Byte compile the item under the cursor or mouse if it is a Lisp file."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1385 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1386 (let ((f (speedbar-line-file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1387 (sf (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1388 (if (and (file-exists-p f) (string-match "\\.el\\'" f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1389 (progn
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1390 (dframe-select-attached-frame speedbar-frame)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1391 (byte-compile-file f nil)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1392 (select-frame sf)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1393 (speedbar-reset-scanners)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1394 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1395
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1396 (defun speedbar-mouse-item-info (event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1397 "Provide information about what the user clicked on.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1398 This should be bound to a mouse EVENT."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1399 (interactive "e")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1400 (mouse-set-point event)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1401 (speedbar-item-info))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1402
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1403 (defun speedbar-generic-item-info ()
44578
9c2b72b4b303 (speedbar-generic-item-info)
Pavel Janík <Pavel@Janik.cz>
parents: 44225
diff changeset
1404 "Attempt to derive, and then display information about this line item.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1405 File style information is displayed with `speedbar-item-info'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1406 (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1407 (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1408 ;; Skip invisible number info.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1409 (if (looking-at "\\([0-9]+\\):") (goto-char (match-end 0)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1410 ;; Skip items in "folder" type text characters.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1411 (if (looking-at "\\s-*[[<({].[]>)}] ") (goto-char (match-end 0)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1412 ;; Get the text
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1413 (speedbar-message "Text: %s" (buffer-substring-no-properties
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1414 (point) (progn (end-of-line) (point))))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1415
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1416 (defun speedbar-item-info ()
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1417 "Display info in the mini-buffer about the button the mouse is over.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1418 This function can be replaced in `speedbar-mode-functions-list' as
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
1419 `speedbar-item-info'."
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1420 (interactive)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1421 (let (message-log-max)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1422 (funcall (or (speedbar-fetch-replacement-function 'speedbar-item-info)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1423 'speedbar-generic-item-info))))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1424
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1425 (defun speedbar-item-info-file-helper (&optional filename)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1426 "Display info about a file that is on the current line.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1427 nil if not applicable. If FILENAME, then use that instead of reading
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1428 it from the speedbar buffer."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1429 (let* ((item (or filename (speedbar-line-file)))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1430 (attr (if item (file-attributes item) nil)))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1431 (if (and item attr) (speedbar-message "%s %-6d %s" (nth 8 attr)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1432 (nth 7 attr) item)
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1433 nil)))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1434
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1435 (defun speedbar-item-info-tag-helper ()
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1436 "Display info about a tag that is on the current line.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1437 nil if not applicable."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1438 (save-excursion
24321
0e5b7bb19ddc (speedbar-item-info-tag-helper): Scan the whole line.
Richard M. Stallman <rms@gnu.org>
parents: 24232
diff changeset
1439 (beginning-of-line)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1440 (if (re-search-forward " [-+=]?> \\([^\n]+\\)"
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1441 (save-excursion(end-of-line)(point)) t)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1442 (let* ((tag (match-string 1))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1443 (attr (speedbar-line-token))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1444 (item nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1445 (semantic-tagged (if (fboundp 'semantic-tag-p)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1446 (semantic-tag-p attr))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1447 (if semantic-tagged
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1448 (with-no-warnings
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1449 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1450 (when (and (semantic-tag-overlay attr)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1451 (semantic-tag-buffer attr))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1452 (set-buffer (semantic-tag-buffer attr)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1453 (speedbar-message
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1454 (funcall semantic-sb-info-format-tag-function attr)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1455 )))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1456 (looking-at "\\([0-9]+\\):")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1457 (setq item (file-name-nondirectory (speedbar-line-directory)))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1458 (speedbar-message "Tag: %s in %s" tag item)))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1459 (if (re-search-forward "{[+-]} \\([^\n]+\\)$"
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1460 (save-excursion(end-of-line)(point)) t)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1461 (speedbar-message "Group of tags \"%s\"" (match-string 1))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1462 (if (re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1463 (let* ((detailtext (match-string 1))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1464 (detail (or (speedbar-line-token) detailtext))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1465 (parent (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1466 (beginning-of-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1467 (let ((dep (if (looking-at "[0-9]+:")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1468 (1- (string-to-number (match-string 0)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1469 0)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1470 (re-search-backward (concat "^"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1471 (int-to-string dep)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1472 ":")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1473 nil t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1474 (if (looking-at "[0-9]+: +[-+=>]> \\([^\n]+\\)$")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1475 (speedbar-line-token)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1476 nil))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1477 (if (featurep 'semantic)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1478 (with-no-warnings
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1479 (if (semantic-tag-p detail)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1480 (speedbar-message
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1481 (funcall semantic-sb-info-format-tag-function detail parent))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1482 (if parent
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1483 (speedbar-message "Detail: %s of tag %s" detail
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1484 (if (semantic-tag-p parent)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1485 (semantic-format-tag-name parent nil t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1486 parent))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1487 (speedbar-message "Detail: %s" detail))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1488 ;; Not using `semantic':
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1489 (if parent
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1490 (speedbar-message "Detail: %s of tag %s" detail parent)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1491 (speedbar-message "Detail: %s" detail))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1492 nil)))))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1493
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1494 (defun speedbar-files-item-info ()
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1495 "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
1496 (if (not speedbar-shown-directories)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1497 (speedbar-generic-item-info)
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1498 (or (speedbar-item-info-file-helper)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1499 (speedbar-item-info-tag-helper)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1500 (speedbar-generic-item-info))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1501
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1502 (defun speedbar-item-copy ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1503 "Copy the item under the cursor.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1504 Files can be copied to new names or places."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1505 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1506 (let ((f (speedbar-line-file)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1507 (if (not f) (error "Not a file"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1508 (if (file-directory-p f)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1509 (error "Cannot copy directory")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1510 (let* ((rt (read-file-name (format "Copy %s to: "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1511 (file-name-nondirectory f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1512 (file-name-directory f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1513 (refresh (member (expand-file-name (file-name-directory rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1514 speedbar-shown-directories)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1515 ;; Create the right file name part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1516 (if (file-directory-p rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1517 (setq rt
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1518 (concat (expand-file-name rt)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1519 (if (string-match "[/\\]$" rt) "" "/")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1520 (file-name-nondirectory f))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1521 (if (or (not (file-exists-p rt))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1522 (speedbar-y-or-n-p (format "Overwrite %s with %s? " rt f)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1523 t))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1524 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1525 (copy-file f rt t t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1526 ;; refresh display if the new place is currently displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1527 (if refresh
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1528 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1529 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1530 (if (not (speedbar-goto-this-file rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1531 (speedbar-goto-this-file f))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1532 ))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1533
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1534 (defun speedbar-item-rename ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1535 "Rename the item under the cursor or mouse.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1536 Files can be renamed to new names or moved to new directories."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1537 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1538 (let ((f (speedbar-line-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1539 (if f
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1540 (let* ((rt (read-file-name (format "Rename %s to: "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1541 (file-name-nondirectory f))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1542 (file-name-directory f)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1543 (refresh (member (expand-file-name (file-name-directory rt))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1544 speedbar-shown-directories)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1545 ;; Create the right file name part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1546 (if (file-directory-p rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1547 (setq rt
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1548 (concat (expand-file-name rt)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1549 (if (string-match "[/\\]\\'" rt) "" "/")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1550 (file-name-nondirectory f))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1551 (if (or (not (file-exists-p rt))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1552 (speedbar-y-or-n-p (format "Overwrite %s with %s? " rt f)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1553 t))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1554 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1555 (rename-file f rt t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1556 ;; refresh display if the new place is currently displayed.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1557 (if refresh
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1558 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1559 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1560 (speedbar-goto-this-file rt)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1561 )))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1562 (error "Not a file"))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1563
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1564 (defun speedbar-create-directory ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1565 "Create a directory in speedbar."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1566 (interactive)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1567 (let ((f (speedbar-line-file)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1568 (if f
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1569 (let* ((basedir (file-name-directory f))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1570 (nd (read-file-name "Create directory: "
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1571 basedir)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1572 ;; Make the directory
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1573 (make-directory nd t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1574 (speedbar-refresh)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1575 (speedbar-goto-this-file nd)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1576 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1577 (error "Not a file"))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1578
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1579 (defun speedbar-item-delete ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1580 "Delete the item under the cursor. Files are removed from disk."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1581 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1582 (let ((f (speedbar-line-file)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1583 (if (not f) (error "Not a file"))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1584 (if (speedbar-y-or-n-p (format "Delete %s? " f) t)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1585 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1586 (if (file-directory-p f)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1587 (delete-directory f)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1588 (delete-file f))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
1589 (speedbar-message "Okie dokie..")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1590 (let ((p (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1591 (speedbar-refresh)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1592 (goto-char p))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1593 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1594 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1595
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1596 (defun speedbar-item-object-delete ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1597 "Delete the object associated from the item under the cursor.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1598 The file is removed from disk. The object is determined from the
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1599 variable `speedbar-obj-alist'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1600 (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1601 (let* ((f (speedbar-line-file))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1602 (obj nil)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1603 (oa speedbar-obj-alist))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1604 (if (not f) (error "Not a file"))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1605 (while (and oa (not (string-match (car (car oa)) f)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1606 (setq oa (cdr oa)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1607 (setq obj (concat (file-name-sans-extension f) (cdr (car oa))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1608 (if (and oa (file-exists-p obj)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1609 (speedbar-y-or-n-p (format "Delete %s? " obj) t))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1610 (progn
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1611 (delete-file obj)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1612 (speedbar-reset-scanners)))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1613
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1614 (defun speedbar-enable-update ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1615 "Enable automatic updating in speedbar via timers."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1616 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1617 (setq speedbar-update-flag t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1618 (speedbar-set-mode-line-format)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1619 (speedbar-set-timer dframe-update-speed))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1620
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1621 (defun speedbar-disable-update ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1622 "Disable automatic updating and stop consuming resources."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1623 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1624 (setq speedbar-update-flag nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1625 (speedbar-set-mode-line-format)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1626 (speedbar-set-timer nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1627
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1628 (defun speedbar-toggle-updates ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1629 "Toggle automatic update for the speedbar frame."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1630 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1631 (if speedbar-update-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1632 (speedbar-disable-update)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1633 (speedbar-enable-update)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1634
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1635 (defun speedbar-toggle-images ()
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1636 "Toggle use of images in the speedbar frame.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1637 Images are not available in Emacs 20 or earlier."
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1638 (interactive)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1639 (setq speedbar-use-images (not speedbar-use-images))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1640 (speedbar-refresh))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1641
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1642 (defun speedbar-toggle-sorting ()
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1643 "Toggle tag sorting."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1644 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1645 (setq speedbar-sort-tags (not speedbar-sort-tags)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1646
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1647 (defun speedbar-toggle-show-all-files ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1648 "Toggle display of files speedbar can not tag."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1649 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1650 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1651 (speedbar-refresh))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1652
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1653 (defmacro speedbar-with-writable (&rest forms)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1654 "Allow the buffer to be writable and evaluate FORMS."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1655 (list 'let '((inhibit-read-only t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1656 (cons 'progn forms)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1657 (put 'speedbar-with-writable 'lisp-indent-function 0)
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-insert-button (text face mouse function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1660 &optional token prevline)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1661 "Insert TEXT as the next logical speedbar button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1662 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
1663 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
1664 This function assumes that the current buffer is the speedbar buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1665 If PREVLINE, then put this button on the previous line.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1666
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
1667 This is a convenience function for special modes that create their own
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1668 specialized speedbar displays."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1669 (goto-char (point-max))
29130
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
1670 (let ((start (point)))
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
1671 (if (/= (current-column) 0) (insert "\n"))
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
1672 (put-text-property start (point) 'invisible nil))
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
1673 (if prevline (progn (delete-char -1)
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
1674 (insert " ") ;back up if desired...
b37210b05707 (speedbar-easymenu-definition-base): Image toggle fix.
Eric M. Ludlam <zappo@gnu.org>
parents: 28925
diff changeset
1675 (put-text-property (1- (point)) (point) 'invisible nil)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1676 (let ((start (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1677 (insert text)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1678 (speedbar-make-button start (point) face mouse function token))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1679 (let ((start (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1680 (insert "\n")
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1681 (add-text-properties
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1682 start (point) '(face nil invisible nil mouse-face nil))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1683
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1684 (defun speedbar-insert-separator (text)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1685 "Insert a separation label of TEXT.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1686 Separators are not active, have no labels, depth, or actions."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1687 (if speedbar-use-images
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1688 (let ((start (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1689 (insert "//")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1690 (speedbar-insert-image-button-maybe start 2)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1691 (let ((start (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1692 (insert text "\n")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1693 (speedbar-make-button start (point)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1694 'speedbar-separator-face
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1695 nil nil nil)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1696
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1697 (defun speedbar-make-button (start end face mouse function &optional token)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1698 "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
1699 MOUSE is the mouse face. When this button is clicked on FUNCTION
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1700 will be run with the TOKEN parameter (any Lisp object)"
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1701 (add-text-properties
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1702 start end `(face ,face mouse-face ,mouse invisible nil
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
1703 speedbar-text ,(buffer-substring-no-properties start end)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1704 (if speedbar-use-tool-tips-flag
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1705 (put-text-property start end 'help-echo #'dframe-help-echo))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1706 (if function (put-text-property start end 'speedbar-function function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1707 (if token (put-text-property start end 'speedbar-token token))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1708 ;; So far the only text we have is less that 3 chars.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1709 (if (<= (- end start) 3)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1710 (speedbar-insert-image-button-maybe start (- end start)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1711 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1712
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1713 ;;; Initial Expansion list management
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1714 ;;
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1715 (defun speedbar-initial-expansion-list ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1716 "Return the current default expansion list.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1717 This is based on `speedbar-initial-expansion-list-name' referencing
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1718 `speedbar-initial-expansion-mode-alist'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1719 ;; cdr1 - name, cdr2 - menu
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1720 (cdr (cdr (cdr (assoc speedbar-initial-expansion-list-name
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1721 speedbar-initial-expansion-mode-alist)))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1722
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1723 (defun speedbar-initial-menu ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1724 "Return the current default menu data.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1725 This is based on `speedbar-initial-expansion-list-name' referencing
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1726 `speedbar-initial-expansion-mode-alist'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1727 (symbol-value
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1728 (car (cdr (assoc speedbar-initial-expansion-list-name
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1729 speedbar-initial-expansion-mode-alist)))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1730
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1731 (defun speedbar-initial-keymap ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1732 "Return the current default menu data.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1733 This is based on `speedbar-initial-expansion-list-name' referencing
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1734 `speedbar-initial-expansion-mode-alist'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1735 (symbol-value
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1736 (car (cdr (cdr (assoc speedbar-initial-expansion-list-name
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1737 speedbar-initial-expansion-mode-alist))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1738
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1739 (defun speedbar-initial-stealthy-functions ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1740 "Return a list of functions to call stealthily.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1741 This is based on `speedbar-initial-expansion-list-name' referencing
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1742 `speedbar-stealthy-function-list'."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1743 (cdr (assoc speedbar-initial-expansion-list-name
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1744 speedbar-stealthy-function-list)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1745
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1746 (defun speedbar-add-expansion-list (new-list)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1747 "Add NEW-LIST to the list of expansion lists."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1748 (add-to-list 'speedbar-initial-expansion-mode-alist new-list))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1749
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1750 (defun speedbar-change-initial-expansion-list (new-default)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1751 "Change speedbar's default expansion list to NEW-DEFAULT."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1752 (interactive
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1753 (list
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1754 (completing-read (format "Speedbar Mode (default %s): "
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1755 speedbar-previously-used-expansion-list-name)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1756 speedbar-initial-expansion-mode-alist
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1757 nil t "" nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1758 speedbar-previously-used-expansion-list-name)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1759 (setq speedbar-previously-used-expansion-list-name
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1760 speedbar-initial-expansion-list-name
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1761 speedbar-initial-expansion-list-name new-default)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1762 (if (and (speedbar-current-frame) (frame-live-p (speedbar-current-frame)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1763 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1764 (speedbar-refresh)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1765 (speedbar-reconfigure-keymaps))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1766
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1767 (defun speedbar-fetch-replacement-function (function)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1768 "Return a current mode specific replacement for function, or nil.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1769 Scans `speedbar-mode-functions-list' first for the current mode, then
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1770 for FUNCTION."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1771 (cdr (assoc function
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1772 (cdr (assoc speedbar-initial-expansion-list-name
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1773 speedbar-mode-functions-list)))))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1774
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1775 (defun speedbar-add-mode-functions-list (new-list)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1776 "Add NEW-LIST to the list of mode functions.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1777 See `speedbar-mode-functions-list' for details."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1778 (add-to-list 'speedbar-mode-functions-list new-list))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
1779
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1780
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1781 ;;; Special speedbar display management
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1782 ;;
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1783 (defun speedbar-maybe-add-localized-support (buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1784 "Quick check function called on BUFFERs by the speedbar timer function.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1785 Maintains the value of local variables which control speedbars use
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1786 of the special mode functions."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1787 (or speedbar-special-mode-expansion-list
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1788 (speedbar-add-localized-speedbar-support buffer)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1789
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1790 (defun speedbar-add-localized-speedbar-support (buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1791 "Add localized speedbar support to BUFFER's mode if it is available."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1792 (interactive "bBuffer: ")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1793 (if (stringp buffer) (setq buffer (get-buffer buffer)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1794 (if (not (buffer-live-p buffer))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1795 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1796 (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1797 (set-buffer buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1798 (save-match-data
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1799 (let ((ms (symbol-name major-mode)) v)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1800 (if (not (string-match "-mode$" ms))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1801 nil ;; do nothing to broken mode
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1802 (setq ms (substring ms 0 (match-beginning 0)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1803 (setq v (intern-soft (concat ms "-speedbar-buttons")))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1804 (make-local-variable 'speedbar-special-mode-expansion-list)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1805 (if (not v)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1806 (setq speedbar-special-mode-expansion-list t)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1807 ;; If it is autoloaded, we need to load it now so that
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1808 ;; we have access to the varialbe -speedbar-menu-items.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1809 ;; Is this XEmacs safe?
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1810 (let ((sf (symbol-function v)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1811 (if (and (listp sf) (eq (car sf) 'autoload))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1812 (load-library (car (cdr sf)))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1813 (setq speedbar-special-mode-expansion-list (list v))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1814 (setq v (intern-soft (concat ms "-speedbar-key-map")))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1815 (if (not v)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1816 nil ;; don't add special keymap
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1817 (make-local-variable 'speedbar-special-mode-key-map)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1818 (setq speedbar-special-mode-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1819 (symbol-value v)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1820 (setq v (intern-soft (concat ms "-speedbar-menu-items")))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1821 (if (not v)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1822 nil ;; don't add special menus
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1823 (make-local-variable 'speedbar-easymenu-definition-special)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1824 (setq speedbar-easymenu-definition-special
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1825 (symbol-value v)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1826 )))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1827
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1828 (defun speedbar-remove-localized-speedbar-support (buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1829 "Remove any traces that BUFFER supports speedbar in a specialized way."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1830 (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1831 (set-buffer buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1832 (kill-local-variable 'speedbar-special-mode-expansion-list)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1833 (kill-local-variable 'speedbar-special-mode-key-map)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1834 (kill-local-variable 'speedbar-easymenu-definition-special)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
1835
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1836 ;;; File button management
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1837 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1838 (defun speedbar-file-lists (directory)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1839 "Create file lists for DIRECTORY.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1840 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
1841 matching ignored headers. Cache any directory files found in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1842 `speedbar-directory-contents-alist' and use that cache before scanning
46286
6117ca314143 (speedbar-tag-hierarchy-method): Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 46282
diff changeset
1843 the file-system."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1844 (setq directory (expand-file-name directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1845 ;; If in powerclick mode, then the directory we are getting
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1846 ;; should be rescanned.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1847 (if dframe-power-click
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1848 (adelete 'speedbar-directory-contents-alist directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1849 ;; find the directory, either in the cache, or build it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1850 (or (cdr-safe (assoc directory speedbar-directory-contents-alist))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1851 (let ((default-directory directory)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1852 (dir (directory-files directory nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1853 (dirs nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1854 (files nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1855 (while dir
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1856 (if (not
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1857 (or (string-match speedbar-file-unshown-regexp (car dir))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1858 (string-match speedbar-directory-unshown-regexp (car dir))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1859 (if (file-directory-p (car dir))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1860 (setq dirs (cons (car dir) dirs))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1861 (setq files (cons (car dir) files))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1862 (setq dir (cdr dir)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1863 (let ((nl (cons (nreverse dirs) (list (nreverse files)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1864 (aput 'speedbar-directory-contents-alist directory nl)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1865 nl))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1866 ))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1867
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1868 (defun speedbar-directory-buttons (directory index)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1869 "Insert a single button group at point for DIRECTORY.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1870 Each directory directory part is a different button. If part of the directory
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1871 matches the user directory ~, then it is replaced with a ~.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1872 INDEX is not used, but is required by the caller."
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1873 (let* ((tilde (expand-file-name "~/"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1874 (dd (expand-file-name directory))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1875 (junk (string-match (regexp-quote tilde) dd))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1876 (displayme (if junk
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1877 (concat "~/" (substring dd (match-end 0)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1878 dd))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1879 (p (point)))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1880 (if (string-match "^~[/\\]?\\'" displayme) (setq displayme tilde))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1881 (insert displayme)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1882 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1883 (goto-char p)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1884 (while (re-search-forward "\\([^/\\]+\\)[/\\]" nil t)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1885 (speedbar-make-button (match-beginning 1) (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1886 'speedbar-directory-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1887 'speedbar-highlight-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1888 'speedbar-directory-buttons-follow
25432
07df7c764669 (speedbar-directory-buttons): Recognize
Richard M. Stallman <rms@gnu.org>
parents: 24809
diff changeset
1889 (if (and (= (match-beginning 1) p)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1890 (not (char-equal (char-after (+ p 1)) ?:)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1891 (expand-file-name "~/") ;the tilde
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1892 (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1893 p (match-end 0)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1894 ;; Nuke the beginning of the directory if it's too long...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1895 (cond ((eq speedbar-directory-button-trim-method 'span)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1896 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1897 (let ((ww (or (speedbar-frame-width) 20)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1898 (move-to-column ww nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1899 (while (>= (current-column) ww)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1900 (re-search-backward "[/\\]" nil t)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1901 (if (<= (current-column) 2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1902 (progn
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1903 (re-search-forward "[/\\]" nil t)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1904 (if (< (current-column) 4)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1905 (re-search-forward "[/\\]" nil t))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1906 (forward-char -1)))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1907 (if (looking-at "[/\\]?$")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1908 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1909 (insert "/...\n ")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1910 (move-to-column ww nil)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1911 ((eq speedbar-directory-button-trim-method 'trim)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1912 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1913 (let ((ww (or (speedbar-frame-width) 20))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1914 (tl (current-column)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1915 (if (< ww tl)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1916 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1917 (move-to-column (- tl ww))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1918 (if (re-search-backward "[/\\]" nil t)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1919 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1920 (delete-region (point-min) (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1921 (insert "$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1922 )))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1923 )
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1924 (if (string-match "\\`[/\\][^/\\]+[/\\]\\'" displayme)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1925 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1926 (insert " ")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1927 (let ((p (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1928 (insert "<root>")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1929 (speedbar-make-button p (point)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1930 'speedbar-directory-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1931 'speedbar-highlight-face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1932 'speedbar-directory-buttons-follow
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1933 "/"))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1934 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1935 (insert-char ?\n 1 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1936
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1937 (defun speedbar-make-tag-line (exp-button-type
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1938 exp-button-char exp-button-function
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1939 exp-button-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1940 tag-button tag-button-function tag-button-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1941 tag-button-face depth)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1942 "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
1943 This is the button that expands or contracts a node (if applicable),
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1944 and EXP-BUTTON-CHAR the character in it (+, -, ?, etc). EXP-BUTTON-FUNCTION
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1945 is the function to call if it's clicked on. Button types are
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1946 'bracket, 'angle, 'curly, 'expandtag, 'statictag, t, or nil.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1947 EXP-BUTTON-DATA is extra data attached to the text forming the expansion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1948 button.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1949
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1950 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
1951 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
1952 attach to the text field (such a tag positioning, etc).
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1953 TAG-BUTTON-FACE is a face used for this type of tag.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1954
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1955 Lastly, DEPTH shows the depth of expansion.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1956
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1957 This function assumes that the cursor is in the speedbar window at the
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
1958 position to insert a new item, and that the new item will end with a CR."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1959 (let ((start (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1960 (end (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1961 (insert (int-to-string depth) ":")
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1962 (point)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1963 (depthspacesize (* depth speedbar-indentation-width)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1964 (put-text-property start end 'invisible t)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1965 (insert-char ? depthspacesize nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1966 (put-text-property (- (point) depthspacesize) (point) 'invisible nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1967 (let* ((exp-button (cond ((eq exp-button-type 'bracket) "[%c]")
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1968 ((eq exp-button-type 'angle) "<%c>")
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1969 ((eq exp-button-type 'curly) "{%c}")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1970 ((eq exp-button-type 'expandtag) " %c>")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1971 ((eq exp-button-type 'statictag) " =>")
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1972 (t ">")))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1973 (buttxt (format exp-button exp-button-char))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1974 (start (point))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1975 (end (progn (insert buttxt) (point)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1976 (bf (if (and exp-button-type (not (eq exp-button-type 'statictag)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1977 'speedbar-button-face nil))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1978 (mf (if exp-button-function 'speedbar-highlight-face nil))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1979 )
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1980 (speedbar-make-button start end bf mf exp-button-function exp-button-data)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1981 (if speedbar-hide-button-brackets-flag
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1982 (progn
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1983 (put-text-property start (1+ start) 'invisible t)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1984 (put-text-property end (1- end) 'invisible t)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1985 )
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1986 (insert-char ? 1 nil)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1987 (put-text-property (1- (point)) (point) 'invisible nil)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1988 (let ((start (point))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1989 (end (progn (insert tag-button) (point))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1990 (insert-char ?\n 1 nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1991 (put-text-property (1- (point)) (point) 'invisible nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1992 (speedbar-make-button start end tag-button-face
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1993 (if tag-button-function 'speedbar-highlight-face nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1994 tag-button-function tag-button-data))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
1995 ))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
1996
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1997 (defun speedbar-change-expand-button-char (char)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1998 "Change the expansion button character to CHAR for the current line."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
1999 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2000 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2001 (if (re-search-forward ":\\s-*.\\([-+?]\\)" (save-excursion (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2002 (point)) t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2003 (speedbar-with-writable
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2004 (goto-char (match-end 1))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2005 (insert-char char 1 t)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2006 (forward-char -1)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2007 (delete-char -1)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2008 ;;(put-text-property (point) (1- (point)) 'invisible nil)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2009 ;; make sure we fix the image on the text here.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2010 (speedbar-insert-image-button-maybe (- (point) 1) 3)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2011
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2012
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2013 ;;; Build button lists
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2014 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2015 (defun speedbar-insert-files-at-point (files level)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2016 "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
2017 Tag expandable items with a +, otherwise a ?. Don't highlight ? as we
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2018 don't know how to manage them. The input parameter FILES is a cons
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
2019 cell of the form ( 'DIRLIST . 'FILELIST )."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2020 ;; Start inserting all the directories
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2021 (let ((dirs (car files)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2022 (while dirs
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2023 (speedbar-make-tag-line 'angle ?+ 'speedbar-dired (car dirs)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2024 (car dirs) 'speedbar-dir-follow nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2025 'speedbar-directory-face level)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2026 (setq dirs (cdr dirs))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2027 (let ((lst (car (cdr files)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2028 (case-fold-search t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2029 (while lst
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2030 (let* ((known (string-match speedbar-file-regexp (car lst)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2031 (expchar (if known ?+ ??))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2032 (fn (if known 'speedbar-tag-file nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2033 (if (or speedbar-show-unknown-files (/= expchar ??))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2034 (speedbar-make-tag-line 'bracket expchar fn (car lst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2035 (car lst) 'speedbar-find-file nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2036 'speedbar-file-face level)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2037 (setq lst (cdr lst)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2038
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2039 (defun speedbar-default-directory-list (directory index)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2040 "Insert files for DIRECTORY with level INDEX at point."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2041 (speedbar-insert-files-at-point
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2042 (speedbar-file-lists directory) index)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2043 (speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2044 (if (= index 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2045 ;; If the shown files variable has extra directories, then
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2046 ;; it is our responsibility to redraw them all
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2047 ;; Luckilly, the nature of inserting items into this list means
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2048 ;; that by reversing it, we can easilly go in the right order
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2049 (let ((sf (cdr (reverse speedbar-shown-directories))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2050 (setq speedbar-shown-directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2051 (list (expand-file-name default-directory)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2052 ;; exand them all as we find them
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2053 (while sf
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2054 (if (speedbar-goto-this-file (car sf))
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 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2057 (if (looking-at "[0-9]+:[ ]*<")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2058 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2059 (goto-char (match-end 0))
44225
e47fc6bb028d (speedbar-default-directory-list): Made robust against deleted directories.
Richard M. Stallman <rms@gnu.org>
parents: 42456
diff changeset
2060 (speedbar-do-function-pointer)))))
e47fc6bb028d (speedbar-default-directory-list): Made robust against deleted directories.
Richard M. Stallman <rms@gnu.org>
parents: 42456
diff changeset
2061 (setq sf (cdr sf)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2062 )))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2063 ;;; Generic List support
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2064 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2065 ;; Generic lists are hierarchies of tags which we may need to permute
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2066 ;; in order to make it look nice.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2067 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2068 ;; A generic list is of the form:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2069 ;; ( ("name" . marker-or-number) <-- one tag at this level
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2070 ;; ("name" ("name" . mon) ("name" . mon) ) <-- one group of tags
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2071 ;; ("name" mon ("name" . mon) ) <-- group w/ a position and tags
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2072 (defun speedbar-generic-list-group-p (sublst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2073 "Non-nil if SUBLST is a group.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2074 Groups may optionally contain a position."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2075 (and (stringp (car-safe sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2076 (or (and (listp (cdr-safe sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2077 (or (speedbar-generic-list-tag-p (car-safe (cdr-safe sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2078 (speedbar-generic-list-group-p (car-safe (cdr-safe sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2079 )))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2080 (and (number-or-marker-p (car-safe (cdr-safe sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2081 (listp (cdr-safe (cdr-safe sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2082 (speedbar-generic-list-tag-p
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2083 (car-safe (cdr-safe (cdr-safe sublst)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2084 )))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2085
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2086 (defun speedbar-generic-list-positioned-group-p (sublst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2087 "Non-nil of SUBLST is a group with a position."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2088 (and (stringp (car-safe sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2089 (number-or-marker-p (car-safe (cdr-safe sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2090 (listp (cdr-safe (cdr-safe sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2091 (let ((rest (car-safe (cdr-safe (cdr-safe sublst)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2092 (or (speedbar-generic-list-tag-p rest)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2093 (speedbar-generic-list-group-p rest)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2094 (speedbar-generic-list-positioned-group-p rest)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2095 ))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2096
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2097 (defun speedbar-generic-list-tag-p (sublst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2098 "Non nil if SUBLST is a tag."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2099 (and (stringp (car-safe sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2100 (or (and (number-or-marker-p (cdr-safe sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2101 (not (cdr-safe (cdr-safe sublst))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2102 ;; For semantic/bovine items, this is needed
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2103 (symbolp (car-safe (cdr-safe sublst))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2104 ))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2105
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2106 (defun speedbar-sort-tag-hierarchy (lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2107 "Sort all elements of tag hierarchy LST."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2108 (sort (copy-alist lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2109 (lambda (a b) (string< (car a) (car b)))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2110
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2111 (defun speedbar-try-completion (string alist)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2112 "A wrapper for `try-completion'.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2113 Passes STRING and ALIST to `try-completion' if ALIST
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2114 passes some tests."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2115 (if (and (listp alist) (not (null alist))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2116 (listp (car alist)) (stringp (car (car alist))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2117 (try-completion string alist)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2118 nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2119
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2120 (defun speedbar-prefix-group-tag-hierarchy (lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2121 "Prefix group names for tag hierarchy LST."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2122 (let ((newlst nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2123 (sublst nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2124 (work-list nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2125 (junk-list nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2126 (short-group-list nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2127 (short-start-name nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2128 (short-end-name nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2129 (num-shorts-grouped 0)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2130 (bins (make-vector 256 nil))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2131 (diff-idx 0))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2132 (if (<= (length lst) speedbar-tag-regroup-maximum-length)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2133 ;; Do nothing. Too short to bother with.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2134 lst
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2135 ;; Break out sub-lists
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2136 (while lst
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2137 (if (speedbar-generic-list-group-p (car-safe lst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2138 (setq newlst (cons (car lst) newlst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2139 (setq sublst (cons (car lst) sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2140 (setq lst (cdr lst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2141 ;; Reverse newlst because it was made backwards.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2142 ;; Sublist doesn't need reversing because the act
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2143 ;; of binning things will reverse it for us.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2144 (setq newlst (nreverse newlst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2145 sublst sublst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2146 ;; Now, first find out how long our list is. Never let a
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2147 ;; list get-shorter than our minimum.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2148 (if (<= (length sublst) speedbar-tag-split-minimum-length)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2149 (setq work-list sublst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2150 (setq diff-idx (length (speedbar-try-completion "" sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2151 ;; Sort the whole list into bins.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2152 (while sublst
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2153 (let ((e (car sublst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2154 (s (car (car sublst))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2155 (cond ((<= (length s) diff-idx)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2156 ;; 0 storage bin for shorty.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2157 (aset bins 0 (cons e (aref bins 0))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2158 (t
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2159 ;; stuff into a bin based on ascii value at diff
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2160 (aset bins (aref s diff-idx)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2161 (cons e (aref bins (aref s diff-idx)))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2162 (setq sublst (cdr sublst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2163 ;; Go through all our bins Stick singles into our
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2164 ;; junk-list, everything else as sublsts in work-list.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2165 ;; If two neighboring lists are both small, make a grouped
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2166 ;; group combinding those two sub-lists.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2167 (setq diff-idx 0)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2168 (while (> 256 diff-idx)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2169 ;; The bins contents are currently in forward order.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2170 (let ((l (aref bins diff-idx)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2171 (if l
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2172 (let ((tmp (cons (speedbar-try-completion "" l) l)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2173 (if (or (> (length l) speedbar-tag-regroup-maximum-length)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2174 (> (+ (length l) (length short-group-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2175 speedbar-tag-split-minimum-length))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2176 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2177 ;; We have reached a longer list, so we
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2178 ;; must finish off a grouped group.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2179 (cond
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2180 ((and short-group-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2181 (= (length short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2182 num-shorts-grouped))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2183 ;; All singles? Junk list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2184 (setq junk-list (append (nreverse short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2185 junk-list)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2186 ((= num-shorts-grouped 1)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2187 ;; Only one short group? Just stick it in
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2188 ;; there by itself. Make a group, and find
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2189 ;; a subexpression
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2190 (let ((subexpression (speedbar-try-completion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2191 "" short-group-list)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2192 (if (< (length subexpression)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2193 speedbar-tag-group-name-minimum-length)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2194 (setq subexpression
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2195 (concat short-start-name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2196 " ("
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2197 (substring
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2198 (car (car short-group-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2199 (length short-start-name))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2200 ")")))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2201 (setq work-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2202 (cons (cons subexpression
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2203 short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2204 work-list ))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2205 (short-group-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2206 ;; Multiple groups to be named in a special
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2207 ;; way by displaying the range over which we
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2208 ;; have grouped them.
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2209 (setq work-list
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2210 (cons (cons (concat short-start-name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2211 " to "
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2212 short-end-name)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2213 short-group-list)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2214 work-list))))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2215 ;; Reset short group list information every time.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2216 (setq short-group-list nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2217 short-start-name nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2218 short-end-name nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2219 num-shorts-grouped 0)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2220 ;; Ok, now that we cleaned up the short-group-list,
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2221 ;; we can deal with this new list, to decide if it
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2222 ;; should go on one of these sub-lists or not.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2223 (if (< (length l) speedbar-tag-regroup-maximum-length)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2224 (setq short-group-list (append l short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2225 num-shorts-grouped (1+ num-shorts-grouped)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2226 short-end-name (car tmp)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2227 short-start-name (if short-start-name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2228 short-start-name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2229 (car tmp)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2230 (setq work-list (cons tmp work-list))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2231 (setq diff-idx (1+ diff-idx))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2232 ;; Did we run out of things? Drop our new list onto the end.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2233 (cond
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2234 ((and short-group-list (= (length short-group-list) num-shorts-grouped))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2235 ;; All singles? Junk list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2236 (setq junk-list (append short-group-list junk-list)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2237 ((= num-shorts-grouped 1)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2238 ;; Only one short group? Just stick it in
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2239 ;; there by itself.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2240 (setq work-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2241 (cons (cons (speedbar-try-completion "" short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2242 short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2243 work-list)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2244 (short-group-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2245 ;; Multiple groups to be named in a special
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2246 ;; way by displaying the range over which we
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2247 ;; have grouped them.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2248 (setq work-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2249 (cons (cons (concat short-start-name " to " short-end-name)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2250 short-group-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2251 work-list))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2252 ;; Reverse the work list nreversed when consing.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2253 (setq work-list (nreverse work-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2254 ;; Now, stick our new list onto the end of
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2255 (if work-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2256 (if junk-list
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2257 (append newlst work-list junk-list)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2258 (append newlst work-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2259 (append newlst junk-list)))))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2260
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2261 (defun speedbar-trim-words-tag-hierarchy (lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2262 "Trim all words in a tag hierarchy.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2263 Base trimming information on word separators, and group names.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2264 Argument LST is the list of tags to trim."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2265 (let ((newlst nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2266 (sublst nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2267 (trim-prefix nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2268 (trim-chars 0)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2269 (trimlst nil))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2270 (while lst
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2271 (if (speedbar-generic-list-group-p (car-safe lst))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2272 (setq newlst (cons (car lst) newlst))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2273 (setq sublst (cons (car lst) sublst)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2274 (setq lst (cdr lst)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2275 ;; Get the prefix to trim by. Make sure that we don't trim
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2276 ;; off silly pieces, only complete understandable words.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2277 (setq trim-prefix (speedbar-try-completion "" sublst)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2278 newlst (nreverse newlst))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2279 (if (or (= (length sublst) 1)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2280 (not trim-prefix)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2281 (not (string-match "\\(\\w+\\W+\\)+" trim-prefix)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2282 (append newlst (nreverse sublst))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2283 (setq trim-prefix (substring trim-prefix (match-beginning 0)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2284 (match-end 0)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2285 (setq trim-chars (length trim-prefix))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2286 (while sublst
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2287 (setq trimlst (cons
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2288 (cons (substring (car (car sublst)) trim-chars)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2289 (cdr (car sublst)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2290 trimlst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2291 sublst (cdr sublst)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2292 ;; Put the lists together
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2293 (append newlst trimlst))))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2294
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2295 (defun speedbar-simple-group-tag-hierarchy (lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2296 "Create a simple 'Tags' group with orphaned tags.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2297 Argument LST is the list of tags to sort into groups."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2298 (let ((newlst nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2299 (sublst nil))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2300 (while lst
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2301 (if (speedbar-generic-list-group-p (car-safe lst))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2302 (setq newlst (cons (car lst) newlst))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2303 (setq sublst (cons (car lst) sublst)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2304 (setq lst (cdr lst)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2305 (if (not newlst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2306 (nreverse sublst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2307 (setq newlst (cons (cons "Tags" (nreverse sublst)) newlst))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2308 (nreverse newlst))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2309
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2310 (defun speedbar-create-tag-hierarchy (lst)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2311 "Adjust the tag hierarchy in LST, and return it.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2312 This uses `speedbar-tag-hierarchy-method' to determine how to adjust
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2313 the list."
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2314 (let* ((f (save-excursion
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2315 (forward-line -1)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2316 (or (speedbar-line-file)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2317 (speedbar-line-directory))))
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2318 (methods (if (get-file-buffer f)
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2319 (save-excursion (set-buffer (get-file-buffer f))
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2320 speedbar-tag-hierarchy-method)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2321 speedbar-tag-hierarchy-method))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2322 (lst (if (fboundp 'copy-tree)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2323 (copy-tree lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2324 lst)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2325 (while methods
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2326 (setq lst (funcall (car methods) lst)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2327 methods (cdr methods)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2328 lst))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2329
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2330 (defvar speedbar-generic-list-group-expand-button-type 'curly
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2331 "The type of button created for groups of tags.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2332 Good values for this are `curly' and `expandtag'.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2333 Make buffer local for your mode.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2334
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2335 (defvar speedbar-generic-list-tag-button-type nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2336 "The type of button created for tags in generic lists.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2337 Good values for this are nil and `statictag'.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2338 Make buffer local for your mode.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2339
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2340 (defun speedbar-insert-generic-list (level lst expand-fun find-fun)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2341 "At LEVEL, insert a generic multi-level alist LST.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2342 Associations with lists get {+} tags (to expand into more nodes) and
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2343 those with positions just get a > as the indicator. {+} buttons will
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2344 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
2345 name will have the function FIND-FUN and not token."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2346 ;; Remove imenu rescan button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2347 (if (string= (car (car lst)) "*Rescan*")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2348 (setq lst (cdr lst)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2349 ;; Get, and set up variables that define how we treat these tags.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2350 (let ((f (save-excursion (forward-line -1)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2351 (or (speedbar-line-file)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2352 (speedbar-line-directory))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2353 expand-button tag-button)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2354 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2355 (if (get-file-buffer f)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2356 (set-buffer (get-file-buffer f)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2357 (setq expand-button speedbar-generic-list-group-expand-button-type
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2358 tag-button speedbar-generic-list-tag-button-type))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2359 ;; Adjust the list.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2360 (setq lst (speedbar-create-tag-hierarchy lst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2361 ;; insert the parts
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2362 (while lst
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2363 (cond ((null (car-safe lst)) nil) ;this would be a separator
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2364 ((speedbar-generic-list-tag-p (car lst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2365 (speedbar-make-tag-line tag-button
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2366 nil nil nil ;no expand button data
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2367 (car (car lst)) ;button name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2368 find-fun ;function
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2369 (cdr (car lst)) ;token is position
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2370 'speedbar-tag-face
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2371 (1+ level)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2372 ((speedbar-generic-list-positioned-group-p (car lst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2373 (speedbar-make-tag-line expand-button
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2374 ?+ expand-fun (cdr (cdr (car lst)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2375 (car (car lst)) ;button name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2376 find-fun ;function
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2377 (car (cdr (car lst))) ;token is posn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2378 'speedbar-tag-face
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2379 (1+ level)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2380 ((speedbar-generic-list-group-p (car lst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2381 (speedbar-make-tag-line expand-button
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2382 ?+ expand-fun (cdr (car lst))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2383 (car (car lst)) ;button name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2384 nil nil 'speedbar-tag-face
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2385 (1+ level)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2386 (t (speedbar-message "speedbar-insert-generic-list: malformed list!")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2387 ))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2388 (setq lst (cdr lst)))))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2389
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2390 (defun speedbar-insert-imenu-list (indent lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2391 "At level INDENT, insert the imenu generated LST."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2392 (speedbar-insert-generic-list indent lst
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2393 'speedbar-tag-expand
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2394 'speedbar-tag-find))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2395
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2396 (defun speedbar-insert-etags-list (indent lst)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2397 "At level INDENT, insert the etags generated LST."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2398 (speedbar-insert-generic-list indent lst
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2399 'speedbar-tag-expand
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2400 'speedbar-tag-find))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2401
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2402 ;;; Timed functions
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2403 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2404 (defun speedbar-update-contents ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2405 "Generically update the contents of the speedbar buffer."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2406 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2407 ;; Set the current special buffer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2408 (setq speedbar-desired-buffer nil)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2409
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2410 ;; Check for special modes
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2411 (speedbar-maybe-add-localized-support (current-buffer))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2412
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2413 ;; Choose the correct method of doodling.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2414 (if (and speedbar-mode-specific-contents-flag
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2415 (listp speedbar-special-mode-expansion-list)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2416 speedbar-special-mode-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2417 (local-variable-p
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2418 'speedbar-special-mode-expansion-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2419 (current-buffer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2420 ;;(eq (get major-mode 'mode-class 'special)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2421 (speedbar-update-special-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2422 (speedbar-update-directory-contents)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2423
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2424 (defun speedbar-update-localized-contents ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2425 "Update the contents of the speedbar buffer for the current situation."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2426 ;; Due to the historical growth of speedbar, we need to do something
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2427 ;; special for "files" mode. Too bad.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2428 (let ((name speedbar-initial-expansion-list-name)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2429 (funclst (speedbar-initial-expansion-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2430 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2431 (if (string= name "files")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2432 ;; Do all the files type work. It still goes through the
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2433 ;; expansion list stuff. :(
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2434 (if (or (member (expand-file-name default-directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2435 speedbar-shown-directories)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2436 (and speedbar-ignored-directory-regexp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2437 (string-match
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2438 speedbar-ignored-directory-regexp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2439 (expand-file-name default-directory))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2440 nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2441 (if (<= 1 speedbar-verbosity-level)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2442 (speedbar-message "Updating speedbar to: %s..."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2443 default-directory))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2444 (speedbar-update-directory-contents)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2445 (if (<= 1 speedbar-verbosity-level)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2446 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2447 (speedbar-message "Updating speedbar to: %s...done"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2448 default-directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2449 (speedbar-message nil))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2450 ;; Else, we can do a short cut. No text cache.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2451 (let ((cbd (expand-file-name default-directory))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2452 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2453 (set-buffer speedbar-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2454 (speedbar-with-writable
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2455 (erase-buffer)
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2456 (dolist (func funclst)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2457 (setq default-directory cbd)
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2458 (funcall func cbd 0))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2459 (speedbar-reconfigure-keymaps)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2460 (goto-char (point-min)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2461 ))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2462
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2463 (defun speedbar-update-directory-contents ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2464 "Update the contents of the speedbar buffer based on the current directory."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2465
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2466 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2467
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2468 (let ((cbd (expand-file-name default-directory))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2469 cbd-parent
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2470 (funclst (speedbar-initial-expansion-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2471 (cache speedbar-full-text-cache)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2472 ;; disable stealth during update
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2473 (speedbar-stealthy-function-list nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2474 (use-cache nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2475 (expand-local nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2476 ;; Because there is a bug I can't find just yet
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2477 (inhibit-quit nil))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2478 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2479 ;; If we are updating contents to where we are, then this is
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2480 ;; really a request to update existing contents, so we must be
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2481 ;; careful with our text cache!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2482 (if (member cbd speedbar-shown-directories)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2483 (progn
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2484 (setq cache nil)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2485 ;; If the current directory is not the last element in the dir
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2486 ;; list, then we ALSO need to zap the list of expanded directories
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2487 (if (/= (length (member cbd speedbar-shown-directories)) 1)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2488 (setq speedbar-shown-directories (list cbd))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2489
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2490 ;; Build cbd-parent, and see if THAT is in the current shown
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2491 ;; directories. First, go through pains to get the parent directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2492 (if (and speedbar-smart-directory-expand-flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2493 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2494 (setq cbd-parent cbd)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
2495 (if (string-match "[/\\]$" cbd-parent)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2496 (setq cbd-parent (substring cbd-parent 0
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2497 (match-beginning 0))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2498 (setq cbd-parent (file-name-directory cbd-parent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2499 (member cbd-parent speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2500 (setq expand-local t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2501
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2502 ;; If this directory is NOT in the current list of available
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2503 ;; directorys, then use the cache, and set the cache to our new
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2504 ;; value. Make sure to unhighlight the current file, or if we
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2505 ;; come back to this directory, it might be a different file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2506 ;; and then we get a mess!
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2507 (if (> (point-max) 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2508 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2509 (speedbar-clear-current-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2510 (setq speedbar-full-text-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2511 (cons speedbar-shown-directories (buffer-string)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2512
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2513 ;; Check if our new directory is in the list of directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2514 ;; shown in the text-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2515 (if (member cbd (car cache))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2516 (setq speedbar-shown-directories (car cache)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2517 use-cache t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2518 ;; default the shown directories to this list...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2519 (setq speedbar-shown-directories (list cbd)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2520 ))
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2521 (if (not expand-local) (setq speedbar-last-selected-file nil))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2522 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2523 (if (and expand-local
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2524 ;; Find this directory as a speedbar node.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2525 (speedbar-directory-line cbd))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2526 ;; Open it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2527 (speedbar-expand-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2528 (erase-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2529 (cond (use-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2530 (setq default-directory
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2531 (nth (1- (length speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2532 speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2533 (insert (cdr cache)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2534 (t
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2535 (dolist (func funclst)
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2536 (setq default-directory cbd)
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2537 (funcall func cbd 0)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2538 (goto-char (point-min)))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2539 (speedbar-reconfigure-keymaps))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2540
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2541 (defun speedbar-update-special-contents ()
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
2542 "Use the mode-specific variable to fill in the speedbar buffer.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2543 This should only be used by modes classified as special."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2544 (let ((funclst speedbar-special-mode-expansion-list)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2545 (specialbuff (current-buffer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2546 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2547 (setq speedbar-desired-buffer specialbuff)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2548 (set-buffer speedbar-buffer)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2549 ;; If we are leaving a directory, cache it.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2550 (if (not speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2551 ;; Do nothing
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2552 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2553 ;; Clean up directory maintenance stuff
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2554 (speedbar-clear-current-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2555 (setq speedbar-full-text-cache
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2556 (cons speedbar-shown-directories (buffer-string))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2557 speedbar-shown-directories nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2558 ;; Now fill in the buffer with our newly found specialized list.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2559 (speedbar-with-writable
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2560 (dolist (func funclst)
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2561 ;; We do not erase the buffer because these functions may
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2562 ;; decide NOT to update themselves.
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
2563 (funcall func specialbuff)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2564
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2565 (goto-char (point-min))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2566 (speedbar-reconfigure-keymaps))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2567
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2568 (defun speedbar-set-timer (timeout)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2569 "Set up the speedbar timer with TIMEOUT.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2570 Uses `dframe-set-timer'.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2571 Also resets scanner functions."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2572 (dframe-set-timer timeout 'speedbar-timer-fn 'speedbar-update-flag)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2573 ;; Apply a revert hook that will reset the scanners. We attach to revert
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2574 ;; because most reverts occur during VC state change, and this lets our
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2575 ;; VC scanner fix itself.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2576 (if timeout
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2577 (add-hook 'after-revert-hook 'speedbar-reset-scanners)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2578 (remove-hook 'after-revert-hook 'speedbar-reset-scanners))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2579 ;; change this if it changed for some reason
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2580 (speedbar-set-mode-line-format))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2581
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2582 (defun speedbar-timer-fn ()
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2583 "Run whenever Emacs is idle to update the speedbar item."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2584 (if (or (not (speedbar-current-frame))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2585 (not (frame-live-p (speedbar-current-frame))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2586 (speedbar-set-timer nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2587 ;; 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
2588 (save-match-data
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2589 ;; Only do stuff if the frame is visible, not an icon, and if
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2590 ;; it is currently flagged to do something.
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2591 (if (and speedbar-update-flag
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2592 (speedbar-current-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2593 (frame-visible-p (speedbar-current-frame))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2594 (not (eq (frame-visible-p (speedbar-current-frame)) 'icon)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2595 (let ((af (selected-frame)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2596 (save-window-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2597 (dframe-select-attached-frame speedbar-frame)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2598 ;; make sure we at least choose a window to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2599 ;; get a good directory from
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2600 (if (window-minibuffer-p (selected-window))
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2601 nil
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2602 ;; Check for special modes
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2603 (speedbar-maybe-add-localized-support (current-buffer))
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2604 ;; Update for special mode all the time!
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2605 (if (and speedbar-mode-specific-contents-flag
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2606 (listp speedbar-special-mode-expansion-list)
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2607 speedbar-special-mode-expansion-list
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2608 (local-variable-p
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2609 'speedbar-special-mode-expansion-list
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2610 (current-buffer)))
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2611 ;;(eq (get major-mode 'mode-class 'special)))
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2612 (progn
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2613 (if (<= 2 speedbar-verbosity-level)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2614 (speedbar-message
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2615 "Updating speedbar to special mode: %s..."
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2616 major-mode))
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2617 (speedbar-update-special-contents)
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2618 (if (<= 2 speedbar-verbosity-level)
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2619 (progn
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2620 (speedbar-message
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2621 "Updating speedbar to special mode: %s...done"
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2622 major-mode)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2623 (speedbar-message nil))))
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2624 ;; Update all the contents if directories change!
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2625 (if (or (member major-mode speedbar-ignored-modes)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2626 (eq af (speedbar-current-frame))
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2627 (not (buffer-file-name)))
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2628 nil
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2629 (speedbar-update-localized-contents)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2630 ))
23073
a0e975baf1e1 (speedbar-timer-fn): Disable updating if the frame
Eric M. Ludlam <zappo@gnu.org>
parents: 23015
diff changeset
2631 (select-frame af)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2632 ;; Now run stealthy updates of time-consuming items
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2633 (speedbar-stealthy-updates)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2634 (run-hooks 'speedbar-timer-hook))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2635
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2636
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2637 ;;; Stealthy activities
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2638 ;;
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2639 (defvar speedbar-stealthy-update-recurse nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2640 "Recursion avoidance variable for stealthy update.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2641
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2642 (defun speedbar-stealthy-updates ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2643 "For a given speedbar, run all items in the stealthy function list.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2644 Each item returns t if it completes successfully, or nil if
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2645 interrupted by the user."
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2646 (if (not speedbar-stealthy-update-recurse)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2647 (let ((l (speedbar-initial-stealthy-functions))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2648 (speedbar-stealthy-update-recurse t))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2649 (unwind-protect
23085
46deaf6e62a9 (speedbar-stealthy-updates): Do all updates w/ the the buffer writable.
Eric M. Ludlam <zappo@gnu.org>
parents: 23084
diff changeset
2650 (speedbar-with-writable
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2651 (while (and l (funcall (car l)))
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2652 ;;(sit-for 0)
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
2653 (setq l (cdr l))))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2654 ;;(speedbar-message "Exit with %S" (car l))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2655 ))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2656
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2657 (defun speedbar-reset-scanners ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2658 "Reset any variables used by functions in the stealthy list as state.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2659 If new functions are added, their state needs to be updated here."
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2660 (setq speedbar-vc-to-do-point t
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2661 speedbar-obj-to-do-point t
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2662 speedbar-ro-to-do-point t)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2663 (run-hooks 'speedbar-scanner-reset-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2664 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2665
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2666 (defun speedbar-find-selected-file (file)
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
2667 "Go to the line where FILE is."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2668
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2669 (set-buffer speedbar-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2670
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2671 (goto-char (point-min))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2672 (let ((m nil))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2673 (while (and (setq m (re-search-forward
37891
2fec97b8ea55 (speedbar-find-selected-file): RE-quote the filename.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 37180
diff changeset
2674 (concat " \\(" (regexp-quote (file-name-nondirectory file))
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2675 "\\)\\(" speedbar-indicator-regex "\\)?\n")
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2676 nil t))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2677 (not (string= file
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2678 (concat
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2679 (speedbar-line-directory
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2680 (save-excursion
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2681 (goto-char (match-beginning 0))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2682 (beginning-of-line)
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2683 (save-match-data
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2684 (looking-at "[0-9]+:")
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2685 (string-to-number (match-string 0)))))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2686 (match-string 1))))))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2687 (if m
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2688 (progn
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2689 (goto-char (match-beginning 1))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2690 (match-string 1)))))
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2691
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2692 (defun speedbar-clear-current-file ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2693 "Locate the file thought to be current, and remove its highlighting."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2694 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2695 ;;(set-buffer speedbar-buffer)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2696 (if speedbar-last-selected-file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2697 (speedbar-with-writable
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2698 (if (speedbar-find-selected-file speedbar-last-selected-file)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2699 (put-text-property (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2700 (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2701 'face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2702 'speedbar-file-face))))))
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 (defun speedbar-update-current-file ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2705 "Find the current file, and update our visuals to indicate its name.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2706 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
2707 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
2708 updated."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2709 (let* ((lastf (selected-frame))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2710 (newcfd (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2711 (dframe-select-attached-frame speedbar-frame)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2712 (let ((rf (if (buffer-file-name)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2713 (buffer-file-name)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2714 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2715 (select-frame lastf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2716 rf)))
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2717 (newcf (if newcfd newcfd))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2718 (lastb (current-buffer))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2719 (sucf-recursive (boundp 'sucf-recursive))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2720 (case-fold-search t))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2721 (if (and newcf
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2722 ;; check here, that way we won't refresh to newcf until
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2723 ;; its been written, thus saving ourselves some time
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2724 (file-exists-p newcf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2725 (not (string= newcf speedbar-last-selected-file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2726 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2727 ;; It is important to select the frame, otherwise the window
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2728 ;; 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
2729 ;; search-forward command.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2730 (select-frame (speedbar-current-frame))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2731 ;; Remove the old file...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2732 (speedbar-clear-current-file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2733 ;; now highlight the new one.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2734 ;; (set-buffer speedbar-buffer)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2735 (speedbar-with-writable
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2736 (if (speedbar-find-selected-file newcf)
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2737 ;; put the property on it
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2738 (put-text-property (match-beginning 1)
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2739 (match-end 1)
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2740 'face
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2741 'speedbar-selected-face)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2742 ;; Oops, it's not in the list. Should it be?
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2743 (if (and (string-match speedbar-file-regexp newcf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2744 (string= (file-name-directory newcfd)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2745 (expand-file-name default-directory)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2746 ;; yes, it is (we will ignore unknowns for now...)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2747 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2748 (speedbar-refresh)
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
2749 (if (speedbar-find-selected-file newcf)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2750 ;; put the property on it
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2751 (put-text-property (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2752 (match-end 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2753 'face
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2754 'speedbar-selected-face)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2755 ;; if it's not in there now, whatever...
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2756 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2757 (setq speedbar-last-selected-file newcf))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2758 (if (not sucf-recursive)
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
2759 (progn
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2760
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2761 ;;Sat Dec 15 2001 12:40 AM (burton@openprivacy.org): this
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2762 ;;doesn't need to be in. We don't want to recenter when we are
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2763 ;;updating files.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2764
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2765 ;;(speedbar-center-buffer-smartly)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2766
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
2767 (speedbar-position-cursor-on-line)
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
2768 ))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2769 (set-buffer lastb)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2770 (select-frame lastf)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2771 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2772 ;; return that we are done with this activity.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2773 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2774
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2775 (defun speedbar-add-indicator (indicator-string &optional replace-this)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2776 "Add INDICATOR-STRING to the end of this speedbar line.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2777 If INDICATOR-STRING is space, and REPLACE-THIS is a character, then
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
2778 the existing indicator is removed. If there is already an
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2779 indicator, then do not add a space."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2780 (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2781 ;; The nature of the beast: Assume we are in "the right place"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2782 (end-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2783 (skip-chars-backward (concat " " speedbar-vc-indicator
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2784 speedbar-object-read-only-indicator
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2785 (car speedbar-obj-indicator)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2786 (cdr speedbar-obj-indicator)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2787 (if (and (not (looking-at speedbar-indicator-regex))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2788 (not (string= indicator-string " ")))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2789 (insert speedbar-indicator-separator))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2790 (speedbar-with-writable
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2791 (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2792 (if (and replace-this
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2793 (re-search-forward replace-this (save-excursion (end-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2794 (point))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2795 t))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2796 (delete-region (match-beginning 0) (match-end 0))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2797 (end-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2798 (if (not (string= " " indicator-string))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2799 (let ((start (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2800 (insert indicator-string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2801 (speedbar-insert-image-button-maybe start (length indicator-string))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2802 ))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2803
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2804 (defun speedbar-check-read-only ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2805 "Scan all the files in a directory, and for each see if it is read only."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2806 ;; Check for to-do to be reset. If reset but no RCS is available
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2807 ;; then set to nil (do nothing) otherwise, start at the beginning
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2808 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2809 (if speedbar-buffer (set-buffer speedbar-buffer))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2810 (if (eq speedbar-ro-to-do-point t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2811 (setq speedbar-ro-to-do-point 0))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2812 (if (numberp speedbar-ro-to-do-point)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2813 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2814 (goto-char speedbar-ro-to-do-point)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2815 (while (and (not (input-pending-p))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2816 (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+-\?][]>] "
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2817 nil t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2818 (setq speedbar-ro-to-do-point (point))
65780
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2819 (let ((f (speedbar-line-file)))
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2820 (if f
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2821 (if (not (file-writable-p f))
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2822 (speedbar-add-indicator
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2823 speedbar-object-read-only-indicator
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2824 (regexp-quote speedbar-object-read-only-indicator))
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2825 (speedbar-add-indicator
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2826 " " (regexp-quote
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65765
diff changeset
2827 speedbar-object-read-only-indicator))))))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2828 (if (input-pending-p)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2829 ;; return that we are incomplete
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2830 nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2831 ;; we are done, set to-do to nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2832 (setq speedbar-ro-to-do-point nil)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2833 ;; and return t
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2834 t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2835 t)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2836
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2837 ;; Load efs/ange-ftp only if compiling to remove byte-compiler warnings.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2838 ;; Steven L Baur <steve@xemacs.org> said this was important:
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2839 (eval-when-compile (or (featurep 'xemacs)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2840 (condition-case () (require 'efs)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2841 (error (require 'ange-ftp)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2842
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2843 (defun speedbar-check-vc ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2844 "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
2845 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
2846 to add more types of version control systems."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2847 ;; 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
2848 ;; then set to nil (do nothing) otherwise, start at the beginning
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2849 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2850 (if speedbar-buffer (set-buffer speedbar-buffer))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2851 (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
2852 (speedbar-vc-check-dir-p default-directory)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2853 (not (or (and (featurep 'ange-ftp)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2854 (string-match
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2855 (car (symbol-value
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2856 (if dframe-xemacsp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2857 'ange-ftp-directory-format
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2858 'ange-ftp-name-format)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2859 (expand-file-name default-directory)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2860 ;; efs support: Bob Weiner
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2861 (and (featurep 'efs)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2862 (string-match
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2863 (let ((reg (symbol-value 'efs-directory-regexp)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2864 (if (stringp reg)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2865 reg
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2866 (car reg)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2867 (expand-file-name default-directory))))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2868 (setq speedbar-vc-to-do-point 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2869 (if (numberp speedbar-vc-to-do-point)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2870 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2871 (goto-char speedbar-vc-to-do-point)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2872 (while (and (not (input-pending-p))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2873 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-?]\\] "
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2874 nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2875 (setq speedbar-vc-to-do-point (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2876 (if (speedbar-check-vc-this-line (match-string 1))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2877 (speedbar-add-indicator speedbar-vc-indicator
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2878 (regexp-quote speedbar-vc-indicator))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2879 (speedbar-add-indicator " "
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2880 (regexp-quote speedbar-vc-indicator))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2881 (if (input-pending-p)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2882 ;; return that we are incomplete
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2883 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2884 ;; we are done, set to-do to nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2885 (setq speedbar-vc-to-do-point nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2886 ;; and return t
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2887 t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2888 t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2889
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2890 (defun speedbar-check-vc-this-line (depth)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2891 "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
2892 Parameter DEPTH is a string with the current depth of indentation of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2893 the file being checked."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2894 (let* ((d (string-to-number depth))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2895 (f (speedbar-line-directory d))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2896 (fn (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2897 ;; Skip-chars: thanks ptype@dra.hmg.gb
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2898 (point) (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2899 (skip-chars-forward "^ "
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2900 (save-excursion (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2901 (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2902 (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2903 (fulln (concat f fn)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2904 (if (<= 2 speedbar-verbosity-level)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
2905 (speedbar-message "Speedbar vc check...%s" fulln))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2906 (and (file-writable-p fulln)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2907 (speedbar-this-file-in-vc f fn))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2908
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2909 (defun speedbar-vc-check-dir-p (directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2910 "Return t if we should bother checking DIRECTORY for version control files.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2911 This can be overloaded to add new types of version control systems."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2912 (or
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2913 ;; Local CVS available in Emacs 21
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2914 (and (fboundp 'vc-state)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2915 (file-exists-p (concat directory "CVS/")))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2916 ;; Local RCS
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2917 (file-exists-p (concat directory "RCS/"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2918 ;; Local SCCS
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2919 (file-exists-p (concat directory "SCCS/"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2920 ;; Remote SCCS project
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2921 (let ((proj-dir (getenv "PROJECTDIR")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2922 (if proj-dir
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2923 (file-exists-p (concat proj-dir "/SCCS"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2924 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2925 ;; User extension
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2926 (run-hook-with-args-until-success 'speedbar-vc-directory-enable-hook
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2927 directory)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2928 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2929
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2930 (defun speedbar-this-file-in-vc (directory name)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2931 "Check to see if the file in DIRECTORY with NAME is in a version control system.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2932 You can add new VC systems by overriding this function. You can
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2933 optimize this function by overriding it and only doing those checks
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2934 that will occur on your system."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2935 (or
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2936 (if (fboundp 'vc-state)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2937 ;; Emacs 21 handles VC state in a nice way.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2938 (condition-case nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2939 (let ((state (vc-state (concat directory name))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2940 (not (or (eq 'up-to-date state)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2941 (null state))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2942 ;; An error means not in a VC system
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2943 (error nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2944 (or
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2945 ;; RCS file name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2946 (file-exists-p (concat directory "RCS/" name ",v"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2947 (file-exists-p (concat directory "RCS/" name))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2948 ;; Local SCCS file name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2949 (file-exists-p (concat directory "SCCS/s." name))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2950 ;; Remote SCCS file name
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2951 (let ((proj-dir (getenv "PROJECTDIR")))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2952 (if proj-dir
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2953 (file-exists-p (concat proj-dir "/SCCS/s." name))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2954 nil))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2955 ;; User extension
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2956 (run-hook-with-args 'speedbar-vc-in-control-hook directory name)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
2957 ))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2958
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2959 ;; Objet File scanning
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2960 (defun speedbar-check-objects ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2961 "Scan all files in a directory, and for each see if there is an object.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2962 See `speedbar-check-obj-this-line' and `speedbar-obj-alist' for how
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2963 to add more object types."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2964 ;; Check for to-do to be reset. If reset but no RCS is available
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2965 ;; then set to nil (do nothing) otherwise, start at the beginning
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2966 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2967 (if speedbar-buffer (set-buffer speedbar-buffer))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2968 (if (and speedbar-obj-do-check (eq speedbar-obj-to-do-point t))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2969 (setq speedbar-obj-to-do-point 0))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2970 (if (numberp speedbar-obj-to-do-point)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2971 (progn
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2972 (goto-char speedbar-obj-to-do-point)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2973 (while (and (not (input-pending-p))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2974 (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-]\\] "
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2975 nil t))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2976 (setq speedbar-obj-to-do-point (point))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2977 (let ((ind (speedbar-check-obj-this-line (match-string 1))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2978 (if (not ind) (setq ind " "))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2979 (speedbar-add-indicator ind (concat
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2980 (car speedbar-obj-indicator)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2981 "\\|"
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2982 (cdr speedbar-obj-indicator)))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2983 (if (input-pending-p)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2984 ;; return that we are incomplete
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2985 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2986 ;; we are done, set to-do to nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2987 (setq speedbar-obj-to-do-point nil)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2988 ;; and return t
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2989 t))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2990 t)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2991
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2992 (defun speedbar-check-obj-this-line (depth)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2993 "Return t if the file on this line has an associated object.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2994 Parameter DEPTH is a string with the current depth of indentation of
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2995 the file being checked."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2996 (let* ((d (string-to-number depth))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
2997 (f (speedbar-line-directory d))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2998 (fn (buffer-substring-no-properties
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
2999 ;; Skip-chars: thanks ptype@dra.hmg.gb
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3000 (point) (progn
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3001 (skip-chars-forward "^ "
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3002 (save-excursion (end-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3003 (point)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3004 (point))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3005 (fulln (concat f fn)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3006 (if (<= 2 speedbar-verbosity-level)
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3007 (speedbar-message "Speedbar obj check...%s" fulln))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3008 (let ((oa speedbar-obj-alist))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3009 (while (and oa (not (string-match (car (car oa)) fulln)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3010 (setq oa (cdr oa)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3011 (if (not (and oa (file-exists-p (concat (file-name-sans-extension fulln)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3012 (cdr (car oa))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3013 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3014 ;; Find out if the object is out of date or not.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3015 (let ((date1 (nth 5 (file-attributes fulln)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3016 (date2 (nth 5 (file-attributes (concat
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3017 (file-name-sans-extension fulln)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3018 (cdr (car oa)))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3019 (if (or (< (car date1) (car date2))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3020 (and (= (car date1) (car date2))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3021 (< (nth 1 date1) (nth 1 date2))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3022 (car speedbar-obj-indicator)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3023 (cdr speedbar-obj-indicator)))))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3024
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3025 ;;; Clicking Activity
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3026 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3027 (defun speedbar-position-cursor-on-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3028 "Position the cursor on a line."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3029 (let ((oldpos (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3030 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3031 (if (looking-at "[0-9]+:\\s-*..?.? ")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3032 (goto-char (1- (match-end 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3033 (goto-char oldpos))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3034
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3035 (defun speedbar-click (e)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3036 "Activate any speedbar buttons where the mouse is clicked.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3037 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
3038 with a mouse face that has a text property called `speedbar-function'.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3039 Argument E is the click event."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3040 ;; Backward compatibility let statement.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3041 (let ((speedbar-power-click dframe-power-click))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3042 (speedbar-do-function-pointer))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3043 (dframe-quick-mouse e))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3044
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3045 (defun speedbar-do-function-pointer ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3046 "Look under the cursor and examine the text properties.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3047 From this extract the file/tag name, token, indentation level and call
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3048 a function if appropriate."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3049 (let* ((speedbar-frame (speedbar-current-frame))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3050 (fn (get-text-property (point) 'speedbar-function))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3051 (tok (get-text-property (point) 'speedbar-token))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3052 ;; The 1-,+ is safe because scaning starts AFTER the point
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3053 ;; specified. This lets the search include the character the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3054 ;; cursor is on.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3055 (tp (previous-single-property-change
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3056 (1+ (point)) 'speedbar-function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3057 (np (next-single-property-change
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3058 (point) 'speedbar-function))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3059 (txt (buffer-substring-no-properties (or tp (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3060 (or np (point-max))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3061 (dent (save-excursion (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3062 (string-to-number
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3063 (if (looking-at "[0-9]+")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3064 (buffer-substring-no-properties
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3065 (match-beginning 0) (match-end 0))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3066 "0")))))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3067 ;;(speedbar-message "%S:%S:%S:%s" fn tok txt dent)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3068 (and fn (funcall fn txt tok dent)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3069 (speedbar-position-cursor-on-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3070
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3071 ;;; Reading info from the speedbar buffer
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3072 ;;
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3073 (defun speedbar-line-text (&optional p)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3074 "Retrieve the text after prefix junk for the current line.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3075 Optional argument P is where to start the search from."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3076 (save-excursion
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3077 (if p (goto-char p))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3078 (beginning-of-line)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3079 (if (looking-at (concat
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3080 "\\([0-9]+\\): *[[<{]?[-+?= ][]>}@()|] \\([^ \n]+\\)"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3081 (get-text-property (match-beginning 2) 'speedbar-text)
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3082 nil)))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3083
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3084 (defun speedbar-line-token (&optional p)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3085 "Retrieve the token information after the prefix junk for the current line.
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3086 Optional argument P is where to start the search from."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3087 (save-excursion
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3088 (if p (goto-char p))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3089 (beginning-of-line)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3090 (if (looking-at (concat
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3091 "\\([0-9]+\\): *[[<{]?[-+?= ][]>}@()|] \\([^ \n]+\\)\\("
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3092 speedbar-indicator-regex "\\)?"))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3093 (progn
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3094 (goto-char (match-beginning 2))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3095 (get-text-property (point) 'speedbar-token))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3096 nil)))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3097
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3098 (defun speedbar-line-file (&optional p)
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3099 "Retrieve the file or whatever from the line at point P.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3100 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
3101 directory, then it is the directory name."
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3102 (save-match-data
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3103 (save-restriction
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3104 (widen)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3105 (let ((f (speedbar-line-text p)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3106 (if f
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3107 (let* ((depth (string-to-number (match-string 1)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3108 (directory (speedbar-line-directory depth)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3109 (if (file-exists-p (concat directory f))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3110 (concat directory f)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3111 nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3112 nil)))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3113
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3114 (defun speedbar-goto-this-file (file)
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3115 "If FILE is displayed, go to this line and return t.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3116 Otherwise do not move and return nil."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3117 (let ((directory (substring (file-name-directory (expand-file-name file))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3118 (length (expand-file-name default-directory))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3119 (dest (point)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3120 (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3121 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3122 ;; scan all the directories
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3123 (while (and directory (not (eq directory t)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3124 (if (string-match "^[/\\]?\\([^/\\]+\\)" directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3125 (let ((pp (match-string 1 directory)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3126 (if (save-match-data
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3127 (re-search-forward (concat "> " (regexp-quote pp) "$")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3128 nil t))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3129 (setq directory (substring directory (match-end 1)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3130 (setq directory nil)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3131 (setq directory t)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3132 ;; find the file part
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3133 (if (or (not directory) (string= (file-name-nondirectory file) ""))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3134 ;; only had a dir part
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3135 (if directory
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3136 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3137 (speedbar-position-cursor-on-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3138 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3139 (goto-char dest) nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3140 ;; find the file part
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3141 (let ((nd (file-name-nondirectory file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3142 (if (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3143 (concat "] \\(" (regexp-quote nd)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3144 "\\)\\(" speedbar-indicator-regex "\\)$")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3145 nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3146 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3147 (speedbar-position-cursor-on-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3148 t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3149 (goto-char dest)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3150 nil))))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3151
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3152 (defun speedbar-line-directory (&optional depth)
65809
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
3153 "Retrieve the directory name associated with the current line.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3154 This may require traversing backwards from DEPTH and combining the default
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3155 directory with these items. This function is replaceable in
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3156 `speedbar-mode-functions-list' as `speedbar-line-directory'."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3157 (save-restriction
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3158 (widen)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3159 (let ((rf (speedbar-fetch-replacement-function 'speedbar-line-directory)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3160 (if rf (funcall rf depth) default-directory))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3161
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3162 (defun speedbar-files-line-directory (&optional depth)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3163 "Retrieve the directoryname associated with the current line.
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3164 This may require traversing backwards from DEPTH and combining the default
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3165 directory with these items."
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3166 (save-excursion
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3167 (save-match-data
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3168 (if (not depth)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3169 (progn
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3170 (beginning-of-line)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3171 (looking-at "^\\([0-9]+\\):")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3172 (setq depth (string-to-number (match-string 1)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3173 (let ((directory nil))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3174 (setq depth (1- depth))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3175 (while (/= depth -1)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3176 (if (not (re-search-backward (format "^%d:" depth) nil t))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3177 (error "Error building filename of tag")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3178 (cond ((looking-at "[0-9]+:\\s-*<->\\s-+\\([^\n]+\\)")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3179 (setq directory (concat (speedbar-line-text)
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3180 "/"
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3181 directory)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3182 ((looking-at "[0-9]+:\\s-*[-]\\s-+\\([^\n]+\\)")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3183 ;; This is the start of our directory.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3184 (setq directory (speedbar-line-text)))))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3185 (setq depth (1- depth)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3186 (if (and directory
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3187 (string-match (concat speedbar-indicator-regex "$")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3188 directory))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3189 (setq directory (substring directory 0 (match-beginning 0))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3190 (concat default-directory directory)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3191
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3192 (defun speedbar-directory-line (directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3193 "Position the cursor on the line specified by DIRECTORY."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3194 (save-match-data
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3195 (if (string-match "[/\\]$" directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3196 (setq directory (substring directory 0 (match-beginning 0))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3197 (let ((nomatch t) (depth 0)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3198 (fname (file-name-nondirectory directory))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3199 (pname (file-name-directory directory)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3200 (if (not (member pname speedbar-shown-directories))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3201 (error "Internal Error: File %s not shown in speedbar" directory))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3202 (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3203 (while (and nomatch
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3204 (re-search-forward
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3205 (concat "[]>] \\(" (regexp-quote fname)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3206 "\\)\\(" speedbar-indicator-regex "\\)?$")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3207 nil t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3208 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3209 (looking-at "\\([0-9]+\\):")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3210 (setq depth (string-to-number (match-string 0))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3211 nomatch (not (string= pname (speedbar-line-directory depth))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3212 (end-of-line))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3213 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3214 (not nomatch))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3215
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3216 (defun speedbar-edit-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3217 "Edit whatever tag or file is on the current speedbar line."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3218 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3219 (or (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3220 (beginning-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3221 ;; 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
3222 ;; perfectly allowed.
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
3223 (if (re-search-forward "[]>?}] [^ ]"
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3224 (save-excursion (end-of-line) (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3225 t)
53487
25ff62ff164d (speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
3226 (progn
25ff62ff164d (speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
3227 (forward-char -1)
25ff62ff164d (speedbar-edit-line): Change regexp to position
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
3228 (speedbar-do-function-pointer))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3229 nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3230 (speedbar-do-function-pointer)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3231
28925
89a795d90175 (speedbar-recenter): Typo, and fix logic.
Eric M. Ludlam <zappo@gnu.org>
parents: 28902
diff changeset
3232 (defun speedbar-expand-line (&optional arg)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3233 "Expand the line under the cursor.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3234 With universal argument ARG, flush cached data."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3235 (interactive "P")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3236 (beginning-of-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3237 (let* ((dframe-power-click arg)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3238 (speedbar-power-click arg))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3239 (condition-case nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3240 (progn
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3241 (re-search-forward ":\\s-*.\\+. "
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3242 (save-excursion (end-of-line) (point)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3243 (forward-char -2)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3244 (speedbar-do-function-pointer))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3245 (error (speedbar-position-cursor-on-line)))))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3246
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3247 (defun speedbar-flush-expand-line ()
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3248 "Expand the line under the cursor and flush any cached information."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3249 (interactive)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3250 (speedbar-expand-line 1))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3251
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3252 (defun speedbar-contract-line ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3253 "Contract the line under the cursor."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3254 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3255 (beginning-of-line)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3256 (condition-case nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3257 (progn
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3258 (re-search-forward ":\\s-*.-. "
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3259 (save-excursion (end-of-line) (point)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3260 (forward-char -2)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3261 (speedbar-do-function-pointer))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3262 (error (speedbar-position-cursor-on-line))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3263
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3264 (defun speedbar-toggle-line-expansion ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3265 "Contract or expand the line under the cursor."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3266 (interactive)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3267 (beginning-of-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3268 (condition-case nil
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3269 (progn
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3270 (re-search-forward ":\\s-*.[-+]. "
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3271 (save-excursion (end-of-line) (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3272 (forward-char -2)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3273 (speedbar-do-function-pointer))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3274 (error (speedbar-position-cursor-on-line))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3275
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3276 (defun speedbar-expand-line-descendants (&optional arg)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3277 "Expand the line under the cursor and all descendants.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3278 Optional argument ARG indicates that any cache should be flushed."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3279 (interactive "P")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3280 (speedbar-expand-line arg)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3281 ;; Now, inside the area expaded here, expand all subnodes of
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3282 ;; the same descendant type.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3283 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3284 (speedbar-next 1) ;; Move into the list.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3285 (let ((err nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3286 (while (not err)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3287 (condition-case nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3288 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3289 (speedbar-expand-line-descendants arg)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3290 (speedbar-restricted-next 1))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3291 (error (setq err t))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3292 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3293
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3294 (defun speedbar-contract-line-descendants ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3295 "Expand the line under the cursor and all descendants."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3296 (interactive)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3297 (speedbar-contract-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3298 ;; Don't need to do anything else since all descendants are
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3299 ;; hidden by default anyway. Yay! It's easy.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3300 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3301
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3302 (defun speedbar-find-file (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3303 "Speedbar click handler for filenames.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3304 TEXT, the file will be displayed in the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3305 TOKEN is unused, but required by the click handler. INDENT is the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3306 current indentation level."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3307 (let ((cdd (speedbar-line-directory indent)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3308 ;; Run before visiting file hook here.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3309 (let ((f (selected-frame)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3310 (dframe-select-attached-frame speedbar-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3311 (run-hooks 'speedbar-before-visiting-file-hook)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3312 (select-frame f))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3313 (speedbar-find-file-in-frame (concat cdd text))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3314 (speedbar-stealthy-updates)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3315 (run-hooks 'speedbar-visiting-file-hook)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3316 ;; Reset the timer with a new timeout when cliking a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3317 ;; in case the user was navigating directories, we can cancel
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3318 ;; that other timer.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3319 (speedbar-set-timer dframe-update-speed))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3320 (dframe-maybee-jump-to-attached-frame))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3321
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3322 (defun speedbar-dir-follow (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3323 "Speedbar click handler for directory names.
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3324 Clicking a directory will cause the speedbar to list files in
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3325 the subdirectory TEXT. TOKEN is an unused requirement. The
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3326 subdirectory chosen will be at INDENT level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3327 (setq default-directory
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3328 (concat (expand-file-name (concat (speedbar-line-directory indent) text))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3329 "/"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3330 ;; Because we leave speedbar as the current buffer,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3331 ;; update contents will change directory without
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3332 ;; having to touch the attached frame. Turn off smart expand just
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3333 ;; in case.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3334 (let ((speedbar-smart-directory-expand-flag nil))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3335 (speedbar-update-contents))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3336 (speedbar-set-timer speedbar-navigating-speed)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3337 (setq speedbar-last-selected-file nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3338 (speedbar-stealthy-updates))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3339
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3340 (defun speedbar-delete-subblock (indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3341 "Delete text from point to indentation level INDENT or greater.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3342 Handles end-of-sublist smartly."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3343 (speedbar-with-writable
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3344 (save-excursion
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3345 (end-of-line) (forward-char 1)
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3346 (let ((start (point)))
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3347 (while (and (looking-at "^\\([0-9]+\\):")
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3348 (> (string-to-number (match-string 1)) indent)
23917
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3349 (not (eobp)))
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3350 (forward-line 1)
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3351 (beginning-of-line))
4182d24c6d9f (speedbar-frame-parameters) Add : to custom prompt.
Eric M. Ludlam <zappo@gnu.org>
parents: 23372
diff changeset
3352 (delete-region start (point))))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3353
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3354 (defun speedbar-dired (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3355 "Speedbar click handler for directory expand button.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3356 Clicking this button expands or contracts a directory. TEXT is the
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3357 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
3358 expanded. INDENT is the current indentation level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3359 (cond ((string-match "+" text) ;we have to expand this dir
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3360 (setq speedbar-shown-directories
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3361 (cons (expand-file-name
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3362 (concat (speedbar-line-directory indent) token "/"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3363 speedbar-shown-directories))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3364 (speedbar-change-expand-button-char ?-)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3365 (speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3366 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3367 (end-of-line) (forward-char 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3368 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3369 (speedbar-default-directory-list
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3370 (concat (speedbar-line-directory indent) token "/")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3371 (1+ indent)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3372 ((string-match "-" text) ;we have to contract this node
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3373 (speedbar-reset-scanners)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3374 (let ((oldl speedbar-shown-directories)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3375 (newl nil)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3376 (td (expand-file-name
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3377 (concat (speedbar-line-directory indent) token))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3378 (while oldl
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3379 (if (not (string-match (concat "^" (regexp-quote td)) (car oldl)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3380 (setq newl (cons (car oldl) newl)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3381 (setq oldl (cdr oldl)))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3382 (setq speedbar-shown-directories (nreverse newl)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3383 (speedbar-change-expand-button-char ?+)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3384 (speedbar-delete-subblock indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3385 )
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3386 (t (error "Ooops... not sure what to do")))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3387 (speedbar-center-buffer-smartly)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3388 (save-excursion (speedbar-stealthy-updates)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3389
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3390 (defun speedbar-directory-buttons-follow (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3391 "Speedbar click handler for default directory buttons.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3392 TEXT is the button clicked on. TOKEN is the directory to follow.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3393 INDENT is the current indentation level and is unused."
22893
322179a8fd20 (speedbar-update-current-file): Added call to
Eric M. Ludlam <zappo@gnu.org>
parents: 22735
diff changeset
3394 (if (string-match "^[A-z]:$" token)
48716
376c832d1ca7 (speedbar-directory-buttons-follow): Don't use directory-sep-char.
Richard M. Stallman <rms@gnu.org>
parents: 48686
diff changeset
3395 (setq default-directory (concat token "/"))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3396 (setq default-directory token))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3397 ;; Because we leave speedbar as the current buffer,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3398 ;; update contents will change directory without
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3399 ;; having to touch the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3400 (speedbar-update-contents)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3401 (speedbar-set-timer speedbar-navigating-speed))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3402
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3403 (defun speedbar-tag-file (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3404 "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
3405 The parameter TEXT and TOKEN are required, where TEXT is the button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3406 clicked, and TOKEN is the file to expand. INDENT is the current
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3407 indentation level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3408 (cond ((string-match "+" text) ;we have to expand this file
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3409 (let* ((fn (expand-file-name (concat (speedbar-line-directory indent)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3410 token)))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3411 (mode nil)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3412 (lst (speedbar-fetch-dynamic-tags fn)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3413 ;; if no list, then remove expando button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3414 (if (not lst)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3415 (speedbar-change-expand-button-char ??)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3416 (speedbar-change-expand-button-char ?-)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3417 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3418 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3419 (end-of-line) (forward-char 1)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3420 (funcall (car lst) indent (cdr lst)))))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3421 ((string-match "-" text) ;we have to contract this node
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3422 (speedbar-change-expand-button-char ?+)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3423 (speedbar-delete-subblock indent))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3424 (t (error "Ooops... not sure what to do")))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3425 (speedbar-center-buffer-smartly))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3426
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3427 (defun speedbar-tag-find (text token indent)
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3428 "For the tag TEXT in a file TOKEN, go to that position.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3429 INDENT is the current indentation level."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3430 (let ((file (speedbar-line-directory indent)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3431 (let ((f (selected-frame)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3432 (dframe-select-attached-frame speedbar-frame)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3433 (run-hooks 'speedbar-before-visiting-tag-hook)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3434 (select-frame f))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3435 (speedbar-find-file-in-frame file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3436 (save-excursion (speedbar-stealthy-updates))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3437 ;; Reset the timer with a new timeout when cliking a file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3438 ;; in case the user was navigating directories, we can cancel
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3439 ;; that other timer.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3440 (speedbar-set-timer dframe-update-speed)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3441 (goto-char token)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3442 (run-hooks 'speedbar-visiting-tag-hook)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3443 (dframe-maybee-jump-to-attached-frame)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3444 ))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3445
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3446 (defun speedbar-tag-expand (text token indent)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3447 "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
3448 Etags does not support this feature. TEXT will be the button
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3449 string. TOKEN will be the list, and INDENT is the current indentation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3450 level."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3451 (cond ((string-match "+" text) ;we have to expand this file
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3452 (speedbar-change-expand-button-char ?-)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3453 (speedbar-with-writable
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3454 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3455 (end-of-line) (forward-char 1)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3456 (speedbar-insert-generic-list indent token 'speedbar-tag-expand
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3457 'speedbar-tag-find))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3458 ((string-match "-" text) ;we have to contract this node
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3459 (speedbar-change-expand-button-char ?+)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3460 (speedbar-delete-subblock indent))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3461 (t (error "Ooops... not sure what to do")))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3462 (speedbar-center-buffer-smartly))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3463
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3464 ;;; Loading files into the attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3465 ;;
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3466 (defcustom speedbar-select-frame-method 'attached
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3467 "*Specify how to select a frame for displaying a file.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3468 A value of 'attached means to use the attached frame (the frame
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3469 that speedbar was started from.) A number such as 1 or -1 means to
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3470 pass that number to `other-frame' while selecting a frame from speedbar."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3471 :group 'speedbar
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3472 :type 'sexp)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3473
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3474 (defun speedbar-find-file-in-frame (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3475 "This will load FILE into the speedbar attached frame.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3476 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
3477 frame instead."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3478 (let* ((buff (find-file-noselect file))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3479 (bwin (get-buffer-window buff 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3480 (if bwin
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3481 (progn
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3482 (select-window bwin)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3483 (raise-frame (window-frame bwin)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3484 (if dframe-power-click
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3485 (let ((pop-up-frames t)) (select-window (display-buffer buff)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3486 (if (numberp speedbar-select-frame-method)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3487 (other-frame speedbar-select-frame-method)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3488 (dframe-select-attached-frame speedbar-frame))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3489 (switch-to-buffer buff))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3490 )
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3491
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3492 ;;; Centering Utility
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3493 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3494 (defun speedbar-center-buffer-smartly ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3495 "Recenter a speedbar buffer so the current indentation level is all visible.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3496 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
3497 interested in."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3498
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3499 (save-selected-window
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3500
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3501 (select-window (get-buffer-window speedbar-buffer t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3502
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3503 (set-buffer speedbar-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3504
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3505 (if (<= (count-lines (point-min) (point-max))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3506 (1- (window-height (selected-window))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3507 ;; whole buffer fits
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3508 (let ((cp (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3509
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3510 (goto-char (point-min))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3511 (recenter 0)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3512 (goto-char cp))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3513 ;; too big
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3514 (let (depth start end exp p)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3515 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3516 (beginning-of-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3517 (setq depth (if (looking-at "[0-9]+")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3518 (string-to-number (buffer-substring-no-properties
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3519 (match-beginning 0) (match-end 0)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3520 0))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3521 (setq exp (format "^%d:" depth)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3522 (save-excursion
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3523 (end-of-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3524 (if (re-search-backward exp nil t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3525 (setq start (point))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3526 (setq start (point-min)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3527 (save-excursion ;Not sure about this part.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3528 (end-of-line)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3529 (setq p (point))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3530 (while (and (not (re-search-forward exp nil t))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3531 (>= depth 0))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3532 (setq depth (1- depth))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3533 (setq exp (format "^%d:" depth)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3534 (if (/= (point) p)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3535 (setq end (point))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3536 (setq end (point-max)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3537 ;; Now work out the details of centering
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3538 (let ((nl (count-lines start end))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3539 (wl (1- (window-height (selected-window))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3540 (cp (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3541 (if (> nl wl)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3542 ;; We can't fit it all, so just center on cursor
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3543 (progn (goto-char start)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3544 (recenter 1))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3545 ;; we can fit everything on the screen, but...
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3546 (if (and (pos-visible-in-window-p start (selected-window))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3547 (pos-visible-in-window-p end (selected-window)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3548 ;; we are all set!
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3549 nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3550 ;; we need to do something...
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3551 (goto-char start)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3552 (let ((newcent (/ (- (window-height (selected-window)) nl) 2))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3553 (lte (count-lines start (point-max))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3554 (if (and (< (+ newcent lte) (window-height (selected-window)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3555 (> (- (window-height (selected-window)) lte 1)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3556 newcent))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3557 (setq newcent (- (window-height (selected-window))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3558 lte 1)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3559 (recenter newcent))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3560 (goto-char cp))))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3561
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3562 ;;; Tag Management -- List of expanders:
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3563 ;;
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3564 (defun speedbar-fetch-dynamic-tags (file)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3565 "Return a list of tags generated dynamically from FILE.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3566 This uses the entries in `speedbar-dynamic-tags-function-list'
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3567 to find the proper tags. It is up to each of those individual
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3568 functions to do caching and flushing if appropriate."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3569 (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3570 ;; If a file is in memory, switch to that buffer. This allows
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3571 ;; us to use the local variable. If the file is on disk, we
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3572 ;; can try a few of the defaults that can get tags without
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3573 ;; opening the file.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3574 (if (get-file-buffer file)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3575 (set-buffer (get-file-buffer file)))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3576 ;; If there is a buffer-local value of
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3577 ;; speedbar-dynamic-tags-function-list, it will now be available.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3578 (let ((dtf speedbar-dynamic-tags-function-list)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3579 (ret t))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3580 (while (and (eq ret t) dtf)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3581 (setq ret
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3582 (if (fboundp (car (car dtf)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3583 (funcall (car (car dtf)) file)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3584 t))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3585 (if (eq ret t)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3586 (setq dtf (cdr dtf))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3587 (if (eq ret t)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3588 ;; No valid tag list, return nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3589 nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3590 ;; We have some tags. Return the list with the insert fn
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3591 ;; prepended
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3592 (cons (cdr (car dtf)) ret)))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3593
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3594 ;;; Tag Management -- Imenu
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3595 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3596 (if (not speedbar-use-imenu-flag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3597
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3598 nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3599
65765
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
3600 (eval-when-compile (condition-case nil (require 'imenu) (error nil)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3601
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3602 (defun speedbar-fetch-dynamic-imenu (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3603 "Load FILE into a buffer, and generate tags using Imenu.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3604 Returns the tag list, or t for an error."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3605 ;; Load this AND compile it in
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3606 (require 'imenu)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3607 (set-buffer (find-file-noselect file))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3608 (if dframe-power-click (setq imenu--index-alist nil))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3609 (condition-case nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3610 (let ((index-alist (imenu--make-index-alist t)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3611 (if speedbar-sort-tags
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3612 (sort (copy-alist index-alist)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3613 (lambda (a b) (string< (car a) (car b))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3614 index-alist))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3615 (error t)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3616 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3617
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3618 ;;; Tag Management -- etags (old XEmacs compatibility part)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3619 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3620 (defvar speedbar-fetch-etags-parse-list
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3621 '(;; Note that java has the same parse-group as c
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3622 ("\\.\\([cChH]\\|c\\+\\+\\|cpp\\|cc\\|hh\\|java\\|cxx\\|hxx\\)\\'" .
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3623 speedbar-parse-c-or-c++tag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3624 ("^\\.emacs$\\|.\\(el\\|l\\|lsp\\)\\'" .
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3625 "def[^i]+\\s-+\\(\\(\\w\\|[-_]\\)+\\)\\s-*\C-?")
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3626 ; ("\\.\\([fF]\\|for\\|FOR\\|77\\|90\\)\\'" .
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3627 ; speedbar-parse-fortran77-tag)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3628 ("\\.tex\\'" . speedbar-parse-tex-string)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3629 ("\\.p\\'" .
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3630 "\\(\\(FUNCTION\\|function\\|PROCEDURE\\|procedure\\)\\s-+\\([a-zA-Z0-9_.:]+\\)\\)\\s-*(?^?")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3631 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3632 "Associations of file extensions and expressions for extracting tags.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3633 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
3634 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
3635 extract an element from the tags output. If the output is complex,
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3636 use a function symbol instead of regexp. The function should expect
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3637 to be at the beginning of a line in the etags buffer.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3638
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3639 This variable is ignored if `speedbar-use-imenu-flag' is non-nil.")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3640
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3641 (defvar speedbar-fetch-etags-command "etags"
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3642 "*Command used to create an etags file.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3643
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3644 This variable is ignored if `speedbar-use-imenu-flag' is t.")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3645
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3646 (defvar speedbar-fetch-etags-arguments '("-D" "-I" "-o" "-")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3647 "*List of arguments to use with `speedbar-fetch-etags-command'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3648 This creates an etags output buffer. Use `speedbar-toggle-etags' to
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3649 modify this list conveniently.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3650
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3651 This variable is ignored if `speedbar-use-imenu-flag' is t.")
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3652
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3653 (defun speedbar-toggle-etags (flag)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3654 "Toggle FLAG in `speedbar-fetch-etags-arguments'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3655 FLAG then becomes a member of etags command line arguments. If flag
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3656 is \"sort\", then toggle the value of `speedbar-sort-tags'. If its
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3657 value is \"show\" then toggle the value of
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3658 `speedbar-show-unknown-files'.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3659
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3660 This function is a convenience function for XEmacs menu created by
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3661 Farzin Guilak <farzin@protocol.com>."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3662 (interactive)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3663 (cond
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3664 ((equal flag "sort")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3665 (setq speedbar-sort-tags (not speedbar-sort-tags)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3666 ((equal flag "show")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3667 (setq speedbar-show-unknown-files (not speedbar-show-unknown-files)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3668 ((or (equal flag "-C")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3669 (equal flag "-S")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3670 (equal flag "-D"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3671 (if (member flag speedbar-fetch-etags-arguments)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3672 (setq speedbar-fetch-etags-arguments
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3673 (delete flag speedbar-fetch-etags-arguments))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3674 (add-to-list 'speedbar-fetch-etags-arguments flag)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3675 (t nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3676
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3677 (defun speedbar-fetch-dynamic-etags (file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3678 "For FILE, run etags and create a list of symbols extracted.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3679 Each symbol will be associated with its line position in FILE."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3680 (let ((newlist nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3681 (unwind-protect
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3682 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3683 (if (get-buffer "*etags tmp*")
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3684 (kill-buffer "*etags tmp*")) ;kill to clean it up
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3685 (if (<= 1 speedbar-verbosity-level)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3686 (speedbar-message "Fetching etags..."))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3687 (set-buffer (get-buffer-create "*etags tmp*"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3688 (apply 'call-process speedbar-fetch-etags-command nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3689 (current-buffer) nil
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3690 (append speedbar-fetch-etags-arguments (list file)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3691 (goto-char (point-min))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3692 (if (<= 1 speedbar-verbosity-level)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3693 (speedbar-message "Fetching etags..."))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3694 (let ((expr
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3695 (let ((exprlst speedbar-fetch-etags-parse-list)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3696 (ans nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3697 (while (and (not ans) exprlst)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3698 (if (string-match (car (car exprlst)) file)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3699 (setq ans (car exprlst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3700 (setq exprlst (cdr exprlst)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3701 (cdr ans))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3702 (if expr
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3703 (let (tnl)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3704 (set-buffer (get-buffer-create "*etags tmp*"))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3705 (while (not (save-excursion (end-of-line) (eobp)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3706 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3707 (setq tnl (speedbar-extract-one-symbol expr)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3708 (if tnl (setq newlist (cons tnl newlist)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3709 (forward-line 1)))
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3710 (speedbar-message
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3711 "Sorry, no support for a file of that extension"))))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3712 )
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3713 (if speedbar-sort-tags
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3714 (sort newlist (lambda (a b) (string< (car a) (car b))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3715 (reverse newlist))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3716
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3717 ;; 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
3718 ;; sure it's needed with the different sorting method.
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3719 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3720 ;(defun speedbar-clean-etags()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3721 ; "Removes spaces before the ^? character, and removes `#define',
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3722 ;return types, etc. preceding tags. This ensures that the sort operation
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3723 ;works on the tags, not the return types."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3724 ; (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3725 ; (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3726 ; (while
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3727 ; (re-search-forward "(?[ \t](?\C-?" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3728 ; (replace-match "\C-?" nil nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3729 ; (goto-char (point-min))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3730 ; (while
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3731 ; (re-search-forward "\\(.*[ \t]+\\)\\([^ \t\n]+.*\C-?\\)" nil t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3732 ; (delete-region (match-beginning 1) (match-end 1)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3733
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3734 (defun speedbar-extract-one-symbol (expr)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3735 "At point, return nil, or one alist in the form: (SYMBOL . POSITION)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3736 The line should contain output from etags. Parse the output using the
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3737 regular expression EXPR."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3738 (let* ((sym (if (stringp expr)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3739 (if (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3740 (re-search-forward expr (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3741 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3742 (point)) t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3743 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3744 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3745 (funcall expr)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3746 (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
3747 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3748 (end-of-line)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3749 (point))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3750 t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3751 (if (and j sym)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3752 (1+ (string-to-number (buffer-substring-no-properties
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3753 (match-beginning 2)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3754 (match-end 2))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3755 0))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3756 (if (/= pos 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3757 (cons sym pos)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3758 nil)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3759
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3760 (defun speedbar-parse-c-or-c++tag ()
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3761 "Parse a C or C++ tag, which tends to be a little complex."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3762 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3763 (let ((bound (save-excursion (end-of-line) (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3764 (cond ((re-search-forward "\C-?\\([^\C-a]+\\)\C-a" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3765 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3766 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3767 ((re-search-forward "\\<\\([^ \t]+\\)\\s-+new(" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3768 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3769 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3770 ((re-search-forward "\\<\\([^ \t(]+\\)\\s-*(\C-?" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3771 (buffer-substring-no-properties (match-beginning 1)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3772 (match-end 1)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3773 (t nil))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3774 )))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3775
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3776 (defun speedbar-parse-tex-string ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3777 "Parse a Tex string. Only find data which is relevant."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3778 (save-excursion
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3779 (let ((bound (save-excursion (end-of-line) (point))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3780 (cond ((re-search-forward "\\(\\(sub\\)*section\\|chapter\\|cite\\)\\s-*{[^\C-?}]*}?" bound t)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3781 (buffer-substring-no-properties (match-beginning 0)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3782 (match-end 0)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3783 (t nil)))))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3784
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
3785
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3786 ;;; BUFFER DISPLAY mode.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3787 ;;
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3788 (defvar speedbar-buffers-key-map nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3789 "Keymap used when in the buffers display mode.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3790
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3791 (if speedbar-buffers-key-map
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3792 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3793 (setq speedbar-buffers-key-map (speedbar-make-specialized-keymap))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3794
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3795 ;; Basic tree features
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3796 (define-key speedbar-buffers-key-map "e" 'speedbar-edit-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3797 (define-key speedbar-buffers-key-map "\C-m" 'speedbar-edit-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3798 (define-key speedbar-buffers-key-map "+" 'speedbar-expand-line)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3799 (define-key speedbar-buffers-key-map "=" 'speedbar-expand-line)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3800 (define-key speedbar-buffers-key-map "-" 'speedbar-contract-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3801 (define-key speedbar-buffers-key-map " " 'speedbar-toggle-line-expansion)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3802
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3803 ;; Buffer specific keybindings
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3804 (define-key speedbar-buffers-key-map "k" 'speedbar-buffer-kill-buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3805 (define-key speedbar-buffers-key-map "r" 'speedbar-buffer-revert-buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3806
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3807 )
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3808
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3809 (defvar speedbar-buffer-easymenu-definition
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3810 '(["Jump to buffer" speedbar-edit-line t]
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3811 ["Expand File Tags" speedbar-expand-line
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3812 (save-excursion (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3813 (looking-at "[0-9]+: *.\\+. "))]
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3814 ["Flush Cache & Expand" speedbar-flush-expand-line
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3815 (save-excursion (beginning-of-line)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3816 (looking-at "[0-9]+: *.\\+. "))]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3817 ["Contract File Tags" speedbar-contract-line
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3818 (save-excursion (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3819 (looking-at "[0-9]+: *.-. "))]
66163
ce5979f4b405 (speedbar-set-mode-line-format): Indent properly.
Nick Roberts <nickrob@snap.net.nz>
parents: 65949
diff changeset
3820 "----"
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3821 ["Kill Buffer" speedbar-buffer-kill-buffer
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3822 (save-excursion (beginning-of-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3823 (looking-at "[0-9]+: *.[-+?]. "))]
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3824 ["Revert Buffer" speedbar-buffer-revert-buffer
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3825 (save-excursion (beginning-of-line)
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3826 (looking-at "[0-9]+: *.[-+?]. "))]
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3827 )
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3828 "Menu item elements shown when displaying a buffer list.")
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3829
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3830 (defun speedbar-buffer-buttons (directory zero)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3831 "Create speedbar buttons based on the buffers currently loaded.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3832 DIRECTORY is the directory to the currently active buffer, and ZERO is 0."
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3833 (speedbar-buffer-buttons-engine nil))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3834
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3835 (defun speedbar-buffer-buttons-temp (directory zero)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3836 "Create speedbar buttons based on the buffers currently loaded.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3837 DIRECTORY is the directory to the currently active buffer, and ZERO is 0."
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3838 (speedbar-buffer-buttons-engine t))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3839
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3840 (defun speedbar-buffer-buttons-engine (temp)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3841 "Create speedbar buffer buttons.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3842 If TEMP is non-nil, then clicking on a buffer restores the previous display."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3843 (speedbar-insert-separator "Active Buffers:")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3844 (let ((bl (buffer-list))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3845 (case-fold-search t))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3846 (while bl
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3847 (if (string-match "^[ *]" (buffer-name (car bl)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3848 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3849 (let* ((known (string-match speedbar-file-regexp
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3850 (buffer-name (car bl))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3851 (expchar (if known ?+ ??))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3852 (fn (if known 'speedbar-tag-file nil))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3853 (fname (save-excursion (set-buffer (car bl))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3854 (buffer-file-name))))
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3855 (speedbar-make-tag-line 'bracket expchar fn
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3856 (if fname (file-name-nondirectory fname))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3857 (buffer-name (car bl))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3858 'speedbar-buffer-click temp
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3859 'speedbar-file-face 0)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3860 (speedbar-buffers-tail-notes (car bl))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3861 (setq bl (cdr bl)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3862 (setq bl (buffer-list))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3863 (speedbar-insert-separator "Scratch Buffers:")
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3864 (while bl
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3865 (if (not (string-match "^\\*" (buffer-name (car bl))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3866 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3867 (if (eq (car bl) speedbar-buffer)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3868 nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3869 (speedbar-make-tag-line 'bracket ?? nil nil
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3870 (buffer-name (car bl))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3871 'speedbar-buffer-click temp
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3872 'speedbar-file-face 0)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3873 (speedbar-buffers-tail-notes (car bl))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3874 (setq bl (cdr bl)))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3875 (setq bl (buffer-list))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3876 ;;(speedbar-insert-separator "Hidden Buffers:")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3877 ;;(while bl
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3878 ;; (if (not (string-match "^ " (buffer-name (car bl))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3879 ;; nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3880 ;; (if (eq (car bl) speedbar-buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3881 ;; nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3882 ;; (speedbar-make-tag-line 'bracket ?? nil nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3883 ;; (buffer-name (car bl))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3884 ;; 'speedbar-buffer-click temp
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3885 ;; 'speedbar-file-face 0)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3886 ;; (speedbar-buffers-tail-notes (car bl))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3887 ;; (setq bl (cdr bl)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3888 ))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3889
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3890 (defun speedbar-buffers-tail-notes (buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3891 "Add a note to the end of the last tag line.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3892 Argument BUFFER is the buffer being tested."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3893 (let (mod ro)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3894 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3895 (set-buffer buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3896 (setq mod (buffer-modified-p)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3897 ro buffer-read-only))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3898 (if ro (speedbar-insert-button "%" nil nil nil nil t))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3899
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3900 (defun speedbar-buffers-item-info ()
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3901 "Display information about the current buffer on the current line."
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3902 (or (speedbar-item-info-tag-helper)
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3903 (let* ((item (speedbar-line-text))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3904 (buffer (if item (get-buffer item) nil)))
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3905 (and buffer
24475
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3906 (speedbar-message "%s%s %S %d %s"
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3907 (if (buffer-modified-p buffer) "* " "")
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3908 item
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3909 (save-excursion (set-buffer buffer) major-mode)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3910 (save-excursion (set-buffer buffer)
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3911 (buffer-size))
1e20dcb26ff7 Added commentary about stealthy functions.
Karl Heuer <kwzh@gnu.org>
parents: 24321
diff changeset
3912 (or (buffer-file-name buffer) "<No file>"))))))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3913
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3914 (defun speedbar-buffers-line-directory (&optional depth)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3915 "Fetch the full directory to the file (buffer) specified on the current line.
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3916 Optional argument DEPTH specifies the current depth of the back search."
36047
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3917 (save-excursion
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3918 (end-of-line)
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3919 (let ((start (point)))
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3920 ;; Buffers are always at level 0
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3921 (if (not (re-search-backward "^0:" nil t))
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3922 nil
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3923 (let* ((bn (speedbar-line-text))
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3924 (buffer (if bn (get-buffer bn))))
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3925 (if buffer
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3926 (if (save-excursion
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3927 (end-of-line)
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3928 (eq start (point)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3929 (or (save-excursion (set-buffer buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3930 default-directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3931 "")
36047
e1126269be53 (speedbar-frame-parameters): No toolbar lines.
Eric M. Ludlam <zappo@gnu.org>
parents: 31562
diff changeset
3932 (buffer-file-name buffer))))))))
24154
91c00b394901 (speedbar-item-info-file-helper): Add optional arg
Eric M. Ludlam <zappo@gnu.org>
parents: 23917
diff changeset
3933
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3934 (defun speedbar-buffer-click (text token indent)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3935 "When the users clicks on a buffer-button in speedbar.
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3936 TEXT is the buffer's name, TOKEN and INDENT are unused."
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3937 (if dframe-power-click
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3938 (let ((pop-up-frames t)) (select-window (display-buffer text)))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3939 (dframe-select-attached-frame speedbar-frame)
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3940 (switch-to-buffer text)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3941 (if token (speedbar-change-initial-expansion-list
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3942 speedbar-previously-used-expansion-list-name))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3943
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3944 (defun speedbar-buffer-kill-buffer ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3945 "Kill the buffer the cursor is on in the speedbar buffer."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3946 (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3947 (or (save-excursion
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3948 (let ((text (speedbar-line-text)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3949 (if (and (get-buffer text)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3950 (speedbar-y-or-n-p (format "Kill buffer %s? " text)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3951 (kill-buffer text))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
3952 (speedbar-refresh)))))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3953
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3954 (defun speedbar-buffer-revert-buffer ()
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3955 "Revert the buffer the cursor is on in the speedbar buffer."
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3956 (interactive)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3957 (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3958 (beginning-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3959 ;; If this fails, then it is a non-standard click, and as such,
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3960 ;; perfectly allowed
22950
606be1490be7 (speedbar-edit-line, speedbar-buffer-kill-buffer,
Eric M. Ludlam <zappo@gnu.org>
parents: 22906
diff changeset
3961 (if (re-search-forward "[]>?}] [^ ]"
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3962 (save-excursion (end-of-line) (point))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3963 t)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3964 (let ((text (progn
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3965 (forward-char -1)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3966 (buffer-substring (point) (save-excursion
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3967 (end-of-line)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3968 (point))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3969 (if (get-buffer text)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3970 (progn
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3971 (set-buffer text)
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3972 (revert-buffer t)))))))
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
3973
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3974
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3975 ;;; Useful hook values and such.
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3976 ;;
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3977 (defvar speedbar-highlight-one-tag-line nil
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3978 "Overlay used for highlighting the most recently jumped to tag line.")
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3979
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3980 (defun speedbar-highlight-one-tag-line ()
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3981 "Highlight the current line, unhighlighting a previously jumped to line."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3982 (speedbar-unhighlight-one-tag-line)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3983 (setq speedbar-highlight-one-tag-line
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3984 (speedbar-make-overlay (save-excursion (beginning-of-line) (point))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3985 (save-excursion (end-of-line)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3986 (forward-char 1)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3987 (point))))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3988 (speedbar-overlay-put speedbar-highlight-one-tag-line 'face
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3989 'speedbar-highlight-face)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3990 (add-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3991 )
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3992
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3993 (defun speedbar-unhighlight-one-tag-line ()
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
3994 "Unhighlight the currently highlighted line."
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3995 (if speedbar-highlight-one-tag-line
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3996 (progn
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3997 (speedbar-delete-overlay speedbar-highlight-one-tag-line)
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3998 (setq speedbar-highlight-one-tag-line nil)))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
3999 (remove-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4000
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4001 (defun speedbar-recenter-to-top ()
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4002 "Recenter the current buffer so POINT is on the top of the window."
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4003 (recenter 1))
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4004
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4005 (defun speedbar-recenter ()
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4006 "Recenter the current buffer so POINT is in the center of the window."
28925
89a795d90175 (speedbar-recenter): Typo, and fix logic.
Eric M. Ludlam <zappo@gnu.org>
parents: 28902
diff changeset
4007 (recenter (/ (window-height (selected-window)) 2)))
22735
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
4008
ca02f300fc41 More commentary.
Karl Heuer <kwzh@gnu.org>
parents: 22250
diff changeset
4009
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4010 ;;; Color loading section.
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4011 ;;
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4012 (defface speedbar-button-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4013 (:foreground "green4"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4014 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4015 (:foreground "green3")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4016 "Face used for +/- buttons."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4017 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4018
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4019 (defface speedbar-file-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4020 (:foreground "cyan4"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4021 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4022 (:foreground "cyan"))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4023 (t (:bold t)))
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4024 "Face used for file names."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4025 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4026
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4027 (defface speedbar-directory-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4028 (:foreground "blue4"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4029 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4030 (:foreground "light blue")))
46282
015a7038f5db (speedbar-make-specialized-keymap): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 44584
diff changeset
4031 "Face used for directory names."
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4032 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4033 (defface speedbar-tag-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4034 (:foreground "brown"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4035 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4036 (:foreground "yellow")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4037 "Face used for displaying tags."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4038 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4039
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4040 (defface speedbar-selected-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4041 (:foreground "red" :underline t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4042 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4043 (:foreground "red" :underline t))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4044 (t (:underline t)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4045 "Face used to underline the file in the active window."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4046 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4047
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4048 (defface speedbar-highlight-face '((((class color) (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4049 (:background "green"))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4050 (((class color) (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4051 (:background "sea green"))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4052 (((class grayscale monochrome)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4053 (background light))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4054 (:background "black"))
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4055 (((class grayscale monochrome)
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4056 (background dark))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4057 (:background "white")))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4058 "Face used for highlighting buttons with the mouse."
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4059 :group 'speedbar-faces)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4060
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4061 (defface speedbar-separator-face '((((class color) (background light))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4062 (:background "blue"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4063 :foreground "white"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4064 :overline "gray"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4065 (((class color) (background dark))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4066 (:background "blue"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4067 :foreground "white"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4068 :overline "gray"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4069 (((class grayscale monochrome)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4070 (background light))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4071 (:background "black"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4072 :foreground "white"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4073 :overline "white"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4074 (((class grayscale monochrome)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4075 (background dark))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4076 (:background "white"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4077 :foreground "black"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4078 :overline "black")))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4079 "Face used for separator labes in a display."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4080 :group 'speedbar-faces)
28902
5292e9f1f2ca Updated the commentary section.
Eric M. Ludlam <zappo@gnu.org>
parents: 26659
diff changeset
4081
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4082 ;; some edebug hooks
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4083 (add-hook 'edebug-setup-hook
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4084 (lambda ()
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4085 (def-edebug-spec speedbar-with-writable def-body)))
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4086
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4087 ;; Fix a font lock problem for some versions of Emacs
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4088 (if (boundp 'font-lock-global-modes)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4089 (if (listp font-lock-global-modes)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4090 (add-to-list 'font-lock-global-modes '(not speedbar-mode))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4091 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4092 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents: 65296
diff changeset
4093
65809
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4094
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4095 ;;; Obsolete variables and functions
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4096
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4097 (define-obsolete-variable-alias
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4098 'speedbar-ignored-path-regexp 'speedbar-ignored-directory-regexp)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4099
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4100 (define-obsolete-variable-alias 'speedbar-ignored-path-expressions
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4101 'speedbar-ignored-directory-expressions)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4102
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4103 (define-obsolete-function-alias 'speedbar-add-ignored-path-regexp
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4104 'speedbar-add-ignored-directory-regexp)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4105
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4106 (define-obsolete-function-alias 'speedbar-line-path
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4107 'speedbar-line-directory)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4108
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4109 (define-obsolete-function-alias 'speedbar-buffers-line-path
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4110 'speedbar-buffers-line-directory)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4111
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4112 (define-obsolete-function-alias 'speedbar-path-line
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4113 'speedbar-directory-line)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4114
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4115 (define-obsolete-function-alias 'speedbar-buffers-line-path
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4116 'speedbar-buffers-line-directory)
f528ccbc5de9 * speedbar.el (speedbar-ignored-path-regexp, speedbar-line-path)
Chong Yidong <cyd@stupidchicken.com>
parents: 65780
diff changeset
4117
21650
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4118 (provide 'speedbar)
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4119
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4120 ;; run load-time hooks
69bdeef5e927 Initial revision
Dan Nicolaescu <done@ece.arizona.edu>
parents:
diff changeset
4121 (run-hooks 'speedbar-load-hook)
65765
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
4122
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
4123 ;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
444ba3362b80 * speedbar.el: Re-apply arch tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65752
diff changeset
4124 ;;; speedbar ends here