annotate lisp/cedet/semantic/ia.el @ 106196:2721ecb2b07c

* cedet/semantic/ia.el (semantic-ia-completion-format-tag-function): Use semantic-format-tag-prototype.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 22 Nov 2009 23:09:17 +0000
parents 83dde921cc1b
children a72f79f89185
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
1 ;;; semantic/ia.el --- Interactive Analysis functions
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 ;;; 2008, 2009 Free Software Foundation, Inc.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Keywords: syntax
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; (at your option) any later version.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;; Commentary:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; Interactive access to `semantic-analyze'.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; These routines are fairly simple, and show how to use the Semantic
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; analyzer to provide things such as completion lists, summaries,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; locations, or documentation.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;;; TODO
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;; fast-jump. For a virtual method, offer some of the possible
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;; implementations in various sub-classes.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 (require 'semantic/analyze)
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
39 (require 'semantic/format)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (require 'pulse)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (eval-when-compile
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 (require 'semantic/analyze)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (require 'semantic/analyze/refs))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
45 (declare-function imenu--mouse-menu "imenu")
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
46
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 ;;; Code:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ;;; COMPLETION
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ;; This set of routines provides some simplisting completion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; functions.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 (defcustom semantic-ia-completion-format-tag-function
106196
2721ecb2b07c * cedet/semantic/ia.el (semantic-ia-completion-format-tag-function):
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
55 'semantic-format-tag-prototype
2721ecb2b07c * cedet/semantic/ia.el (semantic-ia-completion-format-tag-function):
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
56 "Function used to convert a tag to a string during completion."
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 :group 'semantic
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 :type semantic-format-tag-custom-list)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 (defvar semantic-ia-cache nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 "Cache of the last completion request.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 Of the form ( POINT . COMPLETIONS ) where POINT is a location in the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 buffer where the completion was requested. COMPLETONS is the list
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 of semantic tag names that provide logical completions from that
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 location.")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 (make-variable-buffer-local 'semantic-ia-cache)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
68 ;;; COMPLETION HELPER
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
69 ;;
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
70 ;; This overload function handles inserting a tag
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
71 ;; into a buffer for these local completion routines.
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
72 ;;
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
73 ;; By creating the functions as overloadable, it can be
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
74 ;; customized. For example, the default will put a paren "("
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
75 ;; character after function names. For Lisp, it might check
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
76 ;; to put a "(" in front of a function name.
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
77
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
78 (define-overloadable-function semantic-ia-insert-tag (tag)
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
79 "Insert TAG into the current buffer based on completion.")
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
80
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
81 (defun semantic-ia-insert-tag-default (tag)
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
82 "Insert TAG into the current buffer based on completion."
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
83 (insert (semantic-tag-name tag))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
84 (let ((tt (semantic-tag-class tag)))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
85 (cond ((eq tt 'function)
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
86 (insert "("))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
87 (t nil))))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
88
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
89 (declare-function semantic-analyze-possible-completions
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
90 "semantic/analyze/complete")
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
91
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (defun semantic-ia-get-completions (context point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 "Fetch the completion of CONTEXT at POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 Supports caching."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; Cache the current set of symbols so that we can get at
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 ;; them quickly the second time someone presses the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 ;; complete button.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 (let ((symbols
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (if (and semantic-ia-cache
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (= point (car semantic-ia-cache)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (cdr semantic-ia-cache)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (semantic-analyze-possible-completions context))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 ;; Set the cache
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (setq semantic-ia-cache (cons point symbols))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 symbols))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
107 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (defun semantic-ia-complete-symbol (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 "Complete the current symbol at POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 Completion options are calculated with `semantic-analyze-possible-completions'."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 ;; Calculating completions is a two step process.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 ;; The first analyzer the current context, which finds tags
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 ;; for all the stuff that may be references by the code around
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 ;; POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 ;; The second step derives completions from that context.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (let* ((a (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (syms (semantic-ia-get-completions a point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (pre (car (reverse (oref a prefix))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 ;; If PRE was actually an already completed symbol, it doesn't
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 ;; come in as a string, but as a tag instead.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (if (semantic-tag-p pre)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 ;; We will try completions on it anyway.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (setq pre (semantic-tag-name pre)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 ;; Complete this symbol.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (if (null syms)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (progn
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 ;(message "No smart completions found. Trying senator-complete-symbol.")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (if (semantic-analyze-context-p a)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 ;; This is a clever hack. If we were unable to find any
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 ;; smart completions, lets divert to how senator derives
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 ;; completions.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 ;; This is a way of making this fcn more useful since the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 ;; smart completion engine sometimes failes.
104522
2a2b8ae24b17 * cedet/semantic/symref/list.el: Require semantic/complete.
Chong Yidong <cyd@stupidchicken.com>
parents: 104461
diff changeset
139 (semantic-complete-symbol)))
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 ;; Use try completion to seek a common substring.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 (let ((tc (try-completion (or pre "") syms)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (if (and (stringp tc) (not (string= tc (or pre ""))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (let ((tok (semantic-find-first-tag-by-name
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 tc syms)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 ;; Delete what came before...
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (when (and (car (oref a bounds)) (cdr (oref a bounds)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (delete-region (car (oref a bounds))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (cdr (oref a bounds)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (goto-char (car (oref a bounds))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 ;; We have some new text. Stick it in.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (if tok
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (semantic-ia-insert-tag tok)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (insert tc)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 ;; We don't have new text. Show all completions.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (when (cdr (oref a bounds))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (goto-char (cdr (oref a bounds))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (with-output-to-temp-buffer "*Completions*"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (display-completion-list
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (mapcar semantic-ia-completion-format-tag-function syms))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 ))))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (defcustom semantic-ia-completion-menu-format-tag-function
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 'semantic-uml-concise-prototype-nonterminal
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 "*Function used to convert a tag to a string during completion."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 :group 'semantic
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 :type semantic-format-tag-custom-list)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 ;;; Completions Tip
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 ;; This functions shows how to get the list of completions,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 ;; to place in a tooltip. It doesn't actually do any completion.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
173 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 (defun semantic-ia-complete-tip (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 "Pop up a tooltip for completion at POINT."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (let* ((a (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 (syms (semantic-ia-get-completions a point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (x (mod (- (current-column) (window-hscroll))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (window-width)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (y (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 (save-restriction
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (widen)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (narrow-to-region (window-start) (point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 (goto-char (point-min))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (1+ (vertical-motion (buffer-size))))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (str (mapconcat #'semantic-tag-name
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 syms
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 "\n"))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (cond ((fboundp 'x-show-tip)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (x-show-tip str
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (selected-frame)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 x y)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (t (message str))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 ;;; Summary
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 ;; Like idle-summary-mode, this shows how to get something to
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 ;; show a summary on.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
206 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (defun semantic-ia-show-summary (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 "Display a summary for the symbol under POINT."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (interactive "P")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (let* ((ctxt (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (pf (when ctxt
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 ;; The CTXT is an EIEIO object. The below
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 ;; method will attempt to pick the most interesting
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 ;; tag associated with the current context.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (semantic-analyze-interesting-tag ctxt)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 (when pf
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (message "%s" (semantic-format-tag-summarize pf nil t)))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 ;;; FAST Jump
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 ;; Jump to a destination based on the local context.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 ;; This shows how to use the analyzer context, and the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 ;; analyer references objects to choose a good destination.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (defun semantic-ia--fast-jump-helper (dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 "Jump to DEST, a Semantic tag.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 This helper manages the mark, buffer switching, and pulsing."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 ;; We have a tag, but in C++, we usually get a prototype instead
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 ;; because of header files. Lets try to find the actual
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 ;; implementaion instead.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (when (semantic-tag-prototype-p dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (let* ((refs (semantic-analyze-tag-references dest))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (impl (semantic-analyze-refs-impl refs t))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (when impl (setq dest (car impl)))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 ;; Make sure we have a place to go...
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (if (not (and (or (semantic-tag-with-position-p dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 (semantic-tag-get-attribute dest :line))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (semantic-tag-file-name dest)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 (error "Tag %s has no buffer information"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (semantic-format-tag-name dest)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;; Once we have the tag, we can jump to it. Here
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 ;; are the key bits to the jump:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 ;; 1) Push the mark, so you can pop global mark back, or
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 ;; use semantic-mru-bookmark mode to do so.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 (push-mark)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (when (fboundp 'push-tag-mark)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (push-tag-mark))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 ;; 2) Visits the tag.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (semantic-go-to-tag dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 ;; 3) go-to-tag doesn't switch the buffer in the current window,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 ;; so it is like find-file-noselect. Bring it forward.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 (switch-to-buffer (current-buffer))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 ;; 4) Fancy pulsing.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (pulse-momentary-highlight-one-line (point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
263 (declare-function semantic-decoration-include-visit "semantic/decorate/include")
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
264
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
265 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 (defun semantic-ia-fast-jump (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 "Jump to the tag referred to by the code at POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 Uses `semantic-analyze-current-context' output to identify an accurate
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 origin of the code at point."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (let* ((ctxt (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (pf (and ctxt (reverse (oref ctxt prefix))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 ;; In the analyzer context, the PREFIX is the list of items
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 ;; that makes up the code context at point. Thus the c++ code
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 ;; this.that().theothe
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 ;; would make a list:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 ;; ( ("this" variable ..) ("that" function ...) "theothe")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 ;; Where the first two elements are the semantic tags of the prefix.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 ;; PF is the reverse of this list. If the first item is a string,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 ;; then it is an incomplete symbol, thus we pick the second.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 ;; The second cannot be a string, as that would have been an error.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (first (car pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (second (nth 1 pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (cond
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 ((semantic-tag-p first)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 ;; We have a match. Just go there.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (semantic-ia--fast-jump-helper first))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 ((semantic-tag-p second)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 ;; Because FIRST failed, we should visit our second tag.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 ;; HOWEVER, the tag we actually want that was only an unfound
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 ;; string may be related to some take in the datatype that belongs
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 ;; to SECOND. Thus, instead of visiting second directly, we
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 ;; can offer to find the type of SECOND, and go there.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 (let ((secondclass (car (reverse (oref ctxt prefixtypes)))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (cond
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 ((and (semantic-tag-with-position-p secondclass)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 (y-or-n-p (format "Could not find `%s'. Jump to %s? "
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 first (semantic-tag-name secondclass))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 (semantic-ia--fast-jump-helper secondclass)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 ;; If we missed out on the class of the second item, then
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 ;; just visit SECOND.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 ((and (semantic-tag-p second)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (y-or-n-p (format "Could not find `%s'. Jump to %s? "
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 first (semantic-tag-name second))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 (semantic-ia--fast-jump-helper second)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 ))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 ((semantic-tag-of-class-p (semantic-current-tag) 'include)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 ;; Just borrow this cool fcn.
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
314 (require 'semantic/decorate/include)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 (semantic-decoration-include-visit)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (t
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (error "Could not find suitable jump point for %s"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 first))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
323 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (defun semantic-ia-fast-mouse-jump (evt)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 "Jump to the tag referred to by the point clicked on.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 See `semantic-ia-fast-jump' for details on how it works.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 This command is meant to be bound to a mouse event."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (interactive "e")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (semantic-ia-fast-jump
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 (posn-set-point (event-end evt))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (point))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 ;;; DOC/DESCRIBE
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 ;; These routines show how to get additional information about a tag
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 ;; for purposes of describing or showing documentation about them.
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
338 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (defun semantic-ia-show-doc (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 "Display the code-level documentation for the symbol at POINT."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 (let* ((ctxt (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (pf (reverse (oref ctxt prefix)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 ;; If PF, the prefix is non-nil, then the last element is either
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 ;; a string (incomplete type), or a semantic TAG. If it is a TAG
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 ;; then we should be able to find DOC for it.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (cond
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 ((stringp (car pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (message "Incomplete symbol name."))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 ((semantic-tag-p (car pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 ;; The `semantic-documentation-for-tag' fcn is language
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 ;; specific. If it doesn't return what you expect, you may
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 ;; need to implement something for your language.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 ;; The default tries to find a comment in front of the tag
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 ;; and then strings off comment prefixes.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (let ((doc (semantic-documentation-for-tag (car pf))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 (with-output-to-temp-buffer "*TAG DOCUMENTATION*"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (princ "Tag: ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (princ (semantic-format-tag-prototype (car pf)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (princ "Snarfed Documentation: ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 (if doc
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 (princ doc)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 (princ " Documentation unavailable."))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 (t
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (message "Unknown tag.")))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 ))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
375 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (defun semantic-ia-describe-class (typename)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 "Display all known parts for the datatype TYPENAME.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 If the type in question is a class, all methods and other accessible
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 parts of the parent classes are displayed."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 ;; @todo - use a fancy completing reader.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 (interactive "sType Name: ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 ;; When looking for a tag of any name there are a couple ways to do
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 ;; it. The simple `semanticdb-find-tag-by-...' are simple, and
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 ;; you need to pass it the exact name you want.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 ;; The analyzer function `semantic-analyze-tag-name' will take
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 ;; more complex names, such as the cpp symbol foo::bar::baz,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 ;; and break it up, and dive through the namespaces.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 (let ((class (semantic-analyze-find-tag typename)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 (when (not (semantic-tag-p class))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 (error "Cannot find class %s" class))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 (with-output-to-temp-buffer "*TAG DOCUMENTATION*"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 ;; There are many semantic-format-tag-* fcns.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 ;; The summarize routine is a fairly generic one.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (princ (semantic-format-tag-summarize class))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (princ " Type Members:\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 ;; The type tag contains all the parts of the type.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 ;; In complex languages with inheritance, not all the
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 ;; parts are in the tag. This analyzer fcn will traverse
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 ;; the inheritance tree, and find all the pieces that
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 ;; are inherited.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (let ((parts (semantic-analyze-scoped-type-parts class)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (while parts
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (princ " ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (princ (semantic-format-tag-summarize (car parts)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 (setq parts (cdr parts)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (provide 'semantic/ia)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
416 ;; Local variables:
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
417 ;; generated-autoload-file: "loaddefs.el"
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
418 ;; generated-autoload-load-name: "semantic/ia"
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
419 ;; End:
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
420
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 104522
diff changeset
421 ;; arch-tag: ceeed1f2-e5b6-4f7c-a85a-a2f8ee0193ca
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
422 ;;; semantic/ia.el ends here