21652
+ ��膩��鰹申鐃順�渇��膩��� 1 ;;; speedbspec --- Buffer specialized configurations for speedbar
+ ��膩��鰹申鐃順�渇��膩��� 2
+ ��膩��鰹申鐃順�渇��膩��� 3 ;; Copyright (C) 1997, 1998 Free Software Foundation
+ ��膩��鰹申鐃順�渇��膩��� 4 ;;
+ ��膩��鰹申鐃順�渇��膩��� 5 ;; Author: Eric M. Ludlam <zappo@gnu.ai.mit.edu>
+ ��膩��鰹申鐃順�渇��膩��� 6 ;; Version: 0.2
+ ��膩��鰹申鐃順�渇��膩��� 7 ;; Keywords: file, tags, tools
+ ��膩��鰹申鐃順�渇��膩��� 8 ;;
+ ��膩��鰹申鐃順�渇��膩��� 9 ;; This file is part of GNU Emacs.
+ ��膩��鰹申鐃順�渇��膩��� 10 ;; GNU Emacs is free software; you can redistribute it and/or modify
+ ��膩��鰹申鐃順�渇��膩��� 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)
+ ��膩��鰹申鐃順�渇��膩��� 13 ;; any later version.
+ ��膩��鰹申鐃順�渇��膩��� 14 ;;
+ ��膩��鰹申鐃順�渇��膩��� 15 ;; GNU Emacs is distributed in the hope that it will be useful,
+ ��膩��鰹申鐃順�渇��膩��� 16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ��膩��鰹申鐃順�渇��膩��� 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ��膩��鰹申鐃順�渇��膩��� 18 ;; GNU General Public License for more details.
+ ��膩��鰹申鐃順�渇��膩��� 19 ;;
+ ��膩��鰹申鐃順�渇��膩��� 20 ;; You should have received a copy of the GNU General Public License
+ ��膩��鰹申鐃順�渇��膩��� 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
+ ��膩��鰹申鐃順�渇��膩��� 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ ��膩��鰹申鐃順�渇��膩��� 23 ;; Boston, MA 02111-1307, USA.
+ ��膩��鰹申鐃順�渇��膩��� 24
+ ��膩��鰹申鐃順�渇��膩��� 25 ;;; Commentary:
+ ��膩��鰹申鐃順�渇��膩��� 26 ;;
+ ��膩��鰹申鐃順�渇��膩��� 27 ;; Speedbar provides a frame in which files, and locations in
+ ��膩��鰹申鐃順�渇��膩��� 28 ;; files are displayed. These functions provide some mode-specific
+ ��膩��鰹申鐃順�渇��膩��� 29 ;; displays for some existing emacs modes.
+ ��膩��鰹申鐃順�渇��膩��� 30 ;;
+ ��膩��鰹申鐃順�渇��膩��� 31 ;; To provide special service to all the modes supported by this file,
+ ��膩��鰹申鐃順�渇��膩��� 32 ;; put the following in your .emacs file.
+ ��膩��鰹申鐃順�渇��膩��� 33 ;;
+ ��膩��鰹申鐃順�渇��膩��� 34 ;; (require 'speedbspec)
+ ��膩��鰹申鐃順�渇��膩��� 35 ;;
+ ��膩��鰹申鐃順�渇��膩��� 36 ;; This will load in the known functions, and the mode-enabling code
+ ��膩��鰹申鐃順�渇��膩��� 37 ;; into 'change-major-mode-hook.
+ ��膩��鰹申鐃順�渇��膩��� 38 ;;
+ ��膩��鰹申鐃順�渇��膩��� 39 ;; You can interactivly try to enable speedbar specialized modes by
+ ��膩��鰹申鐃順�渇��膩��� 40 ;; calling the function `speedbar-add-localized-speedbar-support' and
+ ��膩��鰹申鐃順�渇��膩��� 41 ;; disable it with `speedbar-remove-localized-speedbar-support'.
+ ��膩��鰹申鐃順�渇��膩��� 42 ;;
+ ��膩��鰹申鐃順�渇��膩��� 43 ;; This file requires speedbar.
+ ��膩��鰹申鐃順�渇��膩��� 44
+ ��膩��鰹申鐃順�渇��膩��� 45 ;;; Change log:
+ ��膩��鰹申鐃順�渇��膩��� 46 ;; 0.1 - Initial revision requiring speedbar 0.5
+ ��膩��鰹申鐃順�渇��膩��� 47 ;; 0.1.1 - `buffer-live-p' replacement on old emacsen
+ ��膩��鰹申鐃順�渇��膩��� 48 ;; 0.2 - Moved actual work code into their own files.
+ ��膩��鰹申鐃順�渇��膩��� 49 ;; Check and load files that need loading before checking for the
+ ��膩��鰹申鐃順�渇��膩��� 50 ;; menu variable.
+ ��膩��鰹申鐃順�渇��膩��� 51 ;; Made the functions to turn on/off speedbar support interactive.
+ ��膩��鰹申鐃順�渇��膩��� 52 ;; It is *not* a minor-mode, it mearly enables special speedbar
+ ��膩��鰹申鐃順�渇��膩��� 53 ;; behaviors.
+ ��膩��鰹申鐃順�渇��膩��� 54 ;; 0.2.1 - Fix for emacs 20 when checking for autoload functions.
+ ��膩��鰹申鐃順�渇��膩��� 55
+ ��膩��鰹申鐃順�渇��膩��� 56 ;;; Code:
+ ��膩��鰹申鐃順�渇��膩��� 57 (require 'speedbar)
+ ��膩��鰹申鐃順�渇��膩��� 58
+ ��膩��鰹申鐃順�渇��膩��� 59 ;;; Compatibility:
+ ��膩��鰹申鐃順�渇��膩��� 60 ;;
+ ��膩��鰹申鐃順�渇��膩��� 61 ;; Thanks: ptype@dra.hmg.gb
+ ��膩��鰹申鐃順�渇��膩��� 62 (if (fboundp 'buffer-live-p)
+ ��膩��鰹申鐃順�渇��膩��� 63 nil
+ ��膩��鰹申鐃順�渇��膩��� 64 (defun buffer-live-p (buffer)
+ ��膩��鰹申鐃順�渇��膩��� 65 "Determine if the buffer is alive."
+ ��膩��鰹申鐃順�渇��膩��� 66 (memq buffer (buffer-list))))
+ ��膩��鰹申鐃順�渇��膩��� 67
+ ��膩��鰹申鐃順�渇��膩��� 68
+ ��膩��鰹申鐃順�渇��膩��� 69 ;;; Generic add-new-special-mode stuff
+ ��膩��鰹申鐃順�渇��膩��� 70 ;;
+ ��膩��鰹申鐃順�渇��膩��� 71 (defvar speedbar-localized-buffer-queue nil
+ ��膩��鰹申鐃順�渇��膩��� 72 "List of buffers to localize for speedbar.")
+ ��膩��鰹申鐃順�渇��膩��� 73
+ ��膩��鰹申鐃順�渇��膩��� 74 (defun speedbar-add-localized-speedbar-support-to-q ()
+ ��膩��鰹申鐃順�渇��膩��� 75 "Add speedbar support to all buffers in `speedbar-localized-buffer-queue'."
+ ��膩��鰹申鐃順�渇��膩��� 76 (remove-hook 'post-command-hook
+ ��膩��鰹申鐃順�渇��膩��� 77 'speedbar-add-localized-speedbar-support-to-q)
+ ��膩��鰹申鐃順�渇��膩��� 78 (while speedbar-localized-buffer-queue
+ ��膩��鰹申鐃順�渇��膩��� 79 (speedbar-add-localized-speedbar-support
+ ��膩��鰹申鐃順�渇��膩��� 80 (car speedbar-localized-buffer-queue))
+ ��膩��鰹申鐃順�渇��膩��� 81 (setq speedbar-localized-buffer-queue
+ ��膩��鰹申鐃順�渇��膩��� 82 (cdr speedbar-localized-buffer-queue))))
+ ��膩��鰹申鐃順�渇��膩��� 83
+ ��膩��鰹申鐃順�渇��膩��� 84 (defun speedbar-add-localized-speedbar-support (buffer)
+ ��膩��鰹申鐃順�渇��膩��� 85 "Add localized speedbar support to BUFFER's mode if it is available."
+ ��膩��鰹申鐃順�渇��膩��� 86 (interactive "bBuffer: ")
+ ��膩��鰹申鐃順�渇��膩��� 87 (if (stringp buffer) (setq buffer (get-buffer buffer)))
+ ��膩��鰹申鐃順�渇��膩��� 88 (if (not (buffer-live-p buffer))
+ ��膩��鰹申鐃順�渇��膩��� 89 nil
+ ��膩��鰹申鐃順�渇��膩��� 90 (save-excursion
+ ��膩��鰹申鐃順�渇��膩��� 91 (set-buffer buffer)
+ ��膩��鰹申鐃順�渇��膩��� 92 (save-match-data
+ ��膩��鰹申鐃順�渇��膩��� 93 (let ((ms (symbol-name major-mode))
+ ��膩��鰹申鐃順�渇��膩��� 94 v tmp)
+ ��膩��鰹申鐃順�渇��膩��� 95 (if (not (string-match "-mode$" ms))
+ ��膩��鰹申鐃順�渇��膩��� 96 nil ;; do nothing to broken mode
+ ��膩��鰹申鐃順�渇��膩��� 97 (setq ms (substring ms 0 (match-beginning 0)))
+ ��膩��鰹申鐃順�渇��膩��� 98 (setq v (intern-soft (concat ms "-speedbar-buttons")))
+ ��膩��鰹申鐃順�渇��膩��� 99 (if (not v)
+ ��膩��鰹申鐃順�渇��膩��� 100 nil ;; do nothing if not defined
+ ��膩��鰹申鐃順�渇��膩��� 101 ;; If it is autoloaded, we need to load it now so that
+ ��膩��鰹申鐃順�渇��膩��� 102 ;; we have access to the varialbe -speedbar-menu-items.
+ ��膩��鰹申鐃順�渇��膩��� 103 ;; Is this XEmacs safe?
+ ��膩��鰹申鐃順�渇��膩��� 104 (let ((sf (symbol-function v)))
+ ��膩��鰹申鐃順�渇��膩��� 105 (if (and (listp sf) (eq (car sf) 'autoload))
+ ��膩��鰹申鐃順�渇��膩��� 106 (load-library (car (cdr sf)))))
+ ��膩��鰹申鐃順�渇��膩��� 107 (set (make-local-variable 'speedbar-special-mode-expansion-list)
+ ��膩��鰹申鐃順�渇��膩��� 108 (list v))
+ ��膩��鰹申鐃順�渇��膩��� 109 (setq v (intern-soft (concat ms "-speedbar-menu-items")))
+ ��膩��鰹申鐃順�渇��膩��� 110 (if (not v)
+ ��膩��鰹申鐃順�渇��膩��� 111 nil ;; don't add special menus
+ ��膩��鰹申鐃順�渇��膩��� 112 (make-local-variable 'speedbar-easymenu-definition-special)
+ ��膩��鰹申鐃順�渇��膩��� 113 (setq speedbar-easymenu-definition-special
+ ��膩��鰹申鐃順�渇��膩��� 114 (symbol-value v))))))))))
+ ��膩��鰹申鐃順�渇��膩��� 115
+ ��膩��鰹申鐃順�渇��膩��� 116 (defun speedbar-remove-localized-speedbar-support (buffer)
+ ��膩��鰹申鐃順�渇��膩��� 117 "Remove any traces that BUFFER supports speedbar in a specialized way."
+ ��膩��鰹申鐃順�渇��膩��� 118 (save-excursion
+ ��膩��鰹申鐃順�渇��膩��� 119 (set-buffer buffer)
+ ��膩��鰹申鐃順�渇��膩��� 120 (kill-local-variable 'speedbar-special-mode-expansion-list)
+ ��膩��鰹申鐃順�渇��膩��� 121 (kill-local-variable 'speedbar-easymenu-definition-special)))
+ ��膩��鰹申鐃順�渇��膩��� 122
+ ��膩��鰹申鐃順�渇��膩��� 123 (defun speedbar-change-major-mode ()
+ ��膩��鰹申鐃順�渇��膩��� 124 "Run when the major mode is changed."
+ ��膩��鰹申鐃順�渇��膩��� 125 (setq speedbar-localized-buffer-queue
+ ��膩��鰹申鐃順�渇��膩��� 126 (add-to-list 'speedbar-localized-buffer-queue (current-buffer)))
+ ��膩��鰹申鐃順�渇��膩��� 127 (add-hook 'post-command-hook 'speedbar-add-localized-speedbar-support-to-q))
+ ��膩��鰹申鐃順�渇��膩��� 128
+ ��膩��鰹申鐃順�渇��膩��� 129 (add-hook 'change-major-mode-hook 'speedbar-change-major-mode)
+ ��膩��鰹申鐃順�渇��膩��� 130 (add-hook 'find-file-hooks 'speedbar-change-major-mode)
+ ��膩��鰹申鐃順�渇��膩��� 131
+ ��膩��鰹申鐃順�渇��膩��� 132 (provide 'speedbspec)
+ ��膩��鰹申鐃順�渇��膩��� 133 ;;; speedbspec ends here