HideIfDef mode bug fixes and enhancements. This is #2 of 3 patches based
[bpt/emacs.git] / lisp / speedbar.el
index 9daa77b..55e86e7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; speedbar --- quick access to files and tags in a frame
 
-;; Copyright (C) 1996-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2014 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
@@ -39,21 +39,9 @@ this version is not backward compatible to 0.14 or earlier.")
 ;;
 ;;; Notes:
 ;;
-;;    Users of really old emacsen without the need timer functions
-;; will not have speedbar updating automatically.  Use "g" to refresh
-;; the display after changing directories.  Remember, do not interrupt
-;; the stealthy updates or your display may not be completely
-;; refreshed.
-;;
 ;;    AUC-TEX users: The imenu tags for AUC-TEX mode don't work very
 ;; well.  Use the imenu keywords from tex-mode.el for better results.
 ;;
-;; This file requires the library package assoc (association lists)
-;;     assoc should be available in all modern versions of Emacs.
-;; The custom package is optional (for easy configuration of speedbar)
-;;     http://www.dina.kvl.dk/~abraham/custom/
-;;     custom is available in all versions of Emacs version 20 or better.
-;;
 ;;; Developing for speedbar
 ;;
 ;; Adding a speedbar specialized display mode:
@@ -135,17 +123,21 @@ this version is not backward compatible to 0.14 or earlier.")
   :group 'etags
   :group 'tools
   :group 'convenience
+  :link '(custom-manual "(speedbar) Top")
+  :link '(info-link "(speedbar) Customizing")
 ;  :version "20.3"
   )
 
 (defgroup speedbar-faces nil
   "Faces used in speedbar."
   :prefix "speedbar-"
+  :link '(info-link "(speedbar) Frames and Faces")
   :group 'speedbar
   :group 'faces)
 
 (defgroup speedbar-vc nil
   "Version control display in speedbar."
+  :link '(info-link "(speedbar) Version Control")
   :prefix "speedbar-"
   :group 'speedbar)
 
@@ -250,7 +242,7 @@ frame."
 
 (defcustom speedbar-query-confirmation-method 'all
   "Query control for file operations.
-The 'always flag means to always query before file operations.
+The 'all 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."
   :group 'speedbar
@@ -1007,9 +999,9 @@ supported at a time.
                                 ;; with the selected frame.
                                 (list 'parent (selected-frame)))
                       speedbar-frame-parameters)
-                    speedbar-before-delete-hook
-                    speedbar-before-popup-hook
-                    speedbar-after-create-hook)
+                    'speedbar-before-delete-hook
+                    'speedbar-before-popup-hook
+                    'speedbar-after-create-hook)
   ;; Start up the timer
   (if (not speedbar-frame)
       (speedbar-set-timer nil)
@@ -1072,9 +1064,9 @@ If the selected frame is not speedbar, then speedbar frame is
 selected.  If the speedbar frame is active, then select the attached frame."
   (interactive)
   (speedbar-reset-scanners)
-  (dframe-get-focus 'speedbar-frame 'speedbar-frame-mode
-                   (lambda () (let ((speedbar-update-flag t))
-                                (speedbar-timer-fn)))))
+  (dframe-get-focus 'speedbar-frame 'speedbar-frame-mode)
+  (let ((speedbar-update-flag t))
+    (speedbar-timer-fn)))
 
 (defsubst speedbar-frame-width ()
   "Return the width of the speedbar frame in characters.
@@ -2648,7 +2640,7 @@ Also resets scanner functions."
              (dframe-select-attached-frame speedbar-frame)
              ;; make sure we at least choose a window to
              ;; get a good directory from
-             (if (window-minibuffer-p (selected-window))
+             (if (window-minibuffer-p)
                  nil
                ;; Check for special modes
                (speedbar-maybe-add-localized-support (current-buffer))
@@ -2969,7 +2961,7 @@ that will occur on your system."
    (run-hook-with-args 'speedbar-vc-in-control-hook directory name)
    ))
 
-;; Objet File scanning
+;; Object File scanning
 (defun speedbar-check-objects ()
   "Scan all files in a directory, and for each see if there is an object.
 See `speedbar-check-obj-this-line' and `speedbar-obj-alist' for how
@@ -3512,7 +3504,7 @@ interested in."
     (set-buffer speedbar-buffer)
 
     (if (<= (count-lines (point-min) (point-max))
-           (1- (window-height (selected-window))))
+           (1- (window-height)))
        ;; whole buffer fits
        (let ((cp (point)))
 
@@ -3545,7 +3537,7 @@ interested in."
              (setq end (point-max)))))
        ;; Now work out the details of centering
        (let ((nl (count-lines start end))
-              (wl (1- (window-height (selected-window))))
+              (wl (1- (window-height)))
              (cp (point)))
          (if (> nl wl)
              ;; We can't fit it all, so just center on cursor
@@ -3558,12 +3550,12 @@ interested in."
                nil
              ;; we need to do something...
              (goto-char start)
-             (let ((newcent (/ (- (window-height (selected-window)) nl) 2))
+             (let ((newcent (/ (- (window-height) nl) 2))
                    (lte (count-lines start (point-max))))
-               (if (and (< (+ newcent lte) (window-height (selected-window)))
-                        (> (- (window-height (selected-window)) lte 1)
+               (if (and (< (+ newcent lte) (window-height))
+                        (> (- (window-height) lte 1)
                            newcent))
-                   (setq newcent (- (window-height (selected-window))
+                   (setq newcent (- (window-height)
                                     lte 1)))
                (recenter newcent))))
           (goto-char cp))))))
@@ -3997,7 +3989,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
 
 (defun speedbar-recenter ()
   "Recenter the current buffer so point is in the center of the window."
-  (recenter (/ (window-height (selected-window)) 2)))
+  (recenter (/ (window-height) 2)))
 
 \f
 ;;; Color loading section.