comparison lisp/utils/speedbar.el @ 177:6075d714658b r20-3b15

Import from CVS: tag r20-3b15
author cvs
date Mon, 13 Aug 2007 09:51:16 +0200
parents 85ec50267440
children 850242ba4a81
comparison
equal deleted inserted replaced
176:6866abce6aaf 177:6075d714658b
3 ;; Copyright (C) 1996, 1997 Eric M. Ludlam 3 ;; Copyright (C) 1996, 1997 Eric M. Ludlam
4 ;; 4 ;;
5 ;; Author: Eric M. Ludlam <zappo@gnu.ai.mit.edu> 5 ;; Author: Eric M. Ludlam <zappo@gnu.ai.mit.edu>
6 ;; Version: 0.5 6 ;; Version: 0.5
7 ;; Keywords: file, tags, tools 7 ;; Keywords: file, tags, tools
8 ;; X-RCS: $Id: speedbar.el,v 1.2 1997/06/29 23:13:33 steve Exp $ 8 ;; X-RCS: $Id: speedbar.el,v 1.3 1997/07/26 22:09:58 steve Exp $
9 ;; 9 ;;
10 ;; This program is free software; you can redistribute it and/or modify 10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by 11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option) 12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version. 13 ;; any later version.
670 "Never set this by hand. Value is t when S-mouse activity occurs.") 670 "Never set this by hand. Value is t when S-mouse activity occurs.")
671 671
672 672
673 ;;; Mode definitions/ user commands 673 ;;; Mode definitions/ user commands
674 ;; 674 ;;
675 ;;###autoload 675 ;;;###autoload
676 (defalias 'speedbar 'speedbar-frame-mode) 676 (defalias 'speedbar 'speedbar-frame-mode)
677 ;;;###autoload
677 (defun speedbar-frame-mode (&optional arg) 678 (defun speedbar-frame-mode (&optional arg)
678 "Enable or disable speedbar. Positive ARG means turn on, negative turn off. 679 "Enable or disable speedbar. Positive ARG means turn on, negative turn off.
679 nil means toggle. Once the speedbar frame is activated, a buffer in 680 nil means toggle. Once the speedbar frame is activated, a buffer in
680 `speedbar-mode' will be displayed. Currently, only one speedbar is 681 `speedbar-mode' will be displayed. Currently, only one speedbar is
681 supported at a time." 682 supported at a time."
720 (if (frame-live-p speedbar-frame) 721 (if (frame-live-p speedbar-frame)
721 (raise-frame speedbar-frame) 722 (raise-frame speedbar-frame)
722 (let ((params (cons (cons 'height (frame-height)) 723 (let ((params (cons (cons 'height (frame-height))
723 speedbar-frame-parameters))) 724 speedbar-frame-parameters)))
724 (setq speedbar-frame 725 (setq speedbar-frame
725 (if (< emacs-major-version 20) ;a bug is fixed in v20 & later 726 (if (or speedbar-xemacsp
727 (< emacs-major-version 20)) ;a bug is fixed in v20 & later
726 (make-frame params) 728 (make-frame params)
727 (let ((x-pointer-shape x-pointer-top-left-arrow) 729 (let ((x-pointer-shape x-pointer-top-left-arrow)
728 (x-sensitive-text-pointer-shape x-pointer-hand2)) 730 (x-sensitive-text-pointer-shape x-pointer-hand2))
729 (make-frame params))))) 731 (make-frame params)))))
730 ;; reset the selection variable 732 ;; reset the selection variable
759 (other-frame 0)) 761 (other-frame 0))
760 762
761 (defun speedbar-frame-width () 763 (defun speedbar-frame-width ()
762 "Return the width of the speedbar frame in characters. 764 "Return the width of the speedbar frame in characters.
763 nil if it doesn't exist." 765 nil if it doesn't exist."
764 (and speedbar-frame (cdr (assoc 'width (frame-parameters speedbar-frame))))) 766 (and speedbar-frame
767 (frame-live-p speedbar-frame)
768 (cdr (assoc 'width (frame-parameters speedbar-frame)))))
765 769
766 (defun speedbar-mode () 770 (defun speedbar-mode ()
767 "Major mode for managing a display of directories and tags. 771 "Major mode for managing a display of directories and tags.
768 \\<speedbar-key-map> 772 \\<speedbar-key-map>
769 The first line represents the default path of the speedbar frame. 773 The first line represents the default path of the speedbar frame.
885 ;; If bound locally, we can use it 889 ;; If bound locally, we can use it
886 speedbar-easymenu-definition-special))) 890 speedbar-easymenu-definition-special)))
887 ;; The trailer 891 ;; The trailer
888 speedbar-easymenu-definition-trailer))) 892 speedbar-easymenu-definition-trailer)))
889 (easy-menu-define speedbar-menu-map speedbar-key-map "Speedbar menu" md) 893 (easy-menu-define speedbar-menu-map speedbar-key-map "Speedbar menu" md)
890 (if speedbar-xemacsp (set-buffer-menubar (list km))))) 894 ;; (if speedbar-xemacsp (set-buffer-menubar (list km)))
895 ))
891 896
892 897
893 ;;; User Input stuff 898 ;;; User Input stuff
894 ;; 899 ;;
895 (defun speedbar-mouse-hscroll (e) 900 (defun speedbar-mouse-hscroll (e)
908 (scroll-right 2)) 913 (scroll-right 2))
909 (t (message "Click on the edge of the modeline to scroll left/right"))) 914 (t (message "Click on the edge of the modeline to scroll left/right")))
910 ;;(message "X: Pixel %d Char Pixels %d On char %d" xp cpw oc) 915 ;;(message "X: Pixel %d Char Pixels %d On char %d" xp cpw oc)
911 )) 916 ))
912 917
918 ;;;###autoload
913 (defun speedbar-get-focus () 919 (defun speedbar-get-focus ()
914 "Change frame focus to or from the speedbar frame. 920 "Change frame focus to or from the speedbar frame.
915 If the selected frame is not speedbar, then speedbar frame is 921 If the selected frame is not speedbar, then speedbar frame is
916 selected. If the speedbar frame is active, then select the attached frame." 922 selected. If the speedbar frame is active, then select the attached frame."
917 (interactive) 923 (interactive)