aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric M. Ludlam1998-08-03 17:47:39 +0000
committerEric M. Ludlam1998-08-03 17:47:39 +0000
commit0e5961010ee7a5faad65765cf06b2ab6c7d3c4ec (patch)
tree68ba29232449219f654c39b519c3bbaadbaa858e
parent39df451ba4114133c2fb0afe60b672ed7609730f (diff)
downloademacs-0e5961010ee7a5faad65765cf06b2ab6c7d3c4ec.tar.gz
emacs-0e5961010ee7a5faad65765cf06b2ab6c7d3c4ec.zip
(speedbar-update-current-file): Added call to
`speedbar-center-buffer-smartly' to improve the display. (speedbar-center-buffer-smartly) Fixed off-by-one error in window height calculation. (speedbar-hack-buffer-menu): New function. (speedbar-frame-parameters): Removed scroll bar width. (speedbar-frame-mode): Change pointer shape for X and W32 window-systems only. When window-system is pc, bind the speedbar frame name to "Speedbar", and select that frame so it is displayed. (speedbar-mode): Don't bind default-minibuffer-frame when window-system is pc. (speedbar-this-file-in-vc): Look for RCS/name as well as RCS/name,v. (speedbar-directory-buttons-follow): Support both upper- and lower-case drive letters. Use directory-sep-char instead of a literal backslash. (speedbar-reconfigure-keymaps): Call `easy-menu-remove' before reconfiguring for a new menu bar. (speedbar-previous-menu): New Variable. (speedbar-frame-plist): Remove pointers. (speedbar-refresh): Prevent the mark from being deactivated. (speedbar-buffer-kill-buffer): Refresh speedbar after killing a buffer in the buffer display.
-rw-r--r--lisp/speedbar.el86
1 files changed, 64 insertions, 22 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 0a98fbacb2c..d1307ec4c0c 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -3,9 +3,9 @@
3;;; Copyright (C) 1996, 97, 98 Free Software Foundation 3;;; Copyright (C) 1996, 97, 98 Free Software Foundation
4 4
5;; Author: Eric M. Ludlam <zappo@gnu.org> 5;; Author: Eric M. Ludlam <zappo@gnu.org>
6;; Version: 0.7 6;; Version: 0.7.1
7;; Keywords: file, tags, tools 7;; Keywords: file, tags, tools
8;; X-RCS: $Id: speedbar.el,v 1.112 1998/06/16 12:53:18 kwzh Exp kwzh $ 8;; X-RCS: $Id: speedbar.el,v 1.4 1998/07/10 16:48:06 kwzh Exp zappo $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -807,6 +807,9 @@ to toggle this value.")
807 (define-key speedbar-key-map [mode-line down-mouse-1] 807 (define-key speedbar-key-map [mode-line down-mouse-1]
808 'speedbar-emacs-popup-kludge) 808 'speedbar-emacs-popup-kludge)
809 809
810 ;; We can't switch buffers with the buffer mouse menu. Lets hack it.
811 (define-key speedbar-key-map [C-down-mouse-1] 'speedbar-hack-buffer-menu)
812
810 ;; Lastly, we want to track the mouse. Play here 813 ;; Lastly, we want to track the mouse. Play here
811 (define-key speedbar-key-map [mouse-movement] 'speedbar-track-mouse) 814 (define-key speedbar-key-map [mouse-movement] 'speedbar-track-mouse)
812 )) 815 ))
@@ -1006,6 +1009,10 @@ supported at a time.
1006 (select-frame speedbar-frame) 1009 (select-frame speedbar-frame)
1007 (switch-to-buffer speedbar-buffer) 1010 (switch-to-buffer speedbar-buffer)
1008 (set-window-dedicated-p (selected-window) t)) 1011 (set-window-dedicated-p (selected-window) t))
1012 (if (or (null window-system) (eq window-system 'pc))
1013 (progn
1014 (select-frame speedbar-frame)
1015 (set-frame-name "Speedbar")))
1009 (speedbar-set-timer speedbar-update-speed))))) 1016 (speedbar-set-timer speedbar-update-speed)))))
1010 1017
1011;;;###autoload 1018;;;###autoload
@@ -1113,7 +1120,8 @@ in the selected file.
1113 (setq frame-title-format "Speedbar") 1120 (setq frame-title-format "Speedbar")
1114 ;; Set this up special just for the speedbar buffer 1121 ;; Set this up special just for the speedbar buffer
1115 ;; Terminal minibuffer stuff does not require this. 1122 ;; Terminal minibuffer stuff does not require this.
1116 (if (and window-system (null default-minibuffer-frame)) 1123 (if (and window-system (not (eq window-system 'pc))
1124 (null default-minibuffer-frame))
1117 (progn 1125 (progn
1118 (make-local-variable 'default-minibuffer-frame) 1126 (make-local-variable 'default-minibuffer-frame)
1119 (setq default-minibuffer-frame speedbar-attached-frame))) 1127 (setq default-minibuffer-frame speedbar-attached-frame)))
@@ -1220,6 +1228,9 @@ redirected into a window on the attached frame."
1220 (mapcar (function (lambda (hook) (funcall hook buffer))) 1228 (mapcar (function (lambda (hook) (funcall hook buffer)))
1221 temp-buffer-show-hook)))) 1229 temp-buffer-show-hook))))
1222 1230
1231(defvar speedbar-previous-menu nil
1232 "The menu before the last `speedbar-reconfigure-keymaps' was called.")
1233
1223(defun speedbar-reconfigure-keymaps () 1234(defun speedbar-reconfigure-keymaps ()
1224 "Reconfigure the menu-bar in a speedbar frame. 1235 "Reconfigure the menu-bar in a speedbar frame.
1225Different menu items are displayed depending on the current display mode 1236Different menu items are displayed depending on the current display mode
@@ -1271,11 +1282,14 @@ and the existence of packages."
1271 ;; This creates a small keymap we can glom the 1282 ;; This creates a small keymap we can glom the
1272 ;; menu adjustments into. 1283 ;; menu adjustments into.
1273 (speedbar-make-specialized-keymap))) 1284 (speedbar-make-specialized-keymap)))
1285 ;; Delete the old menu if applicable.
1286 (if speedbar-previous-menu (easy-menu-remove speedbar-previous-menu))
1287 (setq speedbar-previous-menu md)
1288 ;; Now add the new menu
1274 (if (not speedbar-xemacsp) 1289 (if (not speedbar-xemacsp)
1275 (easy-menu-define speedbar-menu-map (current-local-map) 1290 (easy-menu-define speedbar-menu-map (current-local-map)
1276 "Speedbar menu" md) 1291 "Speedbar menu" md)
1277 (if (and (not (assoc "Speedbar" mode-popup-menu))) 1292 (easy-menu-add md (current-local-map))
1278 (easy-menu-add md (current-local-map)))
1279 (set-buffer-menubar (list md)))))) 1293 (set-buffer-menubar (list md))))))
1280 1294
1281 1295
@@ -1375,6 +1389,26 @@ Must be bound to event E."
1375 (mouse-major-mode-menu e) 1389 (mouse-major-mode-menu e)
1376 (mouse-major-mode-menu e nil)))) 1390 (mouse-major-mode-menu e nil))))
1377 1391
1392(defun speedbar-hack-buffer-menu (e)
1393 "Control mouse 1 is buffer menu.
1394This hack overrides it so that the right thing happens in the main
1395Emacs frame, not in the speedbar frame.
1396Argument E is the event causing this activity."
1397 (interactive "e")
1398 (let ((fn (lookup-key global-map (if speedbar-xemacsp
1399 '(control button1)
1400 [C-down-mouse-1])))
1401 (newbuff nil))
1402 (unwind-protect
1403 (save-excursion
1404 (set-window-dedicated-p (selected-window) nil)
1405 (call-interactively fn)
1406 (setq newbuff (current-buffer)))
1407 (switch-to-buffer " SPEEDBAR")
1408 (set-window-dedicated-p (selected-window) t))
1409 (speedbar-with-attached-buffer
1410 (switch-to-buffer newbuff))))
1411
1378(defun speedbar-next (arg) 1412(defun speedbar-next (arg)
1379 "Move to the next ARGth line in a speedbar buffer." 1413 "Move to the next ARGth line in a speedbar buffer."
1380 (interactive "p") 1414 (interactive "p")
@@ -1487,20 +1521,23 @@ Assumes that the current buffer is the speedbar buffer"
1487(defun speedbar-refresh () 1521(defun speedbar-refresh ()
1488 "Refresh the current speedbar display, disposing of any cached data." 1522 "Refresh the current speedbar display, disposing of any cached data."
1489 (interactive) 1523 (interactive)
1490 (let ((dl speedbar-shown-directories)) 1524 (let ((dl speedbar-shown-directories)
1525 (dm (and (boundp 'deactivate-mark) deactivate-mark)))
1491 (while dl 1526 (while dl
1492 (adelete 'speedbar-directory-contents-alist (car dl)) 1527 (adelete 'speedbar-directory-contents-alist (car dl))
1493 (setq dl (cdr dl)))) 1528 (setq dl (cdr dl)))
1494 (if (<= 1 speedbar-verbosity-level) (message "Refreshing speedbar...")) 1529 (if (<= 1 speedbar-verbosity-level) (message "Refreshing speedbar..."))
1495 (speedbar-update-contents) 1530 (speedbar-update-contents)
1496 (speedbar-stealthy-updates) 1531 (speedbar-stealthy-updates)
1497 ;; Reset the timer in case it got really hosed for some reason... 1532 ;; Reset the timer in case it got really hosed for some reason...
1498 (speedbar-set-timer speedbar-update-speed) 1533 (speedbar-set-timer speedbar-update-speed)
1499 (if (<= 1 speedbar-verbosity-level) 1534 (if (<= 1 speedbar-verbosity-level)
1500 (progn 1535 (progn
1501 (message "Refreshing speedbar...done") 1536 (message "Refreshing speedbar...done")
1502 (sit-for 0) 1537 (sit-for 0)
1503 (message nil)))) 1538 (message nil)))
1539 ;; Protect the highlighted region.
1540 (if (boundp 'deactivate-mark) (setq deactivate-mark dm))))
1504 1541
1505(defun speedbar-item-load () 1542(defun speedbar-item-load ()
1506 "Load the item under the cursor or mouse if it is a Lisp file." 1543 "Load the item under the cursor or mouse if it is a Lisp file."
@@ -2646,7 +2683,10 @@ updated."
2646 )) 2683 ))
2647 (setq speedbar-last-selected-file newcf)) 2684 (setq speedbar-last-selected-file newcf))
2648 (if (not sucf-recursive) 2685 (if (not sucf-recursive)
2649 (speedbar-position-cursor-on-line)) 2686 (progn
2687 (speedbar-center-buffer-smartly)
2688 (speedbar-position-cursor-on-line)
2689 ))
2650 (set-buffer lastb) 2690 (set-buffer lastb)
2651 (select-frame lastf) 2691 (select-frame lastf)
2652 ))) 2692 )))
@@ -2771,6 +2811,7 @@ that will occur on your system."
2771 (or 2811 (or
2772 ;; RCS file name 2812 ;; RCS file name
2773 (file-exists-p (concat path "RCS/" name ",v")) 2813 (file-exists-p (concat path "RCS/" name ",v"))
2814 (file-exists-p (concat path "RCS/" name))
2774 ;; Local SCCS file name 2815 ;; Local SCCS file name
2775 (file-exists-p (concat path "SCCS/p." name)) 2816 (file-exists-p (concat path "SCCS/p." name))
2776 ;; Remote SCCS file name 2817 ;; Remote SCCS file name
@@ -3176,8 +3217,8 @@ expanded. INDENT is the current indentation level."
3176 "Speedbar click handler for default directory buttons. 3217 "Speedbar click handler for default directory buttons.
3177TEXT is the button clicked on. TOKEN is the directory to follow. 3218TEXT is the button clicked on. TOKEN is the directory to follow.
3178INDENT is the current indentation level and is unused." 3219INDENT is the current indentation level and is unused."
3179 (if (string-match "^[A-Z]:$" token) 3220 (if (string-match "^[A-z]:$" token)
3180 (setq default-directory (concat token "\\")) 3221 (setq default-directory (concat token (char-to-string directory-sep-char)))
3181 (setq default-directory token)) 3222 (setq default-directory token))
3182 ;; Because we leave speedbar as the current buffer, 3223 ;; Because we leave speedbar as the current buffer,
3183 ;; update contents will change directory without 3224 ;; update contents will change directory without
@@ -3274,7 +3315,7 @@ frame instead."
3274This assumes that the cursor is on a file, or tag of a file which the user is 3315This assumes that the cursor is on a file, or tag of a file which the user is
3275interested in." 3316interested in."
3276 (if (<= (count-lines (point-min) (point-max)) 3317 (if (<= (count-lines (point-min) (point-max))
3277 (window-height (selected-window))) 3318 (1- (window-height (selected-window))))
3278 ;; whole buffer fits 3319 ;; whole buffer fits
3279 (let ((cp (point))) 3320 (let ((cp (point)))
3280 (goto-char (point-min)) 3321 (goto-char (point-min))
@@ -3631,7 +3672,8 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
3631 (point)))))) 3672 (point))))))
3632 (if (and (get-buffer text) 3673 (if (and (get-buffer text)
3633 (y-or-n-p (format "Kill buffer %s? " text))) 3674 (y-or-n-p (format "Kill buffer %s? " text)))
3634 (kill-buffer text))))))) 3675 (kill-buffer text))
3676 (speedbar-refresh))))))
3635 3677
3636(defun speedbar-buffer-revert-buffer () 3678(defun speedbar-buffer-revert-buffer ()
3637 "Revert the buffer the cursor is on in the speedbar buffer." 3679 "Revert the buffer the cursor is on in the speedbar buffer."