Mercurial > emacs
annotate lisp/cedet/semantic/sb.el @ 108009:17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
* vc.el (vc-checkin, vc-modify-change-comment):
Adjust to new vc-start/finish-logentry.
(vc-find-conflicted-file): New command.
(vc-transfer-file): Adjust to new vc-checkin.
(vc-next-action): Improve scoping.
* vc-hg.el (vc-hg-log-edit-mode): Remove.
(vc-hg-checkin): Remove extra arg. Use log-edit-extract-headers.
* vc-git.el (vc-git-log-edit-mode): Remove.
(vc-git-checkin): Remove extra arg. Use log-edit-extract-headers.
(vc-git-commits-coding-system): Rename from git-commits-coding-system.
* vc-dispatcher.el (vc-log-edit): Shorten names for log-edit-show-files.
(vc-start-logentry): Remove argument `extra'.
(vc-finish-logentry): Remove extra args.
* vc-bzr.el (vc-bzr-log-edit-mode): Remove.
(vc-bzr-checkin): Remove extra arg. Use log-edit-extract-headers.
(vc-bzr-conflicted-files): New function.
* log-edit.el (log-edit-extra-flags)
(log-edit-before-checkin-process): Remove.
(log-edit-summary, log-edit-header, log-edit-unknown-header): New faces.
(log-edit-headers-alist): New var.
(log-edit-header-contents-regexp): New const.
(log-edit-match-to-eoh): New function.
(log-edit-font-lock-keywords): Use them.
(log-edit): Insert a "Summary:" header as default.
(log-edit-mode): Mark font-lock rules as case-insensitive.
(log-edit-done): Cleanup headers.
(log-view-process-buffer): Remove.
(log-edit-extract-headers): New function to replace it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 20 Apr 2010 22:05:24 -0400 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/sb.el --- Semantic tag display for speedbar |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
105285 | 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
106815 | 4 ;; 2008, 2009, 2010 Free Software Foundation, Inc. |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: syntax |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Convert a tag table into speedbar buttons. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;;; TODO: |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; Use semanticdb to find which semanticdb-table is being used for each |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; file/tag. Replace `semantic-sb-with-tag-buffer' to instead call |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; children with the new `with-mode-local' instead. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'semantic) |
104447
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104446
diff
changeset
|
35 (require 'semantic/format) |
273e528a9f9b
* emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents:
104446
diff
changeset
|
36 (require 'semantic/sort) |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (require 'semantic/util) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (require 'speedbar) |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104447
diff
changeset
|
39 (declare-function semanticdb-file-stream "semantic/db") |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (defcustom semantic-sb-autoexpand-length 1 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 "*Length of a semantic bucket to autoexpand in place. |
105340 | 43 This will replace the named bucket that would have usually occurred here." |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 :group 'speedbar |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 :type 'integer) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (defcustom semantic-sb-button-format-tag-function 'semantic-format-tag-abbreviate |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 "*Function called to create the text for a but from a token." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 :group 'speedbar |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 :type semantic-format-tag-custom-list) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (defcustom semantic-sb-info-format-tag-function 'semantic-format-tag-summarize |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 "*Function called to create the text for info display from a token." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 :group 'speedbar |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 :type semantic-format-tag-custom-list) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 ;;; Code: |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 ;;; Buffer setting for correct mode manipulation. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (defun semantic-sb-tag-set-buffer (tag) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 "Set the current buffer to something associated with TAG. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 use the `speedbar-line-file' to get this info if needed." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (if (semantic-tag-buffer tag) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (set-buffer (semantic-tag-buffer tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (let ((f (speedbar-line-file))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 (set-buffer (find-file-noselect f))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (defmacro semantic-sb-with-tag-buffer (tag &rest forms) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 "Set the current buffer to the origin of TAG and execute FORMS. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 Restore the old current buffer when completed." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 `(save-excursion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (semantic-sb-tag-set-buffer ,tag) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 ,@forms)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (put 'semantic-sb-with-tag-buffer 'lisp-indent-function 1) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 ;;; Button Generation |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 ;; Here are some button groups: |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 ;; +> Function () |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 ;; @ return_type |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 ;; +( arg1 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 ;; +| arg2 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 ;; +) arg3 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 ;; +> Variable[1] = |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 ;; @ type |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 ;; = default value |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 ;; +> keywrd Type |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 ;; +> type part |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 ;; +> -> click to see additional information |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (define-overloadable-function semantic-sb-tag-children-to-expand (tag) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 "For TAG, return a list of children that TAG expands to. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 If this returns a value, then a +> icon is created. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 If it returns nil, then a => icon is created.") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (defun semantic-sb-tag-children-to-expand-default (tag) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 "For TAG, the children for type, variable, and function classes." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (semantic-sb-with-tag-buffer tag |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (semantic-tag-components tag))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (defun semantic-sb-one-button (tag depth &optional prefix) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 "Insert TAG as a speedbar button at DEPTH. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 Optional PREFIX is used to specify special marker characters." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (let* ((class (semantic-tag-class tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (edata (semantic-sb-tag-children-to-expand tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (type (semantic-tag-type tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (abbrev (semantic-sb-with-tag-buffer tag |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (funcall semantic-sb-button-format-tag-function tag))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (start (point)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (end (progn |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (insert (int-to-string depth) ":") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (point)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (insert-char ? (1- depth) nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (put-text-property end (point) 'invisible nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 ;; take care of edata = (nil) -- a yucky but hard to clean case |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (if (and edata (listp edata) (and (<= (length edata) 1) (not (car edata)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (setq edata nil)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (if (and (not edata) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (member class '(variable function)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 type) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (setq edata t)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 ;; types are a bit unique. Variable types can have special meaning. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (if edata |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (speedbar-insert-button (if prefix (concat " +" prefix) " +>") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 'speedbar-button-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 'speedbar-highlight-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 'semantic-sb-show-extra |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 tag t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (speedbar-insert-button (if prefix (concat " " prefix) " =>") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 nil nil nil nil t)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (speedbar-insert-button abbrev |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 'speedbar-tag-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 'speedbar-highlight-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 'semantic-sb-token-jump |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 tag t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; This is very bizarre. When this was just after the insertion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 ;; of the depth: text, the : would get erased, but only for the |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 ;; auto-expanded short- buckets. Move back for a later version |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 ;; version of Emacs 21 CVS |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 (put-text-property start end 'invisible t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 )) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (defun semantic-sb-speedbar-data-line (depth button text &optional |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 text-fun text-data) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 "Insert a semantic token data element. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 DEPTH is the current depth. BUTTON is the text for the button. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 TEXT is the actual info with TEXT-FUN to occur when it happens. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 Argument TEXT-DATA is the token data to pass to TEXT-FUN." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (let ((start (point)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (end (progn |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (insert (int-to-string depth) ":") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (point)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (put-text-property start end 'invisible t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (insert-char ? depth nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (put-text-property end (point) 'invisible nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (speedbar-insert-button button nil nil nil nil t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (speedbar-insert-button text |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 'speedbar-tag-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (if text-fun 'speedbar-highlight-face) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 text-fun text-data t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 )) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (defun semantic-sb-maybe-token-to-button (obj indent &optional |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 prefix modifiers) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 "Convert OBJ, which was returned from the semantic parser, into a button. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 This OBJ might be a plain string (simple type or untyped variable) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 or a complete tag. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 Argument INDENT is the indentation used when making the button. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 Optional PREFIX is the character to use when marking the line. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 Optional MODIFIERS is additional text needed for variables." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (let ((myprefix (or prefix ">"))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (if (stringp obj) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (semantic-sb-speedbar-data-line indent myprefix obj) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (if (listp obj) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (progn |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (if (and (stringp (car obj)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (= (length obj) 1)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (semantic-sb-speedbar-data-line indent myprefix |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (concat |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 (car obj) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 (or modifiers ""))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (semantic-sb-one-button obj indent prefix))))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (defun semantic-sb-insert-details (tag indent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 "Insert details about TAG at level INDENT." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (let ((tt (semantic-tag-class tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (type (semantic-tag-type tag))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (cond ((eq tt 'type) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (let ((parts (semantic-tag-type-members tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (newparts nil)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 ;; Lets expect PARTS to be a list of either strings, |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 ;; or variable tokens. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 (when (semantic-tag-p (car parts)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 ;; Bucketize into groups |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (semantic-sb-with-tag-buffer (car parts) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (setq newparts (semantic-bucketize parts))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (when (> (length newparts) semantic-sb-autoexpand-length) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 ;; More than one bucket, insert inline |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (semantic-sb-insert-tag-table (1- indent) newparts) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (setq parts nil)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 ;; Dump the strings in. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (while parts |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (semantic-sb-maybe-token-to-button (car parts) indent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (setq parts (cdr parts)))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 ((eq tt 'variable) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (if type |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (semantic-sb-maybe-token-to-button type indent "@")) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (let ((default (semantic-tag-variable-default tag))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (if default |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (semantic-sb-maybe-token-to-button default indent "="))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 ((eq tt 'function) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (if type |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 (semantic-sb-speedbar-data-line |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 indent "@" |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (if (stringp type) type |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (semantic-tag-name type)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ;; Arguments to the function |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (let ((args (semantic-tag-function-arguments tag))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (if (and args (car args)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (progn |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (semantic-sb-maybe-token-to-button (car args) indent "(") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (setq args (cdr args)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (while (> (length args) 1) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (semantic-sb-maybe-token-to-button (car args) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 indent |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 "|") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (setq args (cdr args))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (if args |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (semantic-sb-maybe-token-to-button |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (car args) indent ")")) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 )))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (t |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (let ((components |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (save-excursion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (when (and (semantic-tag-overlay tag) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (semantic-tag-buffer tag)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (set-buffer (semantic-tag-buffer tag))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (semantic-sb-tag-children-to-expand tag)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 ;; Well, it wasn't one of the many things we expect. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 ;; Lets just insert them in with no decoration. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (while components |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (semantic-sb-one-button (car components) indent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (setq components (cdr components))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 )) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 )) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (defun semantic-sb-detail-parent () |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 "Return the first parent token of the current line that includes a location." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (save-excursion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (beginning-of-line) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 (let ((dep (if (looking-at "[0-9]+:") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (1- (string-to-number (match-string 0))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 0))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (re-search-backward (concat "^" |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (int-to-string dep) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 ":") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 nil t)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (beginning-of-line) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (if (looking-at "[0-9]+: +[-+][>()@|] \\([^\n]+\\)$") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (let ((prop nil)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (goto-char (match-beginning 1)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 (setq prop (get-text-property (point) 'speedbar-token)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (if (semantic-tag-with-position-p prop) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 prop |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (semantic-sb-detail-parent))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 nil))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (defun semantic-sb-show-extra (text token indent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 "Display additional information about the token as an expansion. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 TEXT TOKEN and INDENT are the details." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (cond ((string-match "+" text) ;we have to expand this file |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (speedbar-change-expand-button-char ?-) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 (speedbar-with-writable |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (save-excursion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 (end-of-line) (forward-char 1) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (save-restriction |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 (narrow-to-region (point) (point)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 ;; Add in stuff specific to this type of token. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 (semantic-sb-insert-details token (1+ indent)))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 ((string-match "-" text) ;we have to contract this node |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 (speedbar-change-expand-button-char ?+) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (speedbar-delete-subblock indent)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 (t (error "Ooops... not sure what to do"))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (speedbar-center-buffer-smartly)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (defun semantic-sb-token-jump (text token indent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 "Jump to the location specified in token. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 TEXT TOKEN and INDENT are the details." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (let ((file |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (or |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (cond ((fboundp 'speedbar-line-path) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 (speedbar-line-directory indent)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 ((fboundp 'speedbar-line-directory) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (speedbar-line-directory indent))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 ;; If speedbar cannot figure this out, extract the filename from |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 ;; the token. True for Analysis mode. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (semantic-tag-file-name token))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (parent (semantic-sb-detail-parent))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 (let ((f (selected-frame))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (dframe-select-attached-frame speedbar-frame) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (run-hooks 'speedbar-before-visiting-tag-hook) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (select-frame f)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 ;; Sometimes FILE may be nil here. If you are debugging a problem |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 ;; when this happens, go back and figure out why FILE is nil and try |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 ;; and fix the source. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (speedbar-find-file-in-frame file) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (save-excursion (speedbar-stealthy-updates)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (semantic-go-to-tag token parent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (switch-to-buffer (current-buffer)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 ;; Reset the timer with a new timeout when cliking a file |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 ;; in case the user was navigating directories, we can cancel |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 ;; that other timer. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 ;; (speedbar-set-timer dframe-update-speed) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 ;;(recenter) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 (speedbar-maybee-jump-to-attached-frame) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (run-hooks 'speedbar-visiting-tag-hook))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (defun semantic-sb-expand-group (text token indent) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 "Expand a group which has semantic tokens. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 TEXT TOKEN and INDENT are the details." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (cond ((string-match "+" text) ;we have to expand this file |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (speedbar-change-expand-button-char ?-) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (speedbar-with-writable |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (save-excursion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (end-of-line) (forward-char 1) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 (save-restriction |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (narrow-to-region (point-min) (point)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (semantic-sb-buttons-plain (1+ indent) token))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 ((string-match "-" text) ;we have to contract this node |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 (speedbar-change-expand-button-char ?+) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (speedbar-delete-subblock indent)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (t (error "Ooops... not sure what to do"))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 (speedbar-center-buffer-smartly)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 (defun semantic-sb-buttons-plain (level tokens) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 "Create buttons at LEVEL using TOKENS." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (let ((sordid (speedbar-create-tag-hierarchy tokens))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (while sordid |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (cond ((null (car-safe sordid)) nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 ((consp (car-safe (cdr-safe (car-safe sordid)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 ;; A group! |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (speedbar-make-tag-line 'curly ?+ 'semantic-sb-expand-group |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 (cdr (car sordid)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (car (car sordid)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 nil nil 'speedbar-tag-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 level)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (t ;; Assume that this is a token. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (semantic-sb-one-button (car sordid) level))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (setq sordid (cdr sordid))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (defun semantic-sb-insert-tag-table (level table) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 "At LEVEL, insert the tag table TABLE. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 Use arcane knowledge about the semantic tokens in the tagged elements |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 to create much wiser decisions about how to sort and group these items." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (semantic-sb-buttons level table)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (defun semantic-sb-buttons (level lst) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 "Create buttons at LEVEL using LST sorting into type buckets." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (save-restriction |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (narrow-to-region (point-min) (point)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (let (tmp) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (while lst |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (setq tmp (car lst)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (if (cdr tmp) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 (if (<= (length (cdr tmp)) semantic-sb-autoexpand-length) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (semantic-sb-buttons-plain (1+ level) (cdr tmp)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (speedbar-make-tag-line 'curly ?+ 'semantic-sb-expand-group |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (cdr tmp) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (car (car lst)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 nil nil 'speedbar-tag-face |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (1+ level)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (setq lst (cdr lst)))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (defun semantic-sb-fetch-tag-table (file) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 "Load FILE into a buffer, and generate tags using the Semantic parser. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 Returns the tag list, or t for an error." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (let ((out nil)) |
104446
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
385 (if (and (featurep 'semantic/db) |
df08b7ab0ba0
lisp/cedet/semantic/analyze.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
386 (semanticdb-minor-mode-p) |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (not speedbar-power-click) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 ;; If the database is loaded and running, try to get |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 ;; tokens from it. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (setq out (semanticdb-file-stream file))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 ;; Successful DB query. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 nil |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 ;; No database, do it the old way. |
105799
3fe6da4a95a9
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105377
diff
changeset
|
394 (with-current-buffer (find-file-noselect file) |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (if (or (not (featurep 'semantic)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 (not semantic--parse-table)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 (setq out t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (if speedbar-power-click (semantic-clear-toplevel-cache)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 (setq out (semantic-fetch-tags))))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (if (listp out) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (condition-case nil |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 (progn |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 ;; This brings externally defind methods into |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 ;; their classes, and creates meta classes for |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 ;; orphans. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 (setq out (semantic-adopt-external-members out)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 ;; Dump all the tokens into buckets. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 (semantic-sb-with-tag-buffer (car out) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 (semantic-bucketize out))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 (error t)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 t))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 ;; Link ourselves into the tagging process. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 (add-to-list 'speedbar-dynamic-tags-function-list |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 '(semantic-sb-fetch-tag-table . semantic-sb-insert-tag-table)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (provide 'semantic/sb) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 |
105377 | 419 ;; arch-tag: 82aa0570-9e27-41a3-a834-2641dbb2f829 |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 ;;; semantic/sb.el ends here |