annotate lisp/cedet/semantic/ia.el @ 104461:c89254e41c98

lisp/cedet/semantic/ia.el: Add local vars for autoloading. (semantic-ia-complete-symbol, semantic-ia-complete-symbol-menu) (semantic-ia-complete-tip, semantic-ia-show-summary) (semantic-ia-fast-jump, semantic-ia-fast-mouse-jump) (semantic-ia-show-doc, semantic-ia-describe-class): Autoload.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 05 Sep 2009 23:20:52 +0000
parents 273e528a9f9b
children 2a2b8ae24b17
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
104424
3783a1145a65 cedet/semantic/ia.el: Don't require senator.
Chong Yidong <cyd@stupidchicken.com>
parents: 104420
diff changeset
38 ;; (require 'senator)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (require 'semantic/analyze)
104447
273e528a9f9b * emacs-lisp/autoload.el (generated-autoload-load-name): New var.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
40 (require 'semantic/format)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (require 'pulse)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 (eval-when-compile
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (require 'semantic/analyze)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (require 'semantic/analyze/refs))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
46 (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
47
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 ;;; Code:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 ;;; COMPLETION
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; 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
53 ;; functions.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 (defcustom semantic-ia-completion-format-tag-function
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 'semantic-prototype-nonterminal
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 "*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
58 :group 'semantic
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 :type semantic-format-tag-custom-list)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 (defvar semantic-ia-cache nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 "Cache of the last completion request.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 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
64 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
65 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
66 location.")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (make-variable-buffer-local 'semantic-ia-cache)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
69 ;;; COMPLETION HELPER
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
70 ;;
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
71 ;; 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
72 ;; 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
73 ;;
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
74 ;; 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
75 ;; 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
76 ;; 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
77 ;; 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
78
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
79 (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
80 "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
81
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
82 (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
83 "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
84 (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
85 (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
86 (cond ((eq tt 'function)
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
87 (insert "("))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
88 (t nil))))
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
89
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
90 (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
91 "semantic/analyze/complete")
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
92
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 (defun semantic-ia-get-completions (context point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 "Fetch the completion of CONTEXT at POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 Supports caching."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 ;; 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
97 ;; 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
98 ;; complete button.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (let ((symbols
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (if (and semantic-ia-cache
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (= point (car semantic-ia-cache)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (cdr semantic-ia-cache)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (semantic-analyze-possible-completions context))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 ;; Set the cache
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (setq semantic-ia-cache (cons point symbols))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 symbols))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
108 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (defun semantic-ia-complete-symbol (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 "Complete the current symbol at POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 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
112 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 ;; Calculating completions is a two step process.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 ;; 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
116 ;; 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
117 ;; POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 ;; 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
120 (let* ((a (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (syms (semantic-ia-get-completions a point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (pre (car (reverse (oref a prefix))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 ;; 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
125 ;; 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
126 (if (semantic-tag-p pre)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 ;; We will try completions on it anyway.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (setq pre (semantic-tag-name pre)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 ;; Complete this symbol.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (if (null syms)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (progn
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 ;(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
133 (if (semantic-analyze-context-p a)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 ;; 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
135 ;; 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
136 ;; completions.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 ;; 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
139 ;; smart completion engine sometimes failes.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (senator-complete-symbol)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 ))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 ;; 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
143 (let ((tc (try-completion (or pre "") syms)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (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
145 (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
146 tc syms)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 ;; Delete what came before...
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (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
149 (delete-region (car (oref a bounds))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (cdr (oref a bounds)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (goto-char (car (oref a bounds))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 ;; 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
153 (if tok
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (semantic-ia-insert-tag tok)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (insert tc)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 ;; 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
157 (when (cdr (oref a bounds))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (goto-char (cdr (oref a bounds))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (with-output-to-temp-buffer "*Completions*"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (display-completion-list
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (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
162 ))))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 (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
165 'semantic-uml-concise-prototype-nonterminal
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 "*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
167 :group 'semantic
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 :type semantic-format-tag-custom-list)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
170 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 (defun semantic-ia-complete-symbol-menu (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 "Complete the current symbol via a menu based at POINT.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 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
174 (interactive "d")
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
175 (require 'imenu)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (let* ((a (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (syms (semantic-ia-get-completions a point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 ;; Complete this symbol.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (if (not syms)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (progn
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 (message "No smart completions found. Trying Senator.")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (when (semantic-analyze-context-p a)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 ;; This is a quick way of getting a nice completion list
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 ;; in the menu if the regular context mechanism fails.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (senator-completion-menu-popup)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 (let* ((menu
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 (mapcar
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (lambda (tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (cons
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (funcall semantic-ia-completion-menu-format-tag-function tag)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (vector tag)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 syms))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (ans
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (imenu--mouse-menu
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 ;; XEmacs needs that the menu has at least 2 items. So,
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 ;; include a nil item that will be ignored by imenu.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (cons nil menu)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (senator-completion-menu-point-as-event)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 "Completions")))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 (when ans
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (if (not (semantic-tag-p ans))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (setq ans (aref (cdr ans) 0)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (delete-region (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
206 (semantic-ia-insert-tag ans))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 ))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 ;;; Completions Tip
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 ;; 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
212 ;; 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
213
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
214 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (defun semantic-ia-complete-tip (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 "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
217 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (let* ((a (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (syms (semantic-ia-get-completions a point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (x (mod (- (current-column) (window-hscroll))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (window-width)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (y (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (save-restriction
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (widen)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (narrow-to-region (window-start) (point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (goto-char (point-min))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (1+ (vertical-motion (buffer-size))))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (str (mapconcat #'semantic-tag-name
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 syms
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 "\n"))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (cond ((fboundp 'x-show-tip)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (x-show-tip str
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (selected-frame)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 nil
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 x y)
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 (t (message str))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 ;;; Summary
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 ;; 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
245 ;; show a summary on.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
247 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (defun semantic-ia-show-summary (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 "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
250 (interactive "P")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 (let* ((ctxt (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (pf (when ctxt
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 ;; 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
254 ;; 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
255 ;; tag associated with the current context.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 (semantic-analyze-interesting-tag ctxt)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 (when pf
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (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
260
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 ;;; FAST Jump
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 ;; 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
264 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 ;; 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
266 ;; 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
267
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (defun semantic-ia--fast-jump-helper (dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 "Jump to DEST, a Semantic tag.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 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
271 ;; 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
272 ;; 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
273 ;; implementaion instead.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (when (semantic-tag-prototype-p dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 (let* ((refs (semantic-analyze-tag-references dest))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (impl (semantic-analyze-refs-impl refs t))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (when impl (setq dest (car impl)))))
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 ;; 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
281 (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
282 (semantic-tag-get-attribute dest :line))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (semantic-tag-file-name dest)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (error "Tag %s has no buffer information"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (semantic-format-tag-name dest)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 ;; 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
288 ;; are the key bits to the jump:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 ;; 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
291 ;; 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
292 (push-mark)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 (when (fboundp 'push-tag-mark)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (push-tag-mark))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 ;; 2) Visits the tag.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (semantic-go-to-tag dest)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ;; 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
298 ;; 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
299 (switch-to-buffer (current-buffer))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 ;; 4) Fancy pulsing.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 (pulse-momentary-highlight-one-line (point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104424
diff changeset
304 (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
305
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
306 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (defun semantic-ia-fast-jump (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 "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
309 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
310 origin of the code at point."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 (let* ((ctxt (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 (pf (and ctxt (reverse (oref ctxt prefix))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 ;; 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
315 ;; 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
316 ;; this.that().theothe
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 ;; would make a list:
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 ;; ( ("this" variable ..) ("that" function ...) "theothe")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 ;; 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
320 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 ;; 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
322 ;; 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
323 ;; 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
324 (first (car pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 (second (nth 1 pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (cond
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 ((semantic-tag-p first)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 ;; We have a match. Just go there.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (semantic-ia--fast-jump-helper first))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 ((semantic-tag-p second)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 ;; 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
334 ;; 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
335 ;; 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
336 ;; 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
337 ;; 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
338 (let ((secondclass (car (reverse (oref ctxt prefixtypes)))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (cond
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 ((and (semantic-tag-with-position-p secondclass)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (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
342 first (semantic-tag-name secondclass))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (semantic-ia--fast-jump-helper secondclass)
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 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
346 ;; just visit SECOND.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 ((and (semantic-tag-p second)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (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
349 first (semantic-tag-name second))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (semantic-ia--fast-jump-helper second)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 ))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 ((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
354 ;; 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
355 (require 'semantic/decorate/include)
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (semantic-decoration-include-visit)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 (t
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (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
361 first))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
364 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (defun semantic-ia-fast-mouse-jump (evt)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 "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
367 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
368 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
369 (interactive "e")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (semantic-ia-fast-jump
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 (save-excursion
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (posn-set-point (event-end evt))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 (point))))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 ;;; DOC/DESCRIBE
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 ;; 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
378 ;; 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
379 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 (defun semantic-ia-show-doc (point)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 "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
382 (interactive "d")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 (let* ((ctxt (semantic-analyze-current-context point))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 (pf (reverse (oref ctxt prefix)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 ;; 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
387 ;; 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
388 ;; 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
389 (cond
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 ((stringp (car pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 (message "Incomplete symbol name."))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 ((semantic-tag-p (car pf))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 ;; 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
394 ;; 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
395 ;; need to implement something for your language.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 ;; 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
398 ;; and then strings off comment prefixes.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (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
400 (with-output-to-temp-buffer "*TAG DOCUMENTATION*"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (princ "Tag: ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (princ (semantic-format-tag-prototype (car pf)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (princ "Snarfed Documentation: ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (if doc
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (princ doc)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 (princ " Documentation unavailable."))
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 (t
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (message "Unknown tag.")))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 ))
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 ;;;###autoload
104420
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 (defun semantic-ia-describe-class (typename)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 "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
419 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
420 parts of the parent classes are displayed."
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 ;; @todo - use a fancy completing reader.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 (interactive "sType Name: ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 ;; 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
425 ;; 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
426 ;; 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
427 ;;
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 ;; 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
429 ;; 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
430 ;; 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
431 (let ((class (semantic-analyze-find-tag typename)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (when (not (semantic-tag-p class))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (error "Cannot find class %s" class))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (with-output-to-temp-buffer "*TAG DOCUMENTATION*"
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 ;; There are many semantic-format-tag-* fcns.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 ;; 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
438 (princ (semantic-format-tag-summarize class))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (princ " Type Members:\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 ;; 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
442 ;; 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
443 ;; 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
444 ;; 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
445 ;; are inherited.
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 (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
447 (while parts
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 (princ " ")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 (princ (semantic-format-tag-summarize (car parts)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 (princ "\n")
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 (setq parts (cdr parts)))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 )
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 )))
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 (provide 'semantic/ia)
2e15afd37998 cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456
104461
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
457 ;; Local variables:
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
458 ;; 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
459 ;; generated-autoload-feature: semantic/loaddefs
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
460 ;; 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
461 ;; End:
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
462
c89254e41c98 lisp/cedet/semantic/ia.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104447
diff changeset
463 ;;; semantic/ia.el ends here