* net/newst-treeview.el (newsticker-groups-filename):
[bpt/emacs.git] / lisp / speedbar.el
index 4ecb0ec..df6cd0b 100644 (file)
@@ -1,7 +1,7 @@
 ;;; speedbar --- quick access to files and tags in a frame
 
 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
@@ -15,10 +15,10 @@ this version is not backward compatible to 0.14 or earlier.")
 
 ;; 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 2, 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
@@ -26,9 +26,7 @@ this version is not backward compatible to 0.14 or earlier.")
 ;; 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:
 ;;
@@ -220,10 +218,10 @@ This list is of the form:
 where NAME is the name of the major display mode these functions are
 for, and the remaining elements FUNCTION are functions to call in order.
 Each function must return nil if interrupted, or t if completed.
-Stealthy functions which have a single operation should always return
-t.  Functions which take a long time should maintain a state (where
-they are in their speedbar related calculations) and permit
-interruption.  See `speedbar-check-vc' as a good example.")
+Stealthy functions which have a single operation should always return t.
+Functions which take a long time should maintain a state (where they
+are in their speedbar related calculations) and permit interruption.
+See `speedbar-check-vc' as a good example.")
 
 (defvar speedbar-mode-functions-list
   '(("files" (speedbar-item-info . speedbar-files-item-info)
@@ -246,14 +244,14 @@ replaced this way.  Replaceable functions must provide that
 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."
@@ -279,24 +277,24 @@ This keymap is local to each buffer that wants to define special keybindings
 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
@@ -305,31 +303,35 @@ The default buffer is the buffer in the selected window in the attached frame."
             ))
 
 (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)
 
 ;;; EVENTUALLY REMOVE THESE
 
-;; When I moved to a repeating timer, I had the horrible missfortune
-;; of loosing the ability for adaptive speed choice.  This update
+;; When I moved to a repeating timer, I had the horrible misfortune
+;; of losing the ability for adaptive speed choice.  This update
 ;; speed currently causes long delays when it should have been turned off.
-(defvar speedbar-update-speed dframe-update-speed
-  "*Obsoleted variable.  Use `dframe-update-speed'.")
-
-(defvar speedbar-navigating-speed dframe-update-speed
-  "*Obsoleted variable.  Use `dframe-update-speed'.")
+(defvar speedbar-update-speed dframe-update-speed)
+(make-obsolete-variable 'speedbar-update-speed
+                       'dframe-update-speed
+                       "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 (Emacs 23.1)")
 ;;; END REMOVE THESE
 
 (defcustom speedbar-frame-parameters '((minibuffer . nil)
@@ -340,7 +342,7 @@ A nil value means don't show the file in the list."
                                       (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."
@@ -357,7 +359,7 @@ 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."
@@ -367,7 +369,7 @@ 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"
@@ -378,7 +380,7 @@ use etags instead.  Etags support is not as robust as imenu support."
   '((speedbar-fetch-dynamic-imenu . speedbar-insert-imenu-list)
     (speedbar-fetch-dynamic-etags . speedbar-insert-etags-list))
   "Set to a list of functions which will return and insert a list of tags.
-Each element is of the form ( FETCH .  INSERT ) where FETCH
+Each element is of the form ( FETCH . INSERT ) where FETCH
 is a function which takes one parameter (the file to tag) and returns a
 list of tags.  The tag list can be of any form as long as the
 corresponding insert method can handle it.  If it returns t, then an
@@ -386,21 +388,20 @@ error occurred, and the next fetch routine is tried.
 INSERT is a function which takes an INDENTation level, and a LIST of
 tags to insert.  It will then create the speedbar buttons.")
 
-(defcustom speedbar-use-tool-tips-flag (and (not (featurep 'xemacs))
-                                      (>= emacs-major-version 21))
-  "*Non-nil means to use tool tips if they are avaialble.
+(defcustom speedbar-use-tool-tips-flag (fboundp 'tooltip-mode)
+  "Non-nil means to use tool tips if they are available.
 When tooltips are not available, mouse-tracking and minibuffer
 display is used instead."
   :group 'speedbar
   :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."
@@ -410,7 +411,7 @@ 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)
@@ -418,7 +419,7 @@ Use `semantic-tag-hierarchy-method' instead."
 (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
@@ -438,7 +439,7 @@ or
   )
 
 (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:
@@ -450,14 +451,14 @@ This way we won't get silly looking listings."
   :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."
@@ -465,7 +466,7 @@ 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.
@@ -478,7 +479,7 @@ Possible values are:
                (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
@@ -488,44 +489,45 @@ hierarchy would be replaced with the new 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.  0 means say nothing.
-1 means medium level verbosity.  2 and higher are higher levels of
-verbosity."
+  "Verbosity level of the speedbar.
+0 means say nothing.
+1 means medium level verbosity.
+2 and higher are higher levels of verbosity."
   :group 'speedbar
   :type 'integer)
 
@@ -533,7 +535,7 @@ 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)
@@ -544,14 +546,14 @@ Other version control systems can be added by examining the function
 `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
@@ -561,7 +563,7 @@ current file, and the FILENAME of the file being checked."
   "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
@@ -607,7 +609,7 @@ The expression `speedbar-obj-alist' defines who gets tagged.")
 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
@@ -636,17 +638,20 @@ with `.' followed by extensions, followed by full-filenames."
            "\\)$")))
 
 (defvar speedbar-ignored-directory-regexp nil
-  "Regular expression matching directorys speedbar will not switch to.
+  "Regular expression matching directories speedbar will not switch to.
 Created from `speedbar-ignored-directory-expressions' with the function
-`speedbar-extension-list-to-regex' (A misnamed function in this case.)
+`speedbar-extension-list-to-regex' (a misnamed function in this case.)
 Use the function `speedbar-add-ignored-directory-regexp', or customize the
 variable `speedbar-ignored-directory-expressions' to modify this variable.")
 
+(define-obsolete-variable-alias 'speedbar-ignored-path-expressions
+  'speedbar-ignored-directory-expressions "22.1")
+
 (defcustom speedbar-ignored-directory-expressions
   '("[/\\]logs?[/\\]\\'")
-  "*List of regular expressions matching directories speedbar will ignore.
-They should included directorys to directories which are notoriously very
-large and take a long time to load in.  Use the function
+  "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 is loaded.  You may place anything you like in this list
 before speedbar has been loaded."
@@ -657,10 +662,11 @@ before speedbar has been loaded."
               speedbar-ignored-directory-regexp
               (speedbar-extension-list-to-regex val))))
 
-(defcustom speedbar-directory-unshown-regexp "^\\(CVS\\|RCS\\|SCCS\\|\\..*\\)\\'"
-  "*Regular expression matching directories not to show in speedbar.
+(defcustom speedbar-directory-unshown-regexp "^\\(\\..*\\)\\'"
+  "Regular expression matching directories not to show in speedbar.
 They should include commonly existing directories which are not
-useful, such as version control."
+useful.  It is no longer necessary to include version-control
+directories here; see `vc-directory-exclusion-list'."
   :group 'speedbar
   :type 'string)
 
@@ -673,32 +679,31 @@ useful, such as version control."
     ;;               backup      refdir      lockfile
     (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#"))
   "*Regexp matching files we don't want displayed in a speedbar buffer.
-It is generated from the variable `completion-ignored-extensions'")
+It is generated from the variable `completion-ignored-extensions'.")
 
 (defvar speedbar-file-regexp nil
   "Regular expression matching files we know how to expand.
 Created from `speedbar-supported-extension-expressions' with the
-function `speedbar-extension-list-to-regex'")
+function `speedbar-extension-list-to-regex'.")
 
 ;; this is dangerous to customize, because the defaults will probably
 ;; 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
 `speedbar-file-regexp' for use with speedbar.  You should use the
 function `speedbar-add-supported-extension' to add a new extension at
-runtime, or use the configuration dialog to set it in your .emacs
-file.
+runtime, or use the configuration dialog to set it in your .emacs file.
 If you add an extension to this list, and it does not appear, you may
 need to also modify `completion-ignored-extension' which will also help
 file completion."
@@ -994,7 +999,7 @@ supported at a time.
                     'speedbar-buffer
                     "Speedbar"
                     #'speedbar-frame-mode
-                    (if dframe-xemacsp
+                    (if (featurep 'xemacs)
                         (append speedbar-frame-plist
                                 ;; This is a hack to get speedbar to iconfiy
                                 ;; with the selected frame.
@@ -1020,7 +1025,7 @@ supported at a time.
 
 (defun speedbar-frame-reposition-smartly ()
   "Reposition the speedbar frame to be next to the attached frame."
-  (cond ((and dframe-xemacsp
+  (cond ((and (featurep 'xemacs)
              (or (member 'left speedbar-frame-plist)
                  (member 'top speedbar-frame-plist)))
         (dframe-reposition-frame
@@ -1029,7 +1034,7 @@ supported at a time.
          (cons (car (cdr (member 'left speedbar-frame-plist)))
                (car (cdr (member 'top speedbar-frame-plist)))))
         )
-       ((and (not dframe-xemacsp)
+       ((and (not (featurep 'xemacs))
              (or (assoc 'left speedbar-frame-parameters)
                  (assoc 'top speedbar-frame-parameters)))
         ;; if left/top were specified in the parameters, pass them
@@ -1051,7 +1056,7 @@ supported at a time.
 
 (defun speedbar-handle-delete-frame (e)
   "Handle a delete frame event E.
-If the deleted frame is the frame SPEEDBAR is attached to,
+If the deleted frame is the frame speedbar is attached to,
 we need to delete speedbar also."
   (when (and speedbar-frame
             (eq (car (car (cdr e))) ;; frame to be deleted
@@ -1137,7 +1142,7 @@ in the selected file.
   speedbar-buffer)
 
 (defmacro speedbar-message (fmt &rest args)
-  "Like message, but for use in the speedbar frame.
+  "Like `message', but for use in the speedbar frame.
 Argument FMT is the format string, and ARGS are the arguments for message."
   `(dframe-message ,fmt ,@args))
 
@@ -1164,7 +1169,7 @@ return true without a query."
 This gives visual indications of what is up.  It EXPECTS the speedbar
 frame and window to be the currently active frame and window."
   (if (and (frame-live-p (speedbar-current-frame))
-          (or (not dframe-xemacsp)
+          (or (not (featurep 'xemacs))
               (with-no-warnings
                 (specifier-instance has-modeline-p)))
           speedbar-buffer)
@@ -1252,7 +1257,7 @@ and the existence of packages."
       (if speedbar-previous-menu (easy-menu-remove speedbar-previous-menu))
       (setq speedbar-previous-menu md)
       ;; Now add the new menu
-      (if (not dframe-xemacsp)
+      (if (not (featurep 'xemacs))
          (easy-menu-define speedbar-menu-map (current-local-map)
                            "Speedbar menu" md)
        (easy-menu-add md (current-local-map))
@@ -1289,8 +1294,7 @@ and the existence of packages."
          (t (speedbar-message nil)))))))
 
 (defun speedbar-show-info-under-mouse ()
-  "Call the info function for the line under the mouse.
-Optional EVENT is currently not used."
+  "Call the info function for the line under the mouse."
   (let ((pos (mouse-position)))        ; we ignore event until I use it later.
     (if (equal (car pos) speedbar-frame)
        (save-excursion
@@ -1314,7 +1318,7 @@ Optional EVENT is currently not used."
   "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]+:")
@@ -1472,7 +1476,7 @@ File style information is displayed with `speedbar-item-info'."
                                  (point) (progn (end-of-line) (point))))))
 
 (defun speedbar-item-info ()
-  "Display info in the mini-buffer about the button the mouse is over.
+  "Display info in the minibuffer about the button the mouse is over.
 This function can be replaced in `speedbar-mode-functions-list' as
 `speedbar-item-info'."
   (interactive)
@@ -1550,7 +1554,7 @@ Return nil if not applicable."
          nil)))))
 
 (defun speedbar-files-item-info ()
-  "Display info in the mini-buffer about the button the mouse is over."
+  "Display info in the minibuffer about the button the mouse is over."
   (if (not speedbar-shown-directories)
       (speedbar-generic-item-info)
     (or (speedbar-item-info-file-helper)
@@ -1827,7 +1831,7 @@ This is based on `speedbar-initial-expansion-list-name' referencing
        (speedbar-reconfigure-keymaps))))
 
 (defun speedbar-fetch-replacement-function (function)
-  "Return a current mode specific replacement for function, or nil.
+  "Return a current mode-specific replacement for function, or nil.
 Scans `speedbar-mode-functions-list' first for the current mode, then
 for FUNCTION."
   (cdr (assoc function
@@ -1844,7 +1848,7 @@ See `speedbar-mode-functions-list' for details."
 ;;
 (defun speedbar-maybe-add-localized-support (buffer)
   "Quick check function called on BUFFERs by the speedbar timer function.
-Maintains the value of local variables which control speedbars use
+Maintains the value of local variables which control speedbar's use
 of the special mode functions."
   (or speedbar-special-mode-expansion-list
       (speedbar-add-localized-speedbar-support buffer)))
@@ -1917,6 +1921,7 @@ the file-system."
        (while dir
          (if (not
               (or (string-match speedbar-file-unshown-regexp (car dir))
+                  (member (car dir) vc-directory-exclusion-list)
                   (string-match speedbar-directory-unshown-regexp (car dir))))
              (if (file-directory-p (car dir))
                  (setq dirs (cons (car dir) dirs))
@@ -1929,7 +1934,7 @@ the file-system."
 
 (defun speedbar-directory-buttons (directory index)
   "Insert a single button group at point for DIRECTORY.
-Each directory directory part is a different button.  If part of the directory
+Each directory part is a different button.  If part of the directory
 matches the user directory ~, then it is replaced with a ~.
 INDEX is not used, but is required by the caller."
   (let* ((tilde (expand-file-name "~/"))
@@ -2078,7 +2083,7 @@ position to insert a new item, and that the new item will end with a CR."
   "Insert list of FILES starting at point, and indenting all files to LEVEL.
 Tag expandable items with a +, otherwise a ?.  Don't highlight ? as we
 don't know how to manage them.  The input parameter FILES is a cons
-cell of the form ( 'DIRLIST .  'FILELIST )."
+cell of the form ( 'DIRLIST . 'FILELIST )."
   ;; Start inserting all the directories
   (let ((dirs (car files)))
     (while dirs
@@ -2146,7 +2151,7 @@ Groups may optionally contain a position."
           )))
 
 (defun speedbar-generic-list-positioned-group-p (sublst)
-  "Non-nil of SUBLST is a group with a position."
+  "Non-nil if SUBLST is a group with a position."
   (and (stringp (car-safe sublst))
        (number-or-marker-p (car-safe (cdr-safe sublst)))
        (listp (cdr-safe (cdr-safe sublst)))
@@ -2403,7 +2408,7 @@ Make buffer local for your mode.")
   "At LEVEL, insert a generic multi-level alist LST.
 Associations with lists get {+} tags (to expand into more nodes) and
 those with positions just get a > as the indicator.  {+} buttons will
-have the function EXPAND-FUN and the token is the CDR list.  The token
+have the function EXPAND-FUN and the token is the cdr list.  The token
 name will have the function FIND-FUN and not token."
   ;; Remove imenu rescan button
   (if (string= (car (car lst)) "*Rescan*")
@@ -2560,7 +2565,7 @@ name will have the function FIND-FUN and not token."
            (setq expand-local t)
 
          ;; If this directory is NOT in the current list of available
-         ;; directorys, then use the cache, and set the cache to our new
+         ;; directories, then use the cache, and set the cache to our new
          ;; value.  Make sure to unhighlight the current file, or if we
          ;; come back to this directory, it might be a different file
          ;; and then we get a mess!
@@ -2766,8 +2771,7 @@ If new functions are added, their state needs to be updated here."
 (defun speedbar-update-current-file ()
   "Find the current file, and update our visuals to indicate its name.
 This is specific to file names.  If the file name doesn't show up, but
-it should be in the list, then the directory cache needs to be
-updated."
+it should be in the list, then the directory cache needs to be updated."
   (let* ((lastf (selected-frame))
         (newcfd (save-excursion
                   (dframe-select-attached-frame speedbar-frame)
@@ -2836,8 +2840,8 @@ updated."
 
 (defun speedbar-add-indicator (indicator-string &optional replace-this)
   "Add INDICATOR-STRING to the end of this speedbar line.
-If INDICATOR-STRING is space, and REPLACE-THIS is a character, then
-the existing indicator is removed.  If there is already an
+If INDICATOR-STRING is space, and REPLACE-THIS is a character,
+then the existing indicator is removed.  If there is already an
 indicator, then do not add a space."
   (beginning-of-line)
   ;; The nature of the beast: Assume we are in "the right place"
@@ -2915,7 +2919,7 @@ to add more types of version control systems."
             (not (or (and (featurep 'ange-ftp)
                           (string-match
                            (car (symbol-value
-                                 (if dframe-xemacsp
+                                 (if (featurep 'xemacs)
                                      'ange-ftp-directory-format
                                    'ange-ftp-name-format)))
                            (expand-file-name default-directory)))
@@ -2950,7 +2954,7 @@ to add more types of version control systems."
       t)))
 
 (defun speedbar-check-vc-this-line (depth)
-  "Return t if the file on this line is check of of a version control system.
+  "Return t if the file on this line is checked out of a version control system.
 Parameter DEPTH is a string with the current depth of indentation of
 the file being checked."
   (let* ((d (string-to-number depth))
@@ -2972,18 +2976,8 @@ the file being checked."
   "Return t if we should bother checking DIRECTORY for version control files.
 This can be overloaded to add new types of version control systems."
   (or
-   ;; Local CVS available in Emacs 21
-   (and (fboundp 'vc-state)
-       (file-exists-p (concat directory "CVS/")))
-   ;; Local RCS
-   (file-exists-p (concat directory "RCS/"))
-   ;; Local SCCS
-   (file-exists-p (concat directory "SCCS/"))
-   ;; Remote SCCS project
-   (let ((proj-dir (getenv "PROJECTDIR")))
-     (if proj-dir
-        (file-exists-p (concat proj-dir "/SCCS"))
-       nil))
+   (catch t (dolist (vcd vc-directory-exclusion-list)
+             (if (file-exists-p (concat directory vcd)) (throw t t))) nil)
    ;; User extension
    (run-hook-with-args-until-success 'speedbar-vc-directory-enable-hook
                                      directory)
@@ -2991,29 +2985,11 @@ This can be overloaded to add new types of version control systems."
 
 (defun speedbar-this-file-in-vc (directory name)
   "Check to see if the file in DIRECTORY with NAME is in a version control system.
-You can add new VC systems by overriding this function.  You can
+Automatically recognizes all VCs supported by VC mode.  You can
 optimize this function by overriding it and only doing those checks
 that will occur on your system."
   (or
-   (if (fboundp 'vc-state)
-       ;; Emacs 21 handles VC state in a nice way.
-       (condition-case nil
-          (let ((state  (vc-state (concat directory name))))
-            (not (or (eq 'up-to-date state)
-                     (null state))))
-        ;; An error means not in a VC system
-        (error nil))
-     (or
-      ;; RCS file name
-      (file-exists-p (concat directory "RCS/" name ",v"))
-      (file-exists-p (concat directory "RCS/" name))
-      ;; Local SCCS file name
-      (file-exists-p (concat directory "SCCS/s." name))
-      ;; Remote SCCS file name
-      (let ((proj-dir (getenv "PROJECTDIR")))
-       (if proj-dir
-           (file-exists-p (concat proj-dir "/SCCS/s." name))
-         nil))))
+   (vc-backend (concat directory "/" name))
    ;; User extension
    (run-hook-with-args 'speedbar-vc-in-control-hook directory name)
    ))
@@ -3222,7 +3198,7 @@ directory with these items.  This function is replaceable in
       (if rf (funcall rf depth) default-directory))))
 
 (defun speedbar-files-line-directory (&optional depth)
-  "Retrieve the directoryname associated with the current line.
+  "Retrieve the directory associated with the current line.
 This may require traversing backwards from DEPTH and combining the default
 directory with these items."
   (save-excursion
@@ -3507,9 +3483,8 @@ INDENT is the current indentation level."
 
 (defun speedbar-tag-expand (text token indent)
   "Expand a tag sublist.  Imenu will return sub-lists of specialized tag types.
-Etags does not support this feature.  TEXT will be the button
-string.  TOKEN will be the list, and INDENT is the current indentation
-level."
+Etags does not support this feature.  TEXT will be the button string.
+TOKEN will be the list, and INDENT is the current indentation level."
   (cond ((string-match "+" text)       ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
@@ -3526,7 +3501,7 @@ level."
 ;;; 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."
@@ -3794,7 +3769,7 @@ Each symbol will be associated with its line position in FILE."
 ;      (delete-region (match-beginning 1) (match-end 1)))))
 
 (defun speedbar-extract-one-symbol (expr)
-  "At point, return nil, or one alist in the form: (SYMBOL .  POSITION)
+  "At point, return nil, or one alist in the form (SYMBOL . POSITION).
 The line should contain output from etags.  Parse the output using the
 regular expression EXPR."
   (let* ((sym (if (stringp expr)
@@ -3891,12 +3866,12 @@ regular expression EXPR."
 
 (defun speedbar-buffer-buttons (directory zero)
   "Create speedbar buttons based on the buffers currently loaded.
-DIRECTORY is the directory to the currently active buffer, and ZERO is 0."
+DIRECTORY is the directory of the currently active buffer, and ZERO is 0."
   (speedbar-buffer-buttons-engine nil))
 
 (defun speedbar-buffer-buttons-temp (directory zero)
   "Create speedbar buttons based on the buffers currently loaded.
-DIRECTORY is the directory to the currently active buffer, and ZERO is 0."
+DIRECTORY is the directory of the currently active buffer, and ZERO is 0."
   (speedbar-buffer-buttons-engine t))
 
 (defun speedbar-buffer-buttons-engine (temp)
@@ -3974,7 +3949,7 @@ Argument BUFFER is the buffer being tested."
                               (or (buffer-file-name buffer) "<No file>"))))))
 
 (defun speedbar-buffers-line-directory (&optional depth)
-  "Fetch the full directory to the file (buffer) specified on the current line.
+  "Fetch the directory of the file (buffer) specified on the current line.
 Optional argument DEPTH specifies the current depth of the back search."
   (save-excursion
     (end-of-line)
@@ -4061,11 +4036,11 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
   (remove-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line))
 
 (defun speedbar-recenter-to-top ()
-  "Recenter the current buffer so POINT is on the top of the window."
+  "Recenter the current buffer so point is on the top of the window."
   (recenter 1))
 
 (defun speedbar-recenter ()
-  "Recenter the current buffer so POINT is in the center of the window."
+  "Recenter the current buffer so point is in the center of the window."
   (recenter (/ (window-height (selected-window)) 2)))
 
 \f
@@ -4138,7 +4113,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
                                    (:background "white"
                                     :foreground "black"
                                     :overline "black")))
-  "Face used for separator labes in a display."
+  "Face used for separator labels in a display."
   :group 'speedbar-faces)
 
 ;; some edebug hooks
@@ -4147,35 +4122,34 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
            (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)
-
-(define-obsolete-variable-alias 'speedbar-ignored-path-expressions
-  'speedbar-ignored-directory-expressions)
+  '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)