aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric M. Ludlam1998-08-19 01:43:37 +0000
committerEric M. Ludlam1998-08-19 01:43:37 +0000
commita4252bdbf5100f54506acc2e4e99af783b695c89 (patch)
tree82b33d28d2e15dae3f162cf8b396ddf76c2ebb8f
parent0db078dc2c4b6f1643561730fa92108ee46785e6 (diff)
downloademacs-a4252bdbf5100f54506acc2e4e99af783b695c89.tar.gz
emacs-a4252bdbf5100f54506acc2e4e99af783b695c89.zip
(speedbar-timer-fn): Disable updating if the frame
is an icon, or if the user is using the minibuffer. (speedbar-key-map): Added Q binding to destroy the frame. (speedbar-easymenu-definition-trailer): Added Quit item. (speedbar-frame-mode): Set the frame position at creation time. (speedbar-file-unshown-regexp): Added .# lock files.
-rw-r--r--lisp/speedbar.el143
1 files changed, 82 insertions, 61 deletions
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 65c891aa2d7..4350a4bd42e 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.2 6;; Version: 0.7.2a
7;; Keywords: file, tags, tools 7;; Keywords: file, tags, tools
8;; X-RCS: $Id: speedbar.el,v 1.7 1998/08/08 21:20:51 zappo Exp zappo $ 8;; X-RCS: $Id: speedbar.el,v 1.8 1998/08/14 01:15:33 zappo Exp zappo $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -634,7 +634,8 @@ useful, such as version control."
634 (setq nstr (concat nstr (regexp-quote (car noext)) "\\'" 634 (setq nstr (concat nstr (regexp-quote (car noext)) "\\'"
635 (if (cdr noext) "\\|" "")) 635 (if (cdr noext) "\\|" ""))
636 noext (cdr noext))) 636 noext (cdr noext)))
637 (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'")) 637 ;; backup refdir lockfile
638 (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#"))
638 "*Regexp matching files we don't want displayed in a speedbar buffer. 639 "*Regexp matching files we don't want displayed in a speedbar buffer.
639It is generated from the variable `completion-ignored-extensions'") 640It is generated from the variable `completion-ignored-extensions'")
640 641
@@ -749,6 +750,7 @@ to toggle this value.")
749 (define-key speedbar-key-map "g" 'speedbar-refresh) 750 (define-key speedbar-key-map "g" 'speedbar-refresh)
750 (define-key speedbar-key-map "t" 'speedbar-toggle-updates) 751 (define-key speedbar-key-map "t" 'speedbar-toggle-updates)
751 (define-key speedbar-key-map "q" 'speedbar-close-frame) 752 (define-key speedbar-key-map "q" 'speedbar-close-frame)
753 (define-key speedbar-key-map "Q" 'delete c-frame)
752 754
753 ;; navigation 755 ;; navigation
754 (define-key speedbar-key-map "n" 'speedbar-next) 756 (define-key speedbar-key-map "n" 'speedbar-next)
@@ -891,7 +893,8 @@ This basically creates a sparse keymap, and makes it's parent be
891 (list 893 (list
892 (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) 894 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
893 ["Customize..." speedbar-customize t]) 895 ["Customize..." speedbar-customize t])
894 ["Close" speedbar-close-frame t]) 896 ["Close" speedbar-close-frame t]
897 ["Quit" delete-frame t] )
895 "Menu items appearing at the end of the speedbar menu.") 898 "Menu items appearing at the end of the speedbar menu.")
896 899
897(defvar speedbar-desired-buffer nil 900(defvar speedbar-desired-buffer nil
@@ -986,19 +989,33 @@ supported at a time.
986 (make-frame (nconc (list 'height 989 (make-frame (nconc (list 'height
987 (speedbar-needed-height)) 990 (speedbar-needed-height))
988 speedbar-frame-plist)) 991 speedbar-frame-plist))
989 (let* ((mh (cdr (assoc 'menu-bar-lines (frame-parameters)))) 992 (let* ((mh (frame-parameter nil 'menu-bar-lines))
990 (params (append speedbar-frame-parameters 993 (cfx (frame-parameter nil 'left))
991 (list (cons 994 (cfy (frame-parameter nil 'top))
992 'height 995 (cfw (frame-pixel-width))
993 (if speedbar-xemacsp 996 (params
994 (speedbar-needed-height) 997 (append
995 (+ mh (frame-height)))))))) 998 speedbar-frame-parameters
996 (if (or (< emacs-major-version 20);;a bug is fixed in v20 999 (list (cons 'height (+ mh (frame-height))))))
997 (not (eq window-system 'x))) 1000 (frame
998 (make-frame params) 1001 (if (or (< emacs-major-version 20)
999 (let ((x-pointer-shape x-pointer-top-left-arrow) 1002 (not (eq window-system 'x)))
1000 (x-sensitive-text-pointer-shape x-pointer-hand2)) 1003 (make-frame params)
1001 (make-frame params)))))) 1004 (let ((x-pointer-shape x-pointer-top-left-arrow)
1005 (x-sensitive-text-pointer-shape
1006 x-pointer-hand2))
1007 (make-frame params)))))
1008 (set-frame-position frame
1009 ;; Decide which side to put it
1010 ;; on. 200 is just a buffer
1011 ;; for the left edge of the
1012 ;; screen. The extra 10 is just
1013 ;; dressings for window decorations.
1014 (if (< cfx 200)
1015 (+ cfx cfw 10)
1016 (- cfx (frame-pixel-width frame) 10))
1017 cfy)
1018 frame)))
1002 ;; reset the selection variable 1019 ;; reset the selection variable
1003 (setq speedbar-last-selected-file nil) 1020 (setq speedbar-last-selected-file nil)
1004 ;; Put the buffer into the frame 1021 ;; Put the buffer into the frame
@@ -2468,7 +2485,7 @@ name will have the function FIND-FUN and not token."
2468 ;; default the shown directories to this list... 2485 ;; default the shown directories to this list...
2469 (setq speedbar-shown-directories (list cbd))) 2486 (setq speedbar-shown-directories (list cbd)))
2470 )) 2487 ))
2471 (setq speedbar-last-selected-file nil) 2488 (if (not expand-local) (setq speedbar-last-selected-file nil))
2472 (speedbar-with-writable 2489 (speedbar-with-writable
2473 (if (and expand-local 2490 (if (and expand-local
2474 ;; Find this directory as a speedbar node. 2491 ;; Find this directory as a speedbar node.
@@ -2523,55 +2540,59 @@ This should only be used by modes classified as special."
2523 (speedbar-set-timer nil) 2540 (speedbar-set-timer nil)
2524 ;; Save all the match data so that we don't mess up executing fns 2541 ;; Save all the match data so that we don't mess up executing fns
2525 (save-match-data 2542 (save-match-data
2526 (if (and (frame-visible-p speedbar-frame) speedbar-update-flag) 2543 ;; Only do stuff if the frame is visible, not an icon, and if
2544 ;; it is currently flagged to do something.
2545 (if (and speedbar-update-flag
2546 (frame-visible-p speedbar-frame)
2547 (not (eq (frame-visible-p speedbar-frame) 'icon)))
2527 (let ((af (selected-frame))) 2548 (let ((af (selected-frame)))
2528 (save-window-excursion 2549 (save-window-excursion
2529 (select-frame speedbar-attached-frame) 2550 (select-frame speedbar-attached-frame)
2530 ;; make sure we at least choose a window to 2551 ;; make sure we at least choose a window to
2531 ;; get a good directory from 2552 ;; get a good directory from
2532 (if (string-match "\\*Minibuf-[0-9]+\\*" (buffer-name)) 2553 (if (window-minibuffer-p (selected-window))
2533 (other-window 1)) 2554 nil
2534 ;; Check for special modes 2555 ;; Check for special modes
2535 (speedbar-maybe-add-localized-support (current-buffer)) 2556 (speedbar-maybe-add-localized-support (current-buffer))
2536 ;; Update for special mode all the time! 2557 ;; Update for special mode all the time!
2537 (if (and speedbar-mode-specific-contents-flag 2558 (if (and speedbar-mode-specific-contents-flag
2538 (listp speedbar-special-mode-expansion-list) 2559 (listp speedbar-special-mode-expansion-list)
2539 speedbar-special-mode-expansion-list 2560 speedbar-special-mode-expansion-list
2540 (local-variable-p 2561 (local-variable-p
2541 'speedbar-special-mode-expansion-list 2562 'speedbar-special-mode-expansion-list
2542 (current-buffer))) 2563 (current-buffer)))
2543 ;;(eq (get major-mode 'mode-class 'special))) 2564 ;;(eq (get major-mode 'mode-class 'special)))
2544 (progn 2565 (progn
2545 (if (<= 2 speedbar-verbosity-level) 2566 (if (<= 2 speedbar-verbosity-level)
2546 (message "Updating speedbar to special mode: %s..." 2567 (message "Updating speedbar to special mode: %s..."
2547 major-mode)) 2568 major-mode))
2548 (speedbar-update-special-contents) 2569 (speedbar-update-special-contents)
2549 (if (<= 2 speedbar-verbosity-level) 2570 (if (<= 2 speedbar-verbosity-level)
2571 (progn
2572 (message "Updating speedbar to special mode: %s...done"
2573 major-mode)
2574 (message nil))))
2575 ;; Update all the contents if directories change!
2576 (if (or (member (expand-file-name default-directory)
2577 speedbar-shown-directories)
2578 (and speedbar-ignored-path-regexp
2579 (string-match
2580 speedbar-ignored-path-regexp
2581 (expand-file-name default-directory)))
2582 (member major-mode speedbar-ignored-modes)
2583 (eq af speedbar-frame)
2584 (not (buffer-file-name)))
2585 nil
2586 (if (<= 1 speedbar-verbosity-level)
2587 (message "Updating speedbar to: %s..."
2588 default-directory))
2589 (speedbar-update-directory-contents)
2590 (if (<= 1 speedbar-verbosity-level)
2550 (progn 2591 (progn
2551 (message "Updating speedbar to special mode: %s...done" 2592 (message "Updating speedbar to: %s...done"
2552 major-mode) 2593 default-directory)
2553 (message nil)))) 2594 (message nil)))))
2554 ;; Update all the contents if directories change! 2595 (select-frame af)))
2555 (if (or (member (expand-file-name default-directory)
2556 speedbar-shown-directories)
2557 (and speedbar-ignored-path-regexp
2558 (string-match
2559 speedbar-ignored-path-regexp
2560 (expand-file-name default-directory)))
2561 (member major-mode speedbar-ignored-modes)
2562 (eq af speedbar-frame)
2563 (not (buffer-file-name)))
2564 nil
2565 (if (<= 1 speedbar-verbosity-level)
2566 (message "Updating speedbar to: %s..."
2567 default-directory))
2568 (speedbar-update-directory-contents)
2569 (if (<= 1 speedbar-verbosity-level)
2570 (progn
2571 (message "Updating speedbar to: %s...done"
2572 default-directory)
2573 (message nil)))))
2574 (select-frame af))
2575 ;; Now run stealthy updates of time-consuming items 2596 ;; Now run stealthy updates of time-consuming items
2576 (speedbar-stealthy-updates))) 2597 (speedbar-stealthy-updates)))
2577 ;; Now run the mouse tracking system 2598 ;; Now run the mouse tracking system