;;; speedbar --- quick access to files and tags in a frame
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008, 2009, 2010
+;; Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: file, tags, tools
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
functionality individually.")
(defcustom speedbar-mode-specific-contents-flag t
- "*Non-nil means speedbar will show special mode contents.
+ "Non-nil means speedbar will show special mode contents.
This permits some modes to create customized contents for the speedbar
frame."
:group 'speedbar
:type 'boolean)
(defcustom speedbar-query-confirmation-method 'all
- "*Query control for file operations.
+ "Query control for file operations.
The 'always flag means to always query before file operations.
The 'none-but-delete flag means to not query before any file
operations, except before a file deletion."
effective when its display is shown.")
(defcustom speedbar-before-visiting-file-hook '(push-mark)
- "*Hooks run before speedbar visits a file in the selected frame.
+ "Hooks run before speedbar visits a file in the selected frame.
The default buffer is the buffer in the selected window in the attached frame."
:group 'speedbar
:type 'hook)
(defcustom speedbar-visiting-file-hook nil
- "*Hooks run when speedbar visits a file in the selected frame."
+ "Hooks run when speedbar visits a file in the selected frame."
:group 'speedbar
:type 'hook)
(defcustom speedbar-before-visiting-tag-hook '(push-mark)
- "*Hooks run before speedbar visits a tag in the selected frame.
+ "Hooks run before speedbar visits a tag in the selected frame.
The default buffer is the buffer in the selected window in the attached frame."
:group 'speedbar
:type 'hook)
(defcustom speedbar-visiting-tag-hook '(speedbar-highlight-one-tag-line)
- "*Hooks run when speedbar visits a tag in the selected frame."
+ "Hooks run when speedbar visits a tag in the selected frame."
:group 'speedbar
:type 'hook
:options '(speedbar-highlight-one-tag-line
))
(defcustom speedbar-load-hook nil
- "*Hooks run when speedbar is loaded."
+ "Hooks run when speedbar is loaded."
:group 'speedbar
:type 'hook)
(defcustom speedbar-reconfigure-keymaps-hook nil
- "*Hooks run when the keymaps are regenerated."
+ "Hooks run when the keymaps are regenerated."
:group 'speedbar
:type 'hook)
(defcustom speedbar-show-unknown-files nil
- "*Non-nil show files we can't expand with a ? in the expand button.
+ "Non-nil show files we can't expand with a ? in the expand button.
A nil value means don't show the file in the list."
:group 'speedbar
:type 'boolean)
(defvar speedbar-update-speed dframe-update-speed)
(make-obsolete-variable 'speedbar-update-speed
'dframe-update-speed
- "speedbar 1.0pre3")
+ "speedbar 1.0pre3 (Emacs 23.1)")
(defvar speedbar-navigating-speed dframe-update-speed)
(make-obsolete-variable 'speedbar-navigating-speed
'dframe-update-speed
- "speedbar 1.0pre3")
+ "speedbar 1.0pre3 (Emacs 23.1)")
;;; END REMOVE THESE
(defcustom speedbar-frame-parameters '((minibuffer . nil)
(unsplittable . t)
(left-fringe . 0)
)
- "*Parameters to use when creating the speedbar frame in Emacs.
+ "Parameters to use when creating the speedbar frame in Emacs.
Any parameter supported by a frame may be added. The parameter `height'
will be initialized to the height of the frame speedbar is
attached to and added to this list before the new frame is initialized."
menubar-visible-p nil
default-gutter-visible-p nil
)
- "*Parameters to use when creating the speedbar frame in XEmacs.
+ "Parameters to use when creating the speedbar frame in XEmacs.
Parameters not listed here which will be added automatically are
`height' which will be initialized to the height of the frame speedbar
is attached to."
(sexp :tag "Value"))))
(defcustom speedbar-use-imenu-flag (fboundp 'imenu)
- "*Non-nil means use imenu for file parsing, nil to use etags.
+ "Non-nil means use imenu for file parsing, nil to use etags.
XEmacs prior to 20.4 doesn't support imenu, therefore the default is to
use etags instead. Etags support is not as robust as imenu support."
:tag "Use Imenu for tags"
:type 'boolean)
(defcustom speedbar-track-mouse-flag (not speedbar-use-tool-tips-flag)
- "*Non-nil means to display info about the line under the mouse."
+ "Non-nil means to display info about the line under the mouse."
:group 'speedbar
:type 'boolean)
(defcustom speedbar-default-position 'left-right
- "*Default position of the speedbar frame.
+ "Default position of the speedbar frame.
Possible values are 'left, 'right or 'left-right.
If value is 'left-right, the most suitable location is
determined automatically."
(const :tag "Right" right)))
(defcustom speedbar-sort-tags nil
- "*If non-nil, sort tags in the speedbar display. *Obsolete*.
+ "If non-nil, sort tags in the speedbar display. *Obsolete*.
Use `semantic-tag-hierarchy-method' instead."
:group 'speedbar
:type 'boolean)
(defcustom speedbar-tag-hierarchy-method
'(speedbar-prefix-group-tag-hierarchy
speedbar-trim-words-tag-hierarchy)
- "*List of hooks which speedbar will use to organize tags into groups.
+ "List of hooks which speedbar will use to organize tags into groups.
Groups are defined as expandable meta-tags. Imenu supports
such things in some languages, such as separating variables from
functions. Each hook takes one argument LST, and may destructively
)
(defcustom speedbar-tag-group-name-minimum-length 4
- "*The minimum length of a prefix group name before expanding.
+ "The minimum length of a prefix group name before expanding.
Thus, if the `speedbar-tag-hierarchy-method' includes `prefix-group'
and one such groups common characters is less than this number of
characters, then the group name will be changed to the form of:
:type 'integer)
(defcustom speedbar-tag-split-minimum-length 20
- "*Minimum length before we stop trying to create sub-lists in tags.
+ "Minimum length before we stop trying to create sub-lists in tags.
This is used by all tag-hierarchy methods that break large lists into
sub-lists."
:group 'speedbar
:type 'integer)
(defcustom speedbar-tag-regroup-maximum-length 10
- "*Maximum length of submenus that are regrouped.
+ "Maximum length of submenus that are regrouped.
If the regrouping option is used, then if two or more short subgroups
are next to each other, then they are combined until this number of
items is reached."
:type 'integer)
(defcustom speedbar-directory-button-trim-method 'span
- "*Indicates how the directory button will be displayed.
+ "Indicates how the directory button will be displayed.
Possible values are:
'span - span large directories over multiple lines.
'trim - trim large directories to only show the last few.
(const :tag "No trimming." nil)))
(defcustom speedbar-smart-directory-expand-flag t
- "*Non-nil means speedbar should use smart expansion.
+ "Non-nil means speedbar should use smart expansion.
Smart expansion only affects when speedbar wants to display a
directory for a file in the attached frame. When smart expansion is
enabled, new directories which are children of a displayed directory
:type 'boolean)
(defcustom speedbar-indentation-width 1
- "*When sub-nodes are expanded, the number of spaces used for indentation."
+ "When sub-nodes are expanded, the number of spaces used for indentation."
:group 'speedbar
:type 'integer)
(defcustom speedbar-hide-button-brackets-flag nil
- "*Non-nil means speedbar will hide the brackets around the + or -."
+ "Non-nil means speedbar will hide the brackets around the + or -."
:group 'speedbar
:type 'boolean)
(defcustom speedbar-before-popup-hook nil
- "*Hooks called before popping up the speedbar frame."
+ "Hooks called before popping up the speedbar frame."
:group 'speedbar
:type 'hook)
(defcustom speedbar-after-create-hook '(speedbar-frame-reposition-smartly)
- "*Hooks called after popping up the speedbar frame."
+ "Hooks called after popping up the speedbar frame."
:group 'speedbar
:type 'hook)
(defcustom speedbar-before-delete-hook nil
- "*Hooks called before deleting the speedbar frame."
+ "Hooks called before deleting the speedbar frame."
:group 'speedbar
:type 'hook)
(defcustom speedbar-mode-hook nil
- "*Hooks called after creating a speedbar buffer."
+ "Hooks called after creating a speedbar buffer."
:group 'speedbar
:type 'hook)
(defcustom speedbar-timer-hook nil
- "*Hooks called after running the speedbar timer function."
+ "Hooks called after running the speedbar timer function."
:group 'speedbar
:type 'hook)
(defcustom speedbar-verbosity-level 1
- "*Verbosity level of the speedbar.
+ "Verbosity level of the speedbar.
0 means say nothing.
1 means medium level verbosity.
2 and higher are higher levels of verbosity."
"String separating file text from indicator characters.")
(defcustom speedbar-vc-do-check t
- "*Non-nil check all files in speedbar to see if they have been checked out.
+ "Non-nil check all files in speedbar to see if they have been checked out.
Any file checked out is marked with `speedbar-vc-indicator'."
:group 'speedbar-vc
:type 'boolean)
`speedbar-vc-directory-enable-hook' and `speedbar-vc-in-control-hook'.")
(defcustom speedbar-vc-directory-enable-hook nil
- "*Return non-nil if the current directory should be checked for Version Control.
+ "Return non-nil if the current directory should be checked for Version Control.
Functions in this hook must accept one parameter which is the directory
being checked."
:group 'speedbar-vc
:type 'hook)
(defcustom speedbar-vc-in-control-hook nil
- "*Return non-nil if the specified file is under Version Control.
+ "Return non-nil if the specified file is under Version Control.
Functions in this hook must accept two parameters. The DIRECTORY of the
current file, and the FILENAME of the file being checked."
:group 'speedbar-vc
"Local variable maintaining the current version control check position.")
(defcustom speedbar-obj-do-check t
- "*Non-nil check all files in speedbar to see if they have an object file.
+ "Non-nil check all files in speedbar to see if they have an object file.
Any file checked out is marked with `speedbar-obj-indicator', and the
marking is based on `speedbar-obj-alist'"
:group 'speedbar-vc
Permits stripping of indicator characters from a line.")
(defcustom speedbar-scanner-reset-hook nil
- "*Hook called whenever generic scanners are reset.
+ "Hook called whenever generic scanners are reset.
Set this to implement your own scanning / rescan safe functions with
state data."
:group 'speedbar
variable `speedbar-ignored-directory-expressions' to modify this variable.")
(define-obsolete-variable-alias 'speedbar-ignored-path-expressions
- 'speedbar-ignored-directory-expressions)
+ 'speedbar-ignored-directory-expressions "22.1")
(defcustom speedbar-ignored-directory-expressions
'("[/\\]logs?[/\\]\\'")
- "*List of regular expressions matching directories speedbar will ignore.
+ "List of regular expressions matching directories speedbar will ignore.
They should included directories which are notoriously very large
and take a long time to load in. Use the function
`speedbar-add-ignored-directory-regexp' to add new items to this list after
(speedbar-extension-list-to-regex val))))
(defcustom speedbar-directory-unshown-regexp "^\\(\\..*\\)\\'"
- "*Regular expression matching directories not to show in speedbar.
+ "Regular expression matching directories not to show in speedbar.
They should include commonly existing directories which are not
useful. It is no longer necessary to include version-control
directories here; see `vc-directory-exclusion-list'."
;; change in the future.
(defcustom speedbar-supported-extension-expressions
(append '(".[ch]\\(\\+\\+\\|pp\\|c\\|h\\|xx\\)?" ".tex\\(i\\(nfo\\)?\\)?"
- ".el" ".emacs" ".l" ".lsp" ".p" ".java" ".f\\(90\\|77\\|or\\)?")
+ ".el" ".emacs" ".l" ".lsp" ".p" ".java" ".js" ".f\\(90\\|77\\|or\\)?")
(if speedbar-use-imenu-flag
'(".ada" ".p[lm]" ".tcl" ".m" ".scm" ".pm" ".py" ".g"
;; html is not supported by default, but an imenu tags package
;; is available. Also, html files are nice to be able to see.
".s?html"
".ma?k" "[Mm]akefile\\(\\.in\\)?")))
- "*List of regular expressions which will match files supported by tagging.
+ "List of regular expressions which will match files supported by tagging.
Do not prefix the `.' char with a double \\ to quote it, as the period
will be stripped by a simplified optimizer when compiled into a
singular expression. This variable will be turned into
(setq font-lock-keywords nil) ;; no font-locking please
(setq truncate-lines t)
(make-local-variable 'frame-title-format)
- (setq frame-title-format (concat "Speedbar " speedbar-version))
- (setq case-fold-search nil)
- (toggle-read-only 1)
+ (setq frame-title-format (concat "Speedbar " speedbar-version)
+ case-fold-search nil
+ buffer-read-only t)
(speedbar-set-mode-line-format)
;; Add in our dframe hooks.
(if speedbar-track-mouse-flag
(with-no-warnings
(specifier-instance has-modeline-p)))
speedbar-buffer)
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(let* ((w (or (speedbar-frame-width) 20))
(p1 "<<")
(p5 ">>")
(current-buffer))
speedbar-special-mode-key-map)
(select-frame cf))))))
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(use-local-map (or localmap
(speedbar-initial-keymap)
;; This creates a small keymap we can glom the
(if (eq major-mode 'speedbar-mode)
;; XEmacs may let us get in here in other mode buffers.
(speedbar-item-info)))
- (t (speedbar-message nil)))))))
+ (error (speedbar-message nil)))))))
(defun speedbar-show-info-under-mouse ()
"Call the info function for the line under the mouse."
"Move to the next ARGth line in a speedbar buffer at the same depth.
This means that movement is restricted to a subnode, and that siblings
of intermediate nodes are skipped."
- (if (not (numberp arg)) (signal 'wrong-type-argument (list arg 'numberp)))
+ (if (not (numberp arg)) (signal 'wrong-type-argument (list 'numberp arg)))
;; First find the extent for which we are allowed to move.
(let ((depth (save-excursion (beginning-of-line)
(if (looking-at "[0-9]+:")
(if (file-directory-p f)
(delete-directory f)
(delete-file f))
- (speedbar-message "Okie dokie..")
+ (speedbar-message "Okie dokie.")
(let ((p (point)))
(speedbar-refresh)
(goto-char p))
(if (stringp buffer) (setq buffer (get-buffer buffer)))
(if (not (buffer-live-p buffer))
nil
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(save-match-data
(let ((ms (symbol-name major-mode)) v)
(if (not (string-match "-mode$" ms))
(defun speedbar-remove-localized-speedbar-support (buffer)
"Remove any traces that BUFFER supports speedbar in a specialized way."
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(kill-local-variable 'speedbar-special-mode-expansion-list)
(kill-local-variable 'speedbar-special-mode-key-map)
(kill-local-variable 'speedbar-easymenu-definition-special)))
(or (speedbar-line-file)
(speedbar-line-directory))))
(methods (if (get-file-buffer f)
- (save-excursion (set-buffer (get-file-buffer f))
- speedbar-tag-hierarchy-method)
+ (with-current-buffer (get-file-buffer f)
+ speedbar-tag-hierarchy-method)
speedbar-tag-hierarchy-method))
(lst (if (fboundp 'copy-tree)
(copy-tree lst)
This should only be used by modes classified as special."
(let ((funclst speedbar-special-mode-expansion-list)
(specialbuff (current-buffer)))
- (save-excursion
- (setq speedbar-desired-buffer specialbuff)
- (set-buffer speedbar-buffer)
+ (setq speedbar-desired-buffer specialbuff)
+ (with-current-buffer speedbar-buffer
;; If we are leaving a directory, cache it.
(if (not speedbar-shown-directories)
;; Do nothing
t))
t)))
-;; Load efs/ange-ftp only if compiling to remove byte-compiler warnings.
-;; Steven L Baur <steve@xemacs.org> said this was important:
-(eval-when-compile (or (featurep 'xemacs)
- (condition-case () (require 'efs)
- (error (require 'ange-ftp)))))
-
(defun speedbar-check-vc ()
"Scan all files in a directory, and for each see if it's checked out.
See `speedbar-this-file-in-vc' and `speedbar-vc-check-dir-p' for how
;;; Loading files into the attached frame.
;;
(defcustom speedbar-select-frame-method 'attached
- "*Specify how to select a frame for displaying a file.
+ "Specify how to select a frame for displaying a file.
A value of 'attached means to use the attached frame (the frame
that speedbar was started from.) A number such as 1 or -1 means to
pass that number to `other-frame' while selecting a frame from speedbar."
(buffer-name (car bl))))
(expchar (if known ?+ ??))
(fn (if known 'speedbar-tag-file nil))
- (fname (save-excursion (set-buffer (car bl))
- (buffer-file-name))))
+ (fname (with-current-buffer (car bl)
+ (buffer-file-name))))
(speedbar-make-tag-line 'bracket expchar fn
(if fname (file-name-nondirectory fname))
(buffer-name (car bl))
"Add a note to the end of the last tag line.
Argument BUFFER is the buffer being tested."
(let (mod ro)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(setq mod (buffer-modified-p)
ro buffer-read-only))
(if ro (speedbar-insert-button "%" nil nil nil nil t))))
(speedbar-message "%s%s %S %d %s"
(if (buffer-modified-p buffer) "* " "")
item
- (save-excursion (set-buffer buffer) major-mode)
- (save-excursion (set-buffer buffer)
- (buffer-size))
+ (with-current-buffer buffer major-mode)
+ (with-current-buffer buffer (buffer-size))
(or (buffer-file-name buffer) "<No file>"))))))
(defun speedbar-buffers-line-directory (&optional depth)
(if (save-excursion
(end-of-line)
(eq start (point)))
- (or (save-excursion (set-buffer buffer)
- default-directory)
+ (or (with-current-buffer buffer default-directory)
"")
(buffer-file-name buffer))))))))
(def-edebug-spec speedbar-with-writable def-body)))
;; Fix a font lock problem for some versions of Emacs
-(if (boundp 'font-lock-global-modes)
- (if (listp font-lock-global-modes)
- (add-to-list 'font-lock-global-modes '(not speedbar-mode))
- )
- )
-
+(and (boundp 'font-lock-global-modes)
+ font-lock-global-modes
+ (if (eq font-lock-global-modes t)
+ (setq font-lock-global-modes '(not speedbar-mode))
+ (if (eq (car font-lock-global-modes) 'not)
+ (add-to-list 'font-lock-global-modes 'speedbar-mode t)
+ (setq font-lock-global-modes (delq 'speedbar-mode
+ font-lock-global-modes)))))
\f
;;; Obsolete variables and functions
(define-obsolete-variable-alias
- 'speedbar-ignored-path-regexp 'speedbar-ignored-directory-regexp)
+ 'speedbar-ignored-path-regexp 'speedbar-ignored-directory-regexp "22.1")
(define-obsolete-function-alias 'speedbar-add-ignored-path-regexp
- 'speedbar-add-ignored-directory-regexp)
+ 'speedbar-add-ignored-directory-regexp "22.1")
(define-obsolete-function-alias 'speedbar-line-path
- 'speedbar-line-directory)
+ 'speedbar-line-directory "22.1")
(define-obsolete-function-alias 'speedbar-buffers-line-path
- 'speedbar-buffers-line-directory)
+ 'speedbar-buffers-line-directory "22.1")
(define-obsolete-function-alias 'speedbar-path-line
- 'speedbar-directory-line)
+ 'speedbar-directory-line "22.1")
(define-obsolete-function-alias 'speedbar-buffers-line-path
- 'speedbar-buffers-line-directory)
+ 'speedbar-buffers-line-directory "22.1")
(provide 'speedbar)
;; run load-time hooks
(run-hooks 'speedbar-load-hook)
-;; arch-tag: 4477e6d1-f78c-48b9-a503-387d3c9767d5
;;; speedbar ends here