annotate lisp/cedet/semantic/complete.el @ 112450:16ddab338c43

Remove HAVE_RAW_DECL_CHOWN etc. from config.h
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 23 Jan 2011 20:53:39 -0800
parents ef719132ddfa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1 ;;; semantic/complete.el --- Routines for performing tag completion
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 110523
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
4 ;; Free Software Foundation, Inc.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Keywords: syntax
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; (at your option) any later version.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;; Commentary:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; Completion of tags by name using tables of semantic generated tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; While it would be a simple matter of flattening all tag known
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; tables to perform completion across them using `all-completions',
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; or `try-completion', that process would be slow. In particular,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; when a system database is included in the mix, the potential for a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;; ludicrous number of options becomes apparent.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;; As such, dynamically searching across tables using a prefix,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;; regular expression, or other feature is needed to help find symbols
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;; quickly without resorting to "show me every possible option now".
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 ;; In addition, some symbol names will appear in multiple locations.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
39 ;; If it is important to distinguish, then a way to provide a choice
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 ;; over these locations is important as well.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;; Beyond brute force offers for completion of plain strings,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 ;; using the smarts of semantic-analyze to provide reduced lists of
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 ;; symbols, or fancy tabbing to zoom into files to show multiple hits
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 ;; of the same name can be provided.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 ;;; How it works:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ;; There are several parts of any completion engine. They are:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ;; A. Collection of possible hits
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; B. Typing or selecting an option
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 ;; C. Displaying possible unique completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 ;; D. Using the result
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 ;; Here, we will treat each section separately (excluding D)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 ;; They can then be strung together in user-visible commands to
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
58 ;; fulfil specific needs.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 ;; COLLECTORS:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 ;; A collector is an object which represents the means by which tags
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 ;; to complete on are collected. It's first job is to find all the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 ;; tags which are to be completed against. It can also rename
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 ;; some tags if needed so long as `semantic-tag-clone' is used.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 ;; Some collectors will gather all tags to complete against first
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 ;; (for in buffer queries, or other small list situations). It may
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 ;; choose to do a broad search on each completion request. Built in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 ;; functionality automatically focuses the cache in as the user types.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 ;; A collector choosing to create and rename tags could choose a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 ;; plain name format, a postfix name such as method:class, or a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 ;; prefix name such as class.method.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 ;; DISPLAYORS
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 ;; A displayor is in charge if showing the user interesting things
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 ;; about available completions, and can optionally provide a focus.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ;; The simplest display just lists all available names in a separate
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 ;; window. It may even choose to show short names when there are
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 ;; many to choose from, or long names when there are fewer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 ;; A complex displayor could opt to help the user 'focus' on some
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 ;; range. For example, if 4 tags all have the same name, subsequent
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 ;; calls to the displayor may opt to show each tag one at a time in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 ;; the buffer. When the user likes one, selection would cause the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 ;; 'focus' item to be selected.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;; CACHE FORMAT
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 ;; The format of the tag lists used to perform the completions are in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 ;; semanticdb "find" format, like this:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; ( ( DBTABLE1 TAG1 TAG2 ...)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 ;; ( DBTABLE2 TAG1 TAG2 ...)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 ;; ... )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 ;; INLINE vs MINIBUFFER
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 ;; Two major ways completion is used in Emacs is either through a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 ;; minibuffer query, or via completion in a normal editing buffer,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 ;; encompassing some small range of characters.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 ;; Structure for both types of completion are provided here.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 ;; `semantic-complete-read-tag-engine' will use the minibuffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 ;; `semantic-complete-inline-tag-engine' will complete text in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 ;; a buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109
105652
51bc239bdc37 * cedet/srecode/srt.el:
Chong Yidong <cyd@stupidchicken.com>
parents: 105377
diff changeset
110 (eval-when-compile (require 'cl))
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104493
diff changeset
111 (require 'semantic)
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
112 (require 'eieio-opt)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (require 'semantic/analyze)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (require 'semantic/ctxt)
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
115 (require 'semantic/decorate)
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
116 (require 'semantic/format)
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
117
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
118 (eval-when-compile
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
119 ;; For the semantic-find-tags-for-completion macro.
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
120 (require 'semantic/find))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 ;;; Code:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (defvar semantic-complete-inline-overlay nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 "The overlay currently active while completing inline.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (defun semantic-completion-inline-active-p ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 "Non-nil if inline completion is active."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (when (and semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (not (semantic-overlay-live-p semantic-complete-inline-overlay)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (semantic-overlay-delete semantic-complete-inline-overlay)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (setq semantic-complete-inline-overlay nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 semantic-complete-inline-overlay)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 ;;; MINIBUFFER or INLINE utils
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (defun semantic-completion-text ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 "Return the text that is currently in the completion buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 For a minibuffer prompt, this is the minibuffer text.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 For inline completion, this is the text wrapped in the inline completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 overlay."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (if semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (semantic-complete-inline-text)
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104493
diff changeset
145 (minibuffer-contents)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (defun semantic-completion-delete-text ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 "Delete the text that is actively being completed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 Presumably if you call this you will insert something new there."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (if semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (semantic-complete-inline-delete-text)
105260
bbd7017a25d9 CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents: 104493
diff changeset
152 (delete-minibuffer-contents)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (defun semantic-completion-message (fmt &rest args)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 "Display the string FMT formatted with ARGS at the end of the minibuffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (if semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (apply 'message fmt args)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (message (concat (buffer-string) (apply 'format fmt args)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 ;;; MINIBUFFER: Option Selection harnesses
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (defvar semantic-completion-collector-engine nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 "The tag collector for the current completion operation.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 Value should be an object of a subclass of
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 `semantic-completion-engine-abstract'.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 (defvar semantic-completion-display-engine nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 "The tag display engine for the current completion operation.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 Value should be a ... what?")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 (defvar semantic-complete-key-map
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 (let ((km (make-sparse-keymap)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 (define-key km " " 'semantic-complete-complete-space)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (define-key km "\t" 'semantic-complete-complete-tab)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (define-key km "\C-m" 'semantic-complete-done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (define-key km "\C-g" 'abort-recursive-edit)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 (define-key km "\M-n" 'next-history-element)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (define-key km "\M-p" 'previous-history-element)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (define-key km "\C-n" 'next-history-element)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (define-key km "\C-p" 'previous-history-element)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 ;; Add history navigation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 km)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 "Keymap used while completing across a list of tags.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (defvar semantic-completion-default-history nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 "Default history variable for any unhistoried prompt.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 Keeps STRINGS only in the history.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (defun semantic-complete-read-tag-engine (collector displayor prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 default-tag initial-input
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 "Read a semantic tag, and return a tag for the selection.
106860
4cf58c2379f4 Mario Lang <mlang@delysid.org>: Remove some duplicated words.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
195 Argument COLLECTOR is an object which can be used to calculate
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 a list of possible hits. See `semantic-completion-collector-engine'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 for details on COLLECTOR.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
198 Argument DISPLAYOR is an object used to display a list of possible
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 completions for a given prefix. See`semantic-completion-display-engine'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 for details on DISPLAYOR.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 PROMPT is a string to prompt with.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 DEFAULT-TAG is a semantic tag or string to use as the default value.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 HISTORY is a symbol representing a variable to story the history in."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (let* ((semantic-completion-collector-engine collector)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (semantic-completion-display-engine displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (semantic-complete-active-default nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (semantic-complete-current-matched-tag nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (default-as-tag (semantic-complete-default-to-tag default-tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (default-as-string (when (semantic-tag-p default-as-tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (semantic-tag-name default-as-tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 (when default-as-string
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 ;; Add this to the prompt.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 ;; I really want to add a lookup of the symbol in those
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 ;; tags available to the collector and only add it if it
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 ;; is available as a possibility, but I'm too lazy right
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 ;; now.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 ;; @todo - move from () to into the editable area
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (if (string-match ":" prompt)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (setq prompt (concat
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (substring prompt 0 (match-beginning 0))
106188
ac73aedf0825 * cedet/semantic/complete.el (semantic-complete-read-tag-engine)
Chong Yidong <cyd@stupidchicken.com>
parents: 106165
diff changeset
227 " (default " default-as-string ")"
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (substring prompt (match-beginning 0))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (setq prompt (concat prompt " (" default-as-string "): "))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 ;; Perform the Completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (unwind-protect
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (read-from-minibuffer prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 initial-input
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 semantic-complete-key-map
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 (or history
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 'semantic-completion-default-history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 default-tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 (semantic-collector-cleanup semantic-completion-collector-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (semantic-displayor-cleanup semantic-completion-display-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 ;; Extract the tag from the completion machinery.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 semantic-complete-current-matched-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 ;;; Util for basic completion prompts
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (defvar semantic-complete-active-default nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 "The current default tag calculated for this prompt.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 (defun semantic-complete-default-to-tag (default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 "Convert a calculated or passed in DEFAULT into a tag."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (if (semantic-tag-p default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 ;; Just return what was passed in.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 (setq semantic-complete-active-default default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 ;; If none was passed in, guess.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (if (null default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (setq default (semantic-ctxt-current-thing)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 (if (null default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 ;; Do nothing
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 ;; Turn default into something useful.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 (let ((str
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 ;; Semantic-ctxt-current-symbol will return a list of
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 ;; strings. Technically, we should use the analyzer to
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 ;; fully extract what we need, but for now, just grab the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 ;; first string
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 ((and (listp default) (stringp (car default)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (car default))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 ((stringp default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 ((symbolp default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 (symbol-name default))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 (signal 'wrong-type-argument
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (list default 'semantic-tag-p)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (tag nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 ;; Now that we have that symbol string, look it up using the active
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 ;; collector. If we get a match, use it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (semantic-collector-calculate-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 semantic-completion-collector-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 str nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 ;; Do we have the perfect match???
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 (let ((ml (semantic-collector-current-exact-match
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 semantic-completion-collector-engine)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (when ml
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 ;; We don't care about uniqueness. Just guess for convenience
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (setq tag (semanticdb-find-result-nth-in-buffer ml 0))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ;; save it
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (setq semantic-complete-active-default tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 ;; Return it.. .whatever it may be
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 tag))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 ;;; Prompt Return Value
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 ;; Getting a return value out of this completion prompt is a bit
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 ;; challenging. The read command returns the string typed in.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 ;; We need to convert this into a valid tag. We can exit the minibuffer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 ;; for different reasons. If we purposely exit, we must make sure
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 ;; the focused tag is calculated... preferably once.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 (defvar semantic-complete-current-matched-tag nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 "Variable used to pass the tags being matched to the prompt.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
313 ;; semantic-displayor-focus-abstract-child-p is part of the
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
314 ;; semantic-displayor-focus-abstract class, defined later in this
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
315 ;; file.
105279
6969c5b2e0b2 Mark declarations not understood by check-declare.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
316 (declare-function semantic-displayor-focus-abstract-child-p "semantic/complete"
6969c5b2e0b2 Mark declarations not understood by check-declare.
Glenn Morris <rgm@gnu.org>
parents: 105260
diff changeset
317 t t)
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
318
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (defun semantic-complete-current-match ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 "Calculate a match from the current completion environment.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 Save this in our completion variable. Make sure that variable
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 is cleared if any other keypress is made.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 Return value can be:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 tag - a single tag that has been matched.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 string - a message to show in the minibuffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 ;; Query the environment for an active completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (let ((collector semantic-completion-collector-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (displayor semantic-completion-display-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (contents (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 matchlist
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 answer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (if (string= contents "")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 ;; The user wants the defaults!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (setq answer semantic-complete-active-default)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 ;; This forces a full calculation of completion on CR.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 (semantic-collector-calculate-completions collector contents nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (semantic-complete-try-completion)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 ;; Input match displayor focus entry
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 ((setq answer (semantic-displayor-current-focus displayor))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 ;; We have answer, continue
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 ;; One match from the collector
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 ((setq matchlist (semantic-collector-current-exact-match collector))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 (if (= (semanticdb-find-result-length matchlist) 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (setq answer (semanticdb-find-result-nth-in-buffer matchlist 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (if (semantic-displayor-focus-abstract-child-p displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 ;; For focusing displayors, we can claim this is
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 ;; not unique. Multiple focuses can choose the correct
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 ;; one.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (setq answer "Not Unique")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 ;; If we don't have a focusing displayor, we need to do something
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 ;; graceful. First, see if all the matches have the same name.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 (let ((allsame t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (firstname (semantic-tag-name
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 (car
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (semanticdb-find-result-nth matchlist 0)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (cnt 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (max (semanticdb-find-result-length matchlist)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (while (and allsame (< cnt max))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (if (not (string=
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 firstname
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (semantic-tag-name
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 (car
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 (semanticdb-find-result-nth matchlist cnt)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 (setq allsame nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 (setq cnt (1+ cnt))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 ;; Now we know if they are all the same. If they are, just
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 ;; accept the first, otherwise complain.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 (if allsame
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (setq answer (semanticdb-find-result-nth-in-buffer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 matchlist 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (setq answer "Not Unique"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 ;; No match
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 (setq answer "No Match")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 ;; Set it into our completion target.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 (when (semantic-tag-p answer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 (setq semantic-complete-current-matched-tag answer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 ;; Make sure it is up to date by clearing it if the user dares
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 ;; to touch the keyboard.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 (add-hook 'pre-command-hook
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 (lambda () (setq semantic-complete-current-matched-tag nil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 ;; Return it
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 answer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 ;;; Keybindings
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 ;;
106860
4cf58c2379f4 Mario Lang <mlang@delysid.org>: Remove some duplicated words.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
397 ;; Keys are bound to perform completion using our mechanisms.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 ;; Do that work here.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (defun semantic-complete-done ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 "Accept the current input."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (let ((ans (semantic-complete-current-match)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 (if (stringp ans)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (semantic-completion-message (concat " [" ans "]"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (exit-minibuffer)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (defun semantic-complete-complete-space ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 "Complete the partial input in the minibuffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (semantic-complete-do-completion t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (defun semantic-complete-complete-tab ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 "Complete the partial input in the minibuffer as far as possible."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 (semantic-complete-do-completion))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 ;;; Completion Functions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 ;; Thees routines are functional entry points to performing completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 (defun semantic-complete-hack-word-boundaries (original new)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 "Return a string to use for completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 ORIGINAL is the text in the minibuffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 NEW is the new text to insert into the minibuffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 Within the difference bounds of ORIGINAL and NEW, shorten NEW
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 to the nearest word boundary, and return that."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 (save-match-data
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (let* ((diff (substring new (length original)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 (end (string-match "\\>" diff))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 (start (string-match "\\<" diff)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 ((and start (> start 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 ;; If start is greater than 0, include only the new
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 ;; white-space stuff
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 (concat original (substring diff 0 start)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (end
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 (concat original (substring diff 0 end)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 (t new)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 (defun semantic-complete-try-completion (&optional partial)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 "Try a completion for the current minibuffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 If PARTIAL, do partial completion stopping at spaces."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (let ((comp (semantic-collector-try-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 semantic-completion-collector-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 (semantic-completion-text))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 ((null comp)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 (semantic-completion-message " [No Match]")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 (ding)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 ((stringp comp)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 (if (string= (semantic-completion-text) comp)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 (when partial
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 ;; Minibuffer isn't changing AND the text is not unique.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 ;; Test for partial completion over a word separator character.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 ;; If there is one available, use that so that SPC can
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 ;; act like a SPC insert key.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 (let ((newcomp (semantic-collector-current-whitespace-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 semantic-completion-collector-engine)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (when newcomp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (semantic-completion-delete-text)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 (insert newcomp))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (when partial
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 (let ((orig (semantic-completion-text)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 ;; For partial completion, we stop and step over
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 ;; word boundaries. Use this nifty function to do
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 ;; that calculation for us.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 (setq comp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 (semantic-complete-hack-word-boundaries orig comp))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 ;; Do the replacement.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 (semantic-completion-delete-text)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 (insert comp))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 ((and (listp comp) (semantic-tag-p (car comp)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 (unless (string= (semantic-completion-text)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 (semantic-tag-name (car comp)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 ;; A fully unique completion was available.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 (semantic-completion-delete-text)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 (insert (semantic-tag-name (car comp))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 ;; The match is complete
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 (if (= (length comp) 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 (semantic-completion-message " [Complete]")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (semantic-completion-message " [Complete, but not unique]"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 (t nil))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (defun semantic-complete-do-completion (&optional partial inline)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 "Do a completion for the current minibuffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 If PARTIAL, do partial completion stopping at spaces.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 if INLINE, then completion is happening inline in a buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 (let* ((collector semantic-completion-collector-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 (displayor semantic-completion-display-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 (contents (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 (ans nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 (semantic-collector-calculate-completions collector contents partial))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 (let* ((na (semantic-complete-next-action partial)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 ;; We're all done, but only from a very specific
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 ;; area of completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 ((eq na 'done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 (semantic-completion-message " [Complete]")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 (setq ans 'done))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 ;; Perform completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 ((or (eq na 'complete)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 (eq na 'complete-whitespace))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 (semantic-complete-try-completion partial)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 (setq ans 'complete))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 ;; We need to display the completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 ;; Set the completions into the display engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 ((or (eq na 'display) (eq na 'displayend))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (semantic-displayor-set-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 displayor
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 (or
106431
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
518 ;; For the below - This caused problems for Chong Yidong
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
519 ;; when experimenting with the completion engine. I don't
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
520 ;; remember what the problem was though, and I wasn't sure why
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
521 ;; the below two lines were there since they obviously added
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
522 ;; some odd behavior. -EML
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
523 ;; (and (not (eq na 'displayend))
4ffa662ec661 * cedet/semantic/bovine/c.el (semantic-c-describe-environment):
Chong Yidong <cyd@stupidchicken.com>
parents: 106197
diff changeset
524 ;; (semantic-collector-current-exact-match collector))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (semantic-collector-all-completions collector contents))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 contents)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 ;; Ask the displayor to display them.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 (semantic-displayor-show-request displayor))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 ((eq na 'scroll)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 (semantic-displayor-scroll-request displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 ((eq na 'focus)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 (semantic-displayor-focus-next displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 (semantic-displayor-focus-request displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 ((eq na 'empty)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 (semantic-completion-message " [No Match]"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (t nil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 ans))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 ;;; INLINE: tag completion harness
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 ;; Unlike the minibuffer, there is no mode nor other traditional
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 ;; means of reading user commands in completion mode. Instead
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 ;; we use a pre-command-hook to inset in our commands, and to
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 ;; push ourselves out of this mode on alternate keypresses.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 (defvar semantic-complete-inline-map
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 (let ((km (make-sparse-keymap)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 (define-key km "\C-i" 'semantic-complete-inline-TAB)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 (define-key km "\M-p" 'semantic-complete-inline-up)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 (define-key km "\M-n" 'semantic-complete-inline-down)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 (define-key km "\C-m" 'semantic-complete-inline-done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 (define-key km "\C-\M-c" 'semantic-complete-inline-exit)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 (define-key km "\C-g" 'semantic-complete-inline-quit)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (define-key km "?"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (lambda () (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (describe-variable 'semantic-complete-inline-map)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 km)
106165
0a1b5bffcd05 * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
Chong Yidong <cyd@stupidchicken.com>
parents: 105842
diff changeset
561 "Keymap used while performing Semantic inline completion.")
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 (defface semantic-complete-inline-face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 '((((class color) (background dark))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 (:underline "yellow"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 (((class color) (background light))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 (:underline "brown")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568 "*Face used to show the region being completed inline.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 The face is used in `semantic-complete-inline-tag-engine'."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 :group 'semantic-faces)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 (defun semantic-complete-inline-text ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 "Return the text that is being completed inline.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 Similar to `minibuffer-contents' when completing in the minibuffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 (let ((s (semantic-overlay-start semantic-complete-inline-overlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 (e (semantic-overlay-end semantic-complete-inline-overlay)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 (if (= s e)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 ""
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 (buffer-substring-no-properties s e ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 (defun semantic-complete-inline-delete-text ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 "Delete the text currently being completed in the current buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 (delete-region
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 (semantic-overlay-start semantic-complete-inline-overlay)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 (semantic-overlay-end semantic-complete-inline-overlay)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (defun semantic-complete-inline-done ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 "This completion thing is DONE, OR, insert a newline."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 (let* ((displayor semantic-completion-display-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 (tag (semantic-displayor-current-focus displayor)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (if tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 (let ((txt (semantic-completion-text)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 (insert (substring (semantic-tag-name tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 (length txt)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 (semantic-complete-inline-exit))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 ;; Get whatever binding RET usually has.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 (let ((fcn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 (lookup-key (current-active-maps) (this-command-keys))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602 (error
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603 ;; I don't know why, but for some reason the above
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 ;; throws an error sometimes.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605 (lookup-key (current-global-map) (this-command-keys))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 (when fcn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
608 (funcall fcn)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 (defun semantic-complete-inline-quit ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 "Quit an inline edit."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 (semantic-complete-inline-exit)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 (keyboard-quit))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
616
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 (defun semantic-complete-inline-exit ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 "Exit inline completion mode."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 ;; Remove this hook FIRST!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 (remove-hook 'pre-command-hook 'semantic-complete-pre-command-hook)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625 (when semantic-completion-collector-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 (semantic-collector-cleanup semantic-completion-collector-engine))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 (when semantic-completion-display-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 (semantic-displayor-cleanup semantic-completion-display-engine))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 (when semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 (let ((wc (semantic-overlay-get semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632 'window-config-start))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 (buf (semantic-overlay-buffer semantic-complete-inline-overlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 (semantic-overlay-delete semantic-complete-inline-overlay)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 (setq semantic-complete-inline-overlay nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637 ;; DONT restore the window configuration if we just
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 ;; switched windows!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 (when (eq buf (current-buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640 (set-window-configuration wc))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 (setq semantic-completion-collector-engine nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 semantic-completion-display-engine nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 (error nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 ;; Remove this hook LAST!!!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 ;; This will force us back through this function if there was
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 ;; some sort of error above.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 (remove-hook 'post-command-hook 'semantic-complete-post-command-hook)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 ;;(message "Exiting inline completion.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655 (defun semantic-complete-pre-command-hook ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 "Used to redefine what commands are being run while completing.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 When installed as a `pre-command-hook' the special keymap
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 `semantic-complete-inline-map' is queried to replace commands normally run.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 Commands which edit what is in the region of interest operate normally.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 Commands which would take us out of the region of interest, or our
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 quit hook, will exit this completion mode."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (let ((fcn (lookup-key semantic-complete-inline-map
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (this-command-keys) nil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (cond ((commandp fcn)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 (setq this-command fcn))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 (t nil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 (defun semantic-complete-post-command-hook ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 "Used to determine if we need to exit inline completion mode.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 If completion mode is active, check to see if we are within
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 the bounds of `semantic-complete-inline-overlay', or within
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 a reasonable distance."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 ;; Exit if something bad happened.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 (if (not semantic-complete-inline-overlay)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 ;;(message "Inline Hook installed, but overlay deleted.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 (semantic-complete-inline-exit))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 ;; Exit if commands caused us to exit the area of interest
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 (let ((s (semantic-overlay-start semantic-complete-inline-overlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (e (semantic-overlay-end semantic-complete-inline-overlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 (b (semantic-overlay-buffer semantic-complete-inline-overlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 (txt nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 ;; EXIT when we are no longer in a good place.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 ((or (not (eq b (current-buffer)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 (< (point) s)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 (> (point) e))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 ;;(message "Exit: %S %S %S" s e (point))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 (semantic-complete-inline-exit)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 ;; Exit if the user typed in a character that is not part
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695 ;; of the symbol being completed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696 ((and (setq txt (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 (not (string= txt ""))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 (and (/= (point) s)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 (forward-char -1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701 (not (looking-at "\\(\\w\\|\\s_\\)")))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702 ;;(message "Non symbol character.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703 (semantic-complete-inline-exit))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704 ((lookup-key semantic-complete-inline-map
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705 (this-command-keys) nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706 ;; If the last command was one of our completion commands,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707 ;; then do nothing.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
708 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
709 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 ;; Else, show completions now
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 (semantic-complete-inline-force-display)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 ))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
715 ;; If something goes terribly wrong, clean up after ourselves.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (error (semantic-complete-inline-exit))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
717
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718 (defun semantic-complete-inline-force-display ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 "Force the display of whatever the current completions are.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
720 DO NOT CALL THIS IF THE INLINE COMPLETION ENGINE IS NOT ACTIVE."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
721 (condition-case e
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722 (save-excursion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 (let ((collector semantic-completion-collector-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 (displayor semantic-completion-display-engine)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
725 (contents (semantic-completion-text)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
726 (when collector
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727 (semantic-collector-calculate-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 collector contents nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 (semantic-displayor-set-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 displayor
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 (semantic-collector-all-completions collector contents)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 contents)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 ;; Ask the displayor to display them.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (semantic-displayor-show-request displayor))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
735 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 (error (message "Bug Showing Completions: %S" e))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 (defun semantic-complete-inline-tag-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739 (collector displayor buffer start end)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 "Perform completion based on semantic tags in a buffer.
106860
4cf58c2379f4 Mario Lang <mlang@delysid.org>: Remove some duplicated words.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
741 Argument COLLECTOR is an object which can be used to calculate
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742 a list of possible hits. See `semantic-completion-collector-engine'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 for details on COLLECTOR.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
744 Argument DISPLAYOR is an object used to display a list of possible
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 completions for a given prefix. See`semantic-completion-display-engine'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
746 for details on DISPLAYOR.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
747 BUFFER is the buffer in which completion will take place.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
748 START is a location for the start of the full symbol.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
749 If the symbol being completed is \"foo.ba\", then START
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
750 is on the \"f\" character.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
751 END is at the end of the current symbol being completed."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
752 ;; Set us up for doing completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
753 (setq semantic-completion-collector-engine collector
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
754 semantic-completion-display-engine displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755 ;; Create an overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756 (setq semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
757 (semantic-make-overlay start end buffer nil t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758 (semantic-overlay-put semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759 'face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760 'semantic-complete-inline-face)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 (semantic-overlay-put semantic-complete-inline-overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762 'window-config-start
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763 (current-window-configuration))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764 ;; Install our command hooks
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765 (add-hook 'pre-command-hook 'semantic-complete-pre-command-hook)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766 (add-hook 'post-command-hook 'semantic-complete-post-command-hook)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 ;; Go!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768 (semantic-complete-inline-force-display)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771 ;;; Inline Completion Keymap Functions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 (defun semantic-complete-inline-TAB ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774 "Perform inline completion."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
775 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
776 (let ((cmpl (semantic-complete-do-completion nil t)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778 ((eq cmpl 'complete)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
779 (semantic-complete-inline-force-display))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780 ((eq cmpl 'done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781 (semantic-complete-inline-done))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
782 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
785 (defun semantic-complete-inline-down()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786 "Focus forwards through the displayor."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
788 (let ((displayor semantic-completion-display-engine))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
789 (semantic-displayor-focus-next displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
790 (semantic-displayor-focus-request displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
791 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
792
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
793 (defun semantic-complete-inline-up ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
794 "Focus backwards through the displayor."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
795 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
796 (let ((displayor semantic-completion-display-engine))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
797 (semantic-displayor-focus-previous displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
798 (semantic-displayor-focus-request displayor)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
799 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
800
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
801
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
802 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
803 ;;; Interactions between collection and displaying
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
804 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
805 ;; Functional routines used to help collectors communicate with
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
806 ;; the current displayor, or for the previous section.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
807
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
808 (defun semantic-complete-next-action (partial)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
809 "Determine what the next completion action should be.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
810 PARTIAL is non-nil if we are doing partial completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
811 First, the collector can determine if we should perform a completion or not.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
812 If there is nothing to complete, then the displayor determines if we are
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
813 to show a completion list, scroll, or perhaps do a focus (if it is capable.)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
814 Expected return values are:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
815 done -> We have a singular match
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
816 empty -> There are no matches to the current text
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
817 complete -> Perform a completion action
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
818 complete-whitespace -> Complete next whitespace type character.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
819 display -> Show the list of completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
820 scroll -> The completions have been shown, and the user keeps hitting
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
821 the complete button. If possible, scroll the completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
822 focus -> The displayor knows how to shift focus among possible completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
823 Let it do that.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
824 displayend -> Whatever options the displayor had for repeating options, there
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
825 are none left. Try something new."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
826 (let ((ans1 (semantic-collector-next-action
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
827 semantic-completion-collector-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
828 partial))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
829 (ans2 (semantic-displayor-next-action
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
830 semantic-completion-display-engine))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
831 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
832 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
833 ;; No collector answer, use displayor answer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
834 ((not ans1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
835 ans2)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
836 ;; Displayor selection of 'scroll, 'display, or 'focus trumps
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
837 ;; 'done
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
838 ((and (eq ans1 'done) ans2)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
839 ans2)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
840 ;; Use ans1 when we have it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
841 (t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
842 ans1))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
843
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
844
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
845
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
846 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
847 ;;; Collection Engines
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
848 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
849 ;; Collection engines can scan tags from the current environment and
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
850 ;; provide lists of possible completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
851 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
852 ;; General features of the abstract collector:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
853 ;; * Cache completion lists between uses
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
854 ;; * Cache itself per buffer. Handle reparse hooks
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
855 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
856 ;; Key Interface Functions to implement:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
857 ;; * semantic-collector-next-action
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
858 ;; * semantic-collector-calculate-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
859 ;; * semantic-collector-try-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
860 ;; * semantic-collector-all-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
861
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
862 (defvar semantic-collector-per-buffer-list nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
863 "List of collectors active in this buffer.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
864 (make-variable-buffer-local 'semantic-collector-per-buffer-list)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
865
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
866 (defvar semantic-collector-list nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
867 "List of global collectors active this session.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
868
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
869 (defclass semantic-collector-abstract ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
870 ((buffer :initarg :buffer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
871 :type buffer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
872 :documentation "Originating buffer for this collector.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
873 Some collectors use a given buffer as a starting place while looking up
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
874 tags.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
875 (cache :initform nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
876 :type (or null semanticdb-find-result-with-nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
877 :documentation "Cache of tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
878 These tags are re-used during a completion session.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
879 Sometimes these tags are cached between completion sessions.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
880 (last-all-completions :initarg nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
881 :type semanticdb-find-result-with-nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
882 :documentation "Last result of `all-completions'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
883 This result can be used for refined completions as `last-prefix' gets
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
884 closer to a specific result.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
885 (last-prefix :type string
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
886 :protection :protected
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
887 :documentation "The last queried prefix.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
888 This prefix can be used to cache intermediate completion offers.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
889 making the action of homing in on a token faster.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
890 (last-completion :type (or null string)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
891 :documentation "The last calculated completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
892 This completion is calculated and saved for future use.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
893 (last-whitespace-completion :type (or null string)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
894 :documentation "The last whitespace completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
895 For partial completion, SPC will disabiguate over whitespace type
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
896 characters. This is the last calculated version.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
897 (current-exact-match :type list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
898 :protection :protected
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
899 :documentation "The list of matched tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
900 When tokens are matched, they are added to this list.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
901 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
902 "Root class for completion engines.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
903 The baseclass provides basic functionality for interacting with
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
904 a completion displayor object, and tracking the current progress
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
905 of a completion."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
906 :abstract t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
907
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
908 (defmethod semantic-collector-cleanup ((obj semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
909 "Clean up any mess this collector may have."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
910 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
911
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
912 (defmethod semantic-collector-next-action
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
913 ((obj semantic-collector-abstract) partial)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
914 "What should we do next? OBJ can predict a next good action.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
915 PARTIAL indicates if we are doing a partial completion."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
916 (if (and (slot-boundp obj 'last-completion)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
917 (string= (semantic-completion-text) (oref obj last-completion)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
918 (let* ((cem (semantic-collector-current-exact-match obj))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
919 (cemlen (semanticdb-find-result-length cem))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
920 (cac (semantic-collector-all-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
921 obj (semantic-completion-text)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
922 (caclen (semanticdb-find-result-length cac)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
923 (cond ((and cem (= cemlen 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
924 cac (> caclen 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
925 (eq last-command this-command))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
926 ;; Defer to the displayor...
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
927 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
928 ((and cem (= cemlen 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
929 'done)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
930 ((and (not cem) (not cac))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
931 'empty)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
932 ((and partial (semantic-collector-try-completion-whitespace
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
933 obj (semantic-completion-text)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
934 'complete-whitespace)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
935 'complete))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
936
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
937 (defmethod semantic-collector-last-prefix= ((obj semantic-collector-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
938 last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
939 "Return non-nil if OBJ's prefix matches PREFIX."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
940 (and (slot-boundp obj 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
941 (string= (oref obj last-prefix) last-prefix)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
942
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
943 (defmethod semantic-collector-get-cache ((obj semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
944 "Get the raw cache of tags for completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
945 Calculate the cache if there isn't one."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
946 (or (oref obj cache)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
947 (semantic-collector-calculate-cache obj)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
948
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
949 (defmethod semantic-collector-calculate-completions-raw
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
950 ((obj semantic-collector-abstract) prefix completionlist)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
951 "Calculate the completions for prefix from completionlist.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
952 Output must be in semanticdb Find result format."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
953 ;; Must output in semanticdb format
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105652
diff changeset
954 (let ((table (with-current-buffer (oref obj buffer)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
955 semanticdb-current-table))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
956 (result (semantic-find-tags-for-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
957 prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
958 ;; To do this kind of search with a pre-built completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
959 ;; list, we need to strip it first.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
960 (semanticdb-strip-find-results completionlist)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
961 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
962 (if result
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
963 (list (cons table result)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
964
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
965 (defmethod semantic-collector-calculate-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
966 ((obj semantic-collector-abstract) prefix partial)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
967 "Calculate completions for prefix as setup for other queries."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
968 (let* ((case-fold-search semantic-case-fold)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
969 (same-prefix-p (semantic-collector-last-prefix= obj prefix))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
970 (completionlist
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
971 (if (or same-prefix-p
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
972 (and (slot-boundp obj 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
973 (eq (compare-strings (oref obj last-prefix) 0 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
974 prefix 0 (length prefix))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
975 t)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
976 ;; New prefix is subset of old prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
977 (oref obj last-all-completions)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
978 (semantic-collector-get-cache obj)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
979 ;; Get the result
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
980 (answer (if same-prefix-p
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
981 completionlist
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
982 (semantic-collector-calculate-completions-raw
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
983 obj prefix completionlist))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
984 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
985 (completion nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
986 (complete-not-uniq nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
987 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
988 ;;(semanticdb-find-result-test answer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
989 (when (not same-prefix-p)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
990 ;; Save results if it is interesting and beneficial
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
991 (oset obj last-prefix prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
992 (oset obj last-all-completions answer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
993 ;; Now calculate the completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
994 (setq completion (try-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
995 prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
996 (semanticdb-strip-find-results answer)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
997 (oset obj last-whitespace-completion nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
998 (oset obj current-exact-match nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
999 ;; Only do this if a completion was found. Letting a nil in
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1000 ;; could cause a full semanticdb search by accident.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1001 (when completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1002 (oset obj last-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1003 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1004 ;; Unique match in AC. Last completion is a match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1005 ;; Also set the current-exact-match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1006 ((eq completion t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1007 (oset obj current-exact-match answer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1008 prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1009 ;; It may be complete (a symbol) but still not unique.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1010 ;; We can capture a match
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1011 ((setq complete-not-uniq
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1012 (semanticdb-find-tags-by-name
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1013 prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1014 answer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1015 (oset obj current-exact-match
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1016 complete-not-uniq)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1017 prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1018 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1019 ;; Non unique match, return the string that handles
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1020 ;; completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1021 (t (or completion prefix))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1022 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1023 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1024
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1025 (defmethod semantic-collector-try-completion-whitespace
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1026 ((obj semantic-collector-abstract) prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1027 "For OBJ, do whatepsace completion based on PREFIX.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1028 This implies that if there are two completions, one matching
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1029 the test \"preifx\\>\", and one not, the one matching the full
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1030 word version of PREFIX will be chosen, and that text returned.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1031 This function requires that `semantic-collector-calculate-completions'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1032 has been run first."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1033 (let* ((ac (semantic-collector-all-completions obj prefix))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1034 (matchme (concat "^" prefix "\\>"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1035 (compare (semanticdb-find-tags-by-name-regexp matchme ac))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1036 (numtag (semanticdb-find-result-length compare))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1037 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1038 (if compare
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1039 (let* ((idx 0)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1040 (cutlen (1+ (length prefix)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1041 (twws (semanticdb-find-result-nth compare idx)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1042 ;; Is our tag with whitespace a match that has whitespace
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1043 ;; after it, or just an already complete symbol?
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1044 (while (and (< idx numtag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1045 (< (length (semantic-tag-name (car twws))) cutlen))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1046 (setq idx (1+ idx)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1047 twws (semanticdb-find-result-nth compare idx)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1048 (when (and twws (car-safe twws))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1049 ;; If COMPARE has succeeded, then we should take the very
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1050 ;; first match, and extend prefix by one character.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1051 (oset obj last-whitespace-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1052 (substring (semantic-tag-name (car twws))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1053 0 cutlen))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1054 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1055
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1056
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1057 (defmethod semantic-collector-current-exact-match ((obj semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1058 "Return the active valid MATCH from the semantic collector.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1059 For now, just return the first element from our list of available
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1060 matches. For semanticdb based results, make sure the file is loaded
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1061 into a buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1062 (when (slot-boundp obj 'current-exact-match)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1063 (oref obj current-exact-match)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1064
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1065 (defmethod semantic-collector-current-whitespace-completion ((obj semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1066 "Return the active whitespace completion value."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1067 (when (slot-boundp obj 'last-whitespace-completion)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1068 (oref obj last-whitespace-completion)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1069
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1070 (defmethod semantic-collector-get-match ((obj semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1071 "Return the active valid MATCH from the semantic collector.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1072 For now, just return the first element from our list of available
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1073 matches. For semanticdb based results, make sure the file is loaded
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1074 into a buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1075 (when (slot-boundp obj 'current-exact-match)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1076 (semanticdb-find-result-nth-in-buffer (oref obj current-exact-match) 0)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1077
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1078 (defmethod semantic-collector-all-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1079 ((obj semantic-collector-abstract) prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1080 "For OBJ, retrieve all completions matching PREFIX.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1081 The returned list consists of all the tags currently
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1082 matching PREFIX."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1083 (when (slot-boundp obj 'last-all-completions)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1084 (oref obj last-all-completions)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1085
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1086 (defmethod semantic-collector-try-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1087 ((obj semantic-collector-abstract) prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1088 "For OBJ, attempt to match PREFIX.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1089 See `try-completion' for details on how this works.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1090 Return nil for no match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1091 Return a string for a partial match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1092 For a unique match of PREFIX, return the list of all tags
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1093 with that name."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1094 (if (slot-boundp obj 'last-completion)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1095 (oref obj last-completion)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1096
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1097 (defmethod semantic-collector-calculate-cache
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1098 ((obj semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1099 "Calculate the completion cache for OBJ."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1100 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1101 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1102
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1103 (defmethod semantic-collector-flush ((this semantic-collector-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1104 "Flush THIS collector object, clearing any caches and prefix."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1105 (oset this cache nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1106 (slot-makeunbound this 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1107 (slot-makeunbound this 'last-completion)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1108 (slot-makeunbound this 'last-all-completions)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1109 (slot-makeunbound this 'current-exact-match)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1110 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1111
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1112 ;;; PER BUFFER
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1113 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1114 (defclass semantic-collector-buffer-abstract (semantic-collector-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1115 ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1116 "Root class for per-buffer completion engines.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1117 These collectors track themselves on a per-buffer basis."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1118 :abstract t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1119
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1120 (defmethod constructor :STATIC ((this semantic-collector-buffer-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1121 newname &rest fields)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1122 "Reuse previously created objects of this type in buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1123 (let ((old nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1124 (bl semantic-collector-per-buffer-list))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1125 (while (and bl (null old))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1126 (if (eq (object-class (car bl)) this)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1127 (setq old (car bl))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1128 (unless old
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1129 (let ((new (call-next-method)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1130 (add-to-list 'semantic-collector-per-buffer-list new)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1131 (setq old new)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1132 (slot-makeunbound old 'last-completion)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1133 (slot-makeunbound old 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1134 (slot-makeunbound old 'current-exact-match)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1135 old))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1136
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1137 ;; Buffer specific collectors should flush themselves
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1138 (defun semantic-collector-buffer-flush (newcache)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1139 "Flush all buffer collector objects.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1140 NEWCACHE is the new tag table, but we ignore it."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1141 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1142 (let ((l semantic-collector-per-buffer-list))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1143 (while l
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1144 (if (car l) (semantic-collector-flush (car l)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1145 (setq l (cdr l))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1146 (error nil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1147
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1148 (add-hook 'semantic-after-toplevel-cache-change-hook
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1149 'semantic-collector-buffer-flush)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1150
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1151 ;;; DEEP BUFFER SPECIFIC COMPLETION
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1152 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1153 (defclass semantic-collector-buffer-deep
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1154 (semantic-collector-buffer-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1155 ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1156 "Completion engine for tags in the current buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1157 When searching for a tag, uses semantic deep searche functions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1158 Basics search only in the current buffer.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1159
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1160 (defmethod semantic-collector-calculate-cache
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1161 ((obj semantic-collector-buffer-deep))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1162 "Calculate the completion cache for OBJ.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1163 Uses `semantic-flatten-tags-table'"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1164 (oset obj cache
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1165 ;; Must create it in SEMANTICDB find format.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1166 ;; ( ( DBTABLE TAG TAG ... ) ... )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1167 (list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1168 (cons semanticdb-current-table
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1169 (semantic-flatten-tags-table (oref obj buffer))))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1170
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1171 ;;; PROJECT SPECIFIC COMPLETION
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1172 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1173 (defclass semantic-collector-project-abstract (semantic-collector-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1174 ((path :initarg :path
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1175 :initform nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1176 :documentation "List of database tables to search.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1177 At creation time, it can be anything accepted by
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1178 `semanticdb-find-translate-path' as a PATH argument.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1179 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1180 "Root class for project wide completion engines.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1181 Uses semanticdb for searching all tags in the current project."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1182 :abstract t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1183
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1184 ;;; Project Search
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1185 (defclass semantic-collector-project (semantic-collector-project-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1186 ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1187 "Completion engine for tags in a project.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1188
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1189
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1190 (defmethod semantic-collector-calculate-completions-raw
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1191 ((obj semantic-collector-project) prefix completionlist)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1192 "Calculate the completions for prefix from completionlist."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1193 (semanticdb-find-tags-for-completion prefix (oref obj path)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1194
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1195 ;;; Brutish Project search
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1196 (defclass semantic-collector-project-brutish (semantic-collector-project-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1197 ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1198 "Completion engine for tags in a project.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1199
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
1200 (declare-function semanticdb-brute-deep-find-tags-for-completion
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
1201 "semantic/db-find")
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
1202
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1203 (defmethod semantic-collector-calculate-completions-raw
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1204 ((obj semantic-collector-project-brutish) prefix completionlist)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1205 "Calculate the completions for prefix from completionlist."
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104442
diff changeset
1206 (require 'semantic/db-find)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1207 (semanticdb-brute-deep-find-tags-for-completion prefix (oref obj path)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1208
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1209 ;;; Current Datatype member search.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1210 (defclass semantic-collector-local-members (semantic-collector-project-abstract)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1211 ((scope :initform nil
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1212 :type (or null semantic-scope-cache)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1213 :documentation
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1214 "The scope the local members are being completed from."))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1215 "Completion engine for tags in a project.")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1216
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1217 (defmethod semantic-collector-calculate-completions-raw
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1218 ((obj semantic-collector-local-members) prefix completionlist)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1219 "Calculate the completions for prefix from completionlist."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1220 (let* ((scope (or (oref obj scope)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1221 (oset obj scope (semantic-calculate-scope))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1222 (localstuff (oref scope scope)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1223 (list
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1224 (cons
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1225 (oref scope :table)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1226 (semantic-find-tags-for-completion prefix localstuff)))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1227 ;(semanticdb-brute-deep-find-tags-for-completion prefix (oref obj path))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1228
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1229 ;;; Smart completion collector
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1230 (defclass semantic-collector-analyze-completions (semantic-collector-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1231 ((context :initarg :context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1232 :type semantic-analyze-context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1233 :documentation "An analysis context.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1234 Specifies some context location from whence completion lists will be drawn."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1235 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1236 (first-pass-completions :type list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1237 :documentation "List of valid completion tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1238 This list of tags is generated when completion starts. All searches
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1239 derive from this list.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1240 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1241 "Completion engine that uses the context analyzer to provide options.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1242 The only options available for completion are those which can be logically
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1243 inserted into the current context.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1244
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1245 (defmethod semantic-collector-calculate-completions-raw
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1246 ((obj semantic-collector-analyze-completions) prefix completionlist)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1247 "calculate the completions for prefix from completionlist."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1248 ;; if there are no completions yet, calculate them.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1249 (if (not (slot-boundp obj 'first-pass-completions))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1250 (oset obj first-pass-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1251 (semantic-analyze-possible-completions (oref obj context))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1252 ;; search our cached completion list. make it look like a semanticdb
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1253 ;; results type.
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105652
diff changeset
1254 (list (cons (with-current-buffer (oref (oref obj context) buffer)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1255 semanticdb-current-table)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1256 (semantic-find-tags-for-completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1257 prefix
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1258 (oref obj first-pass-completions)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1259
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1260
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1261 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1262 ;;; Tag List Display Engines
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1263 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1264 ;; A typical displayor accepts a pre-determined list of completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1265 ;; generated by a collector. This format is in semanticdb search
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1266 ;; form. This vaguely standard form is a bit challenging to navigate
107149
907ba0dc2be7 Fix typos in comments.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
1267 ;; because the tags do not contain buffer info, but the file associated
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1268 ;; with the tags preceed the tag in the list.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1269 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1270 ;; Basic displayors don't care, and can strip the results.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1271 ;; Advanced highlighting displayors need to know when they need
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1272 ;; to load a file so that the tag in question can be highlighted.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1273 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1274 ;; Key interface methods to a displayor are:
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1275 ;; * semantic-displayor-next-action
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1276 ;; * semantic-displayor-set-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1277 ;; * semantic-displayor-current-focus
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1278 ;; * semantic-displayor-show-request
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1279 ;; * semantic-displayor-scroll-request
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1280 ;; * semantic-displayor-focus-request
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1281
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1282 (defclass semantic-displayor-abstract ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1283 ((table :type (or null semanticdb-find-result-with-nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1284 :initform nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1285 :protection :protected
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1286 :documentation "List of tags this displayor is showing.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1287 (last-prefix :type string
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1288 :protection :protected
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1289 :documentation "Prefix associated with slot `table'")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1290 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1291 "Abstract displayor baseclass.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1292 Manages the display of some number of tags.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1293 Provides the basics for a displayor, including interacting with
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1294 a collector, and tracking tables of completion to display."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1295 :abstract t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1296
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1297 (defmethod semantic-displayor-cleanup ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1298 "Clean up any mess this displayor may have."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1299 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1300
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1301 (defmethod semantic-displayor-next-action ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1302 "The next action to take on the minibuffer related to display."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1303 (if (and (slot-boundp obj 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1304 (string= (oref obj last-prefix) (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1305 (eq last-command this-command))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1306 'scroll
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1307 'display))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1308
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1309 (defmethod semantic-displayor-set-completions ((obj semantic-displayor-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1310 table prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1311 "Set the list of tags to be completed over to TABLE."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1312 (oset obj table table)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1313 (oset obj last-prefix prefix))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1314
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1315 (defmethod semantic-displayor-show-request ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1316 "A request to show the current tags table."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1317 (ding))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1318
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1319 (defmethod semantic-displayor-focus-request ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1320 "A request to for the displayor to focus on some tag option."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1321 (ding))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1322
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1323 (defmethod semantic-displayor-scroll-request ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1324 "A request to for the displayor to scroll the completion list (if needed)."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1325 (scroll-other-window))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1326
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1327 (defmethod semantic-displayor-focus-previous ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1328 "Set the current focus to the previous item."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1329 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1330
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1331 (defmethod semantic-displayor-focus-next ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1332 "Set the current focus to the next item."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1333 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1334
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1335 (defmethod semantic-displayor-current-focus ((obj semantic-displayor-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1336 "Return a single tag currently in focus.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1337 This object type doesn't do focus, so will never have a focus object."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1338 nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1339
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1340 ;; Traditional displayor
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1341 (defcustom semantic-completion-displayor-format-tag-function
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1342 #'semantic-format-tag-name
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1343 "*A Tag format function to use when showing completions."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1344 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1345 :type semantic-format-tag-custom-list)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1346
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1347 (defclass semantic-displayor-traditional (semantic-displayor-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1348 ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1349 "Display options in *Completions* buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1350 Traditional display mechanism for a list of possible completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1351 Completions are showin in a new buffer and listed with the ability
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1352 to click on the items to aid in completion.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1353
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1354 (defmethod semantic-displayor-show-request ((obj semantic-displayor-traditional))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1355 "A request to show the current tags table."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1356
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1357 ;; NOTE TO SELF. Find the character to type next, and emphesize it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1358
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1359 (with-output-to-temp-buffer "*Completions*"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1360 (display-completion-list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1361 (mapcar semantic-completion-displayor-format-tag-function
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1362 (semanticdb-strip-find-results (oref obj table))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1363 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1364 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1365
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1366 ;;; Abstract baseclass for any displayor which supports focus
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1367 (defclass semantic-displayor-focus-abstract (semantic-displayor-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1368 ((focus :type number
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1369 :protection :protected
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1370 :documentation "A tag index from `table' which has focus.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1371 Multiple calls to the display function can choose to focus on a
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1372 given tag, by highlighting its location.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1373 (find-file-focus
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1374 :allocation :class
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1375 :initform nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1376 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1377 "Non-nil if focusing requires a tag's buffer be in memory.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1378 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1379 "Abstract displayor supporting `focus'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1380 A displayor which has the ability to focus in on one tag.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1381 Focusing is a way of differentiationg between multiple tags
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1382 which have the same name."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1383 :abstract t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1384
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1385 (defmethod semantic-displayor-next-action ((obj semantic-displayor-focus-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1386 "The next action to take on the minibuffer related to display."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1387 (if (and (slot-boundp obj 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1388 (string= (oref obj last-prefix) (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1389 (eq last-command this-command))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1390 (if (and
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1391 (slot-boundp obj 'focus)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1392 (slot-boundp obj 'table)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1393 (<= (semanticdb-find-result-length (oref obj table))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1394 (1+ (oref obj focus))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1395 ;; We are at the end of the focus road.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1396 'displayend
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1397 ;; Focus on some item.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1398 'focus)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1399 'display))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1400
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1401 (defmethod semantic-displayor-set-completions ((obj semantic-displayor-focus-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1402 table prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1403 "Set the list of tags to be completed over to TABLE."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1404 (call-next-method)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1405 (slot-makeunbound obj 'focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1406
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1407 (defmethod semantic-displayor-focus-previous ((obj semantic-displayor-focus-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1408 "Set the current focus to the previous item.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1409 Not meaningful return value."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1410 (when (and (slot-boundp obj 'table) (oref obj table))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1411 (with-slots (table) obj
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1412 (if (or (not (slot-boundp obj 'focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1413 (<= (oref obj focus) 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1414 (oset obj focus (1- (semanticdb-find-result-length table)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1415 (oset obj focus (1- (oref obj focus)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1416 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1417 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1418
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1419 (defmethod semantic-displayor-focus-next ((obj semantic-displayor-focus-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1420 "Set the current focus to the next item.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1421 Not meaningful return value."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1422 (when (and (slot-boundp obj 'table) (oref obj table))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1423 (with-slots (table) obj
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1424 (if (not (slot-boundp obj 'focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1425 (oset obj focus 0)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1426 (oset obj focus (1+ (oref obj focus)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1427 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1428 (if (<= (semanticdb-find-result-length table) (oref obj focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1429 (oset obj focus 0))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1430 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1431
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1432 (defmethod semantic-displayor-focus-tag ((obj semantic-displayor-focus-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1433 "Return the next tag OBJ should focus on."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1434 (when (and (slot-boundp obj 'table) (oref obj table))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1435 (with-slots (table) obj
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1436 (semanticdb-find-result-nth table (oref obj focus)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1437
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1438 (defmethod semantic-displayor-current-focus ((obj semantic-displayor-focus-abstract))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1439 "Return the tag currently in focus, or call parent method."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1440 (if (and (slot-boundp obj 'focus)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1441 (slot-boundp obj 'table)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1442 ;; Only return the current focus IFF the minibuffer reflects
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1443 ;; the list this focus was derived from.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1444 (slot-boundp obj 'last-prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1445 (string= (semantic-completion-text) (oref obj last-prefix))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1446 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1447 ;; We need to focus
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1448 (if (oref obj find-file-focus)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1449 (semanticdb-find-result-nth-in-buffer (oref obj table) (oref obj focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1450 ;; result-nth returns a cons with car being the tag, and cdr the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1451 ;; database.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1452 (car (semanticdb-find-result-nth (oref obj table) (oref obj focus))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1453 ;; Do whatever
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1454 (call-next-method)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1455
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1456 ;;; Simple displayor which performs traditional display completion,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1457 ;; and also focuses with highlighting.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1458 (defclass semantic-displayor-traditional-with-focus-highlight
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1459 (semantic-displayor-focus-abstract semantic-displayor-traditional)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1460 ((find-file-focus :initform t))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1461 "Display completions in *Completions* buffer, with focus highlight.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1462 A traditional displayor which can focus on a tag by showing it.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1463 Same as `semantic-displayor-traditional', but with selection between
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1464 multiple tags with the same name done by 'focusing' on the source
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1465 location of the different tags to differentiate them.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1466
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1467 (defmethod semantic-displayor-focus-request
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1468 ((obj semantic-displayor-traditional-with-focus-highlight))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1469 "Focus in on possible tag completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1470 Focus is performed by cycling through the tags and highlighting
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1471 one in the source buffer."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1472 (let* ((tablelength (semanticdb-find-result-length (oref obj table)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1473 (focus (semantic-displayor-focus-tag obj))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1474 ;; Raw tag info.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1475 (rtag (car focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1476 (rtable (cdr focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1477 ;; Normalize
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1478 (nt (semanticdb-normalize-one-tag rtable rtag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1479 (tag (cdr nt))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1480 (table (car nt))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1481 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1482 ;; If we fail to normalize, resete.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1483 (when (not tag) (setq table rtable tag rtag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1484 ;; Do the focus.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1485 (let ((buf (or (semantic-tag-buffer tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1486 (and table (semanticdb-get-buffer table)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1487 ;; If no buffer is provided, then we can make up a summary buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1488 (when (not buf)
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105652
diff changeset
1489 (with-current-buffer (get-buffer-create "*Completion Focus*")
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1490 (erase-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1491 (insert "Focus on tag: \n")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1492 (insert (semantic-format-tag-summarize tag nil t) "\n\n")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1493 (when table
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1494 (insert "From table: \n")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1495 (insert (object-name table) "\n\n"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1496 (when buf
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1497 (insert "In buffer: \n\n")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1498 (insert (format "%S" buf)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1499 (setq buf (current-buffer))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1500 ;; Show the tag in the buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1501 (if (get-buffer-window buf)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1502 (select-window (get-buffer-window buf))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1503 (switch-to-buffer-other-window buf t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1504 (select-window (get-buffer-window buf)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1505 ;; Now do some positioning
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1506 (unwind-protect
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1507 (if (semantic-tag-with-position-p tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1508 ;; Full tag positional information available
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1509 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1510 (goto-char (semantic-tag-start tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1511 ;; This avoids a dangerous problem if we just loaded a tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1512 ;; from a file, but the original position was not updated
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1513 ;; in the TAG variable we are currently using.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1514 (semantic-momentary-highlight-tag (semantic-current-tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1515 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1516 (select-window (minibuffer-window)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1517 ;; Calculate text difference between contents and the focus item.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1518 (let* ((mbc (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1519 (ftn (semantic-tag-name tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1520 (diff (substring ftn (length mbc))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1521 (semantic-completion-message
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1522 (format "%s [%d of %d matches]" diff (1+ (oref obj focus)) tablelength)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1523 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1524
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1525
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1526 ;;; Tooltip completion lister
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1527 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1528 ;; Written and contributed by Masatake YAMATO <jet@gyve.org>
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1529 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1530 ;; Modified by Eric Ludlam for
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1531 ;; * Safe compatibility for tooltip free systems.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1532 ;; * Don't use 'avoid package for tooltip positioning.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1533
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1534 (defclass semantic-displayor-tooltip (semantic-displayor-traditional)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1535 ((max-tags :type integer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1536 :initarg :max-tags
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1537 :initform 5
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1538 :custom integer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1539 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1540 "Max number of tags displayed on tooltip at once.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1541 If `force-show' is 1, this value is ignored with typing tab or space twice continuously.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1542 if `force-show' is 0, this value is always ignored.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1543 (force-show :type integer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1544 :initarg :force-show
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1545 :initform 1
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1546 :custom (choice (const
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1547 :tag "Show when double typing"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1548 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1549 (const
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1550 :tag "Show always"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1551 0)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1552 (const
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1553 :tag "Show if the number of tags is less than `max-tags'."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1554 -1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1555 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1556 "Control the behavior of the number of tags is greater than `max-tags'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1557 -1 means tags are never shown.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1558 0 means the tags are always shown.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1559 1 means tags are shown if space or tab is typed twice continuously.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1560 (typing-count :type integer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1561 :initform 0
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1562 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1563 "Counter holding how many times the user types space or tab continuously before showing tags.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1564 (shown :type boolean
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1565 :initform nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1566 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1567 "Flag representing whether tags is shown once or not.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1568 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1569 "Display completions options in a tooltip.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1570 Display mechanism using tooltip for a list of possible completions.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1571
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1572 (defmethod initialize-instance :AFTER ((obj semantic-displayor-tooltip) &rest args)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1573 "Make sure we have tooltips required."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1574 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1575 (require 'tooltip)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1576 (error nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1577 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1578
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1579 (defmethod semantic-displayor-show-request ((obj semantic-displayor-tooltip))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1580 "A request to show the current tags table."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1581 (if (or (not (featurep 'tooltip)) (not tooltip-mode))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1582 ;; If we cannot use tooltips, then go to the normal mode with
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1583 ;; a traditional completion buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1584 (call-next-method)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1585 (let* ((tablelong (semanticdb-strip-find-results (oref obj table)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1586 (table (semantic-unique-tag-table-by-name tablelong))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1587 (l (mapcar semantic-completion-displayor-format-tag-function table))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1588 (ll (length l))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1589 (typing-count (oref obj typing-count))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1590 (force-show (oref obj force-show))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1591 (matchtxt (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1592 msg)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1593 (if (or (oref obj shown)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1594 (< ll (oref obj max-tags))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1595 (and (<= 0 force-show)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1596 (< (1- force-show) typing-count)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1597 (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1598 (oset obj typing-count 0)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1599 (oset obj shown t)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1600 (if (eq 1 ll)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1601 ;; We Have only one possible match. There could be two cases.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1602 ;; 1) input text != single match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1603 ;; --> Show it!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1604 ;; 2) input text == single match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1605 ;; --> Complain about it, but still show the match.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1606 (if (string= matchtxt (semantic-tag-name (car table)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1607 (setq msg (concat "[COMPLETE]\n" (car l)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1608 (setq msg (car l)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1609 ;; Create the long message.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1610 (setq msg (mapconcat 'identity l "\n"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1611 ;; If there is nothing, say so!
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1612 (if (eq 0 (length msg))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1613 (setq msg "[NO MATCH]")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1614 (semantic-displayor-tooltip-show msg))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1615 ;; The typing count determines if the user REALLY REALLY
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1616 ;; wanted to show that much stuff. Only increment
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1617 ;; if the current command is a completion command.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1618 (if (and (stringp (this-command-keys))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1619 (string= (this-command-keys) "\C-i"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1620 (oset obj typing-count (1+ typing-count)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1621 ;; At this point, we know we have too many items.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1622 ;; Lets be brave, and truncate l
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1623 (setcdr (nthcdr (oref obj max-tags) l) nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1624 (setq msg (mapconcat 'identity l "\n"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1625 (cond
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1626 ((= force-show -1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1627 (semantic-displayor-tooltip-show (concat msg "\n...")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1628 ((= force-show 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1629 (semantic-displayor-tooltip-show (concat msg "\n(TAB for more)")))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1630 )))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1631
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1632 ;;; Compatibility
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1633 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1634 (eval-and-compile
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1635 (if (fboundp 'window-inside-edges)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1636 ;; Emacs devel.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1637 (defalias 'semantic-displayor-window-edges
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1638 'window-inside-edges)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1639 ;; Emacs 21
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1640 (defalias 'semantic-displayor-window-edges
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1641 'window-edges)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1642 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1643
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1644 (defun semantic-displayor-point-position ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1645 "Return the location of POINT as positioned on the selected frame.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1646 Return a cons cell (X . Y)"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1647 (let* ((frame (selected-frame))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1648 (left (frame-parameter frame 'left))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1649 (top (frame-parameter frame 'top))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1650 (point-pix-pos (posn-x-y (posn-at-point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1651 (edges (window-inside-pixel-edges (selected-window))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1652 (cons (+ (car point-pix-pos) (car edges) left)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1653 (+ (cdr point-pix-pos) (cadr edges) top))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1654
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1655
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1656 (defun semantic-displayor-tooltip-show (text)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1657 "Display a tooltip with TEXT near cursor."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1658 (let ((point-pix-pos (semantic-displayor-point-position))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1659 (tooltip-frame-parameters
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1660 (append tooltip-frame-parameters nil)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1661 (push
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1662 (cons 'left (+ (car point-pix-pos) (frame-char-width)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1663 tooltip-frame-parameters)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1664 (push
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1665 (cons 'top (+ (cdr point-pix-pos) (frame-char-height)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1666 tooltip-frame-parameters)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1667 (tooltip-show text)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1668
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1669 (defmethod semantic-displayor-scroll-request ((obj semantic-displayor-tooltip))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1670 "A request to for the displayor to scroll the completion list (if needed)."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1671 ;; Do scrolling in the tooltip.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1672 (oset obj max-tags 30)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1673 (semantic-displayor-show-request obj)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1674 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1675
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1676 ;; End code contributed by Masatake YAMATO <jet@gyve.org>
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1677
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1678
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1679 ;;; Ghost Text displayor
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1680 ;;
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1681 (defclass semantic-displayor-ghost (semantic-displayor-focus-abstract)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1682
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1683 ((ghostoverlay :type overlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1684 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1685 "The overlay the ghost text is displayed in.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1686 (first-show :initform t
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1687 :documentation
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1688 "Non nil if we have not seen our first show request.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1689 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1690 "Cycle completions inline with ghost text.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1691 Completion displayor using ghost chars after point for focus options.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1692 Whichever completion is currently in focus will be displayed as ghost
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1693 text using overlay options.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1694
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1695 (defmethod semantic-displayor-next-action ((obj semantic-displayor-ghost))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1696 "The next action to take on the inline completion related to display."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1697 (let ((ans (call-next-method))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1698 (table (when (slot-boundp obj 'table)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1699 (oref obj table))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1700 (if (and (eq ans 'displayend)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1701 table
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1702 (= (semanticdb-find-result-length table) 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1703 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1704 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1705 ans)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1706
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1707 (defmethod semantic-displayor-cleanup ((obj semantic-displayor-ghost))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1708 "Clean up any mess this displayor may have."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1709 (when (slot-boundp obj 'ghostoverlay)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1710 (semantic-overlay-delete (oref obj ghostoverlay)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1711 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1712
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1713 (defmethod semantic-displayor-set-completions ((obj semantic-displayor-ghost)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1714 table prefix)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1715 "Set the list of tags to be completed over to TABLE."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1716 (call-next-method)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1717
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1718 (semantic-displayor-cleanup obj)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1719 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1720
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1721
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1722 (defmethod semantic-displayor-show-request ((obj semantic-displayor-ghost))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1723 "A request to show the current tags table."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1724 ; (if (oref obj first-show)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1725 ; (progn
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1726 ; (oset obj first-show nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1727 (semantic-displayor-focus-next obj)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1728 (semantic-displayor-focus-request obj)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1729 ; )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1730 ;; Only do the traditional thing if the first show request
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1731 ;; has been seen. Use the first one to start doing the ghost
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1732 ;; text display.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1733 ; (call-next-method)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1734 ; )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1735 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1736
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1737 (defmethod semantic-displayor-focus-request
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1738 ((obj semantic-displayor-ghost))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1739 "Focus in on possible tag completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1740 Focus is performed by cycling through the tags and showing a possible
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1741 completion text in ghost text."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1742 (let* ((tablelength (semanticdb-find-result-length (oref obj table)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1743 (focus (semantic-displayor-focus-tag obj))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1744 (tag (car focus))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1745 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1746 (if (not tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1747 (semantic-completion-message "No tags to focus on.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1748 ;; Display the focus completion as ghost text after the current
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1749 ;; inline text.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1750 (when (or (not (slot-boundp obj 'ghostoverlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1751 (not (semantic-overlay-live-p (oref obj ghostoverlay))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1752 (oset obj ghostoverlay
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1753 (semantic-make-overlay (point) (1+ (point)) (current-buffer) t)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1754
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1755 (let* ((lp (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1756 (os (substring (semantic-tag-name tag) (length lp)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1757 (ol (oref obj ghostoverlay))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1758 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1759
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1760 (put-text-property 0 (length os) 'face 'region os)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1761
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1762 (semantic-overlay-put
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1763 ol 'display (concat os (buffer-substring (point) (1+ (point)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1764 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1765 ;; Calculate text difference between contents and the focus item.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1766 (let* ((mbc (semantic-completion-text))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1767 (ftn (concat (semantic-tag-name tag)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1768 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1769 (put-text-property (length mbc) (length ftn) 'face
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1770 'bold ftn)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1771 (semantic-completion-message
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1772 (format "%s [%d of %d matches]" ftn (1+ (oref obj focus)) tablelength)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1773 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1774
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1775
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1776 ;;; ------------------------------------------------------------
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1777 ;;; Specific queries
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1778 ;;
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1779 (defvar semantic-complete-inline-custom-type
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1780 (append '(radio)
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1781 (mapcar
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1782 (lambda (class)
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1783 (let* ((C (intern (car class)))
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1784 (doc (documentation-property C 'variable-documentation))
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1785 (doc1 (car (split-string doc "\n")))
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1786 )
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1787 (list 'const
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1788 :tag doc1
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1789 C)))
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1790 (eieio-build-class-alist semantic-displayor-abstract t))
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1791 )
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
1792 "Possible options for inline completion displayors.
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1793 Use this to enable custom editing.")
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1794
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1795 (defcustom semantic-complete-inline-analyzer-displayor-class
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1796 'semantic-displayor-traditional
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1797 "*Class for displayor to use with inline completion."
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1798 :group 'semantic
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1799 :type semantic-complete-inline-custom-type
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1800 )
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
1801
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1802 (defun semantic-complete-read-tag-buffer-deep (prompt &optional
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1803 default-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1804 initial-input
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1805 history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1806 "Ask for a tag by name from the current buffer.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1807 Available tags are from the current buffer, at any level.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1808 Completion options are presented in a traditional way, with highlighting
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1809 to resolve same-name collisions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1810 PROMPT is a string to prompt with.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1811 DEFAULT-TAG is a semantic tag or string to use as the default value.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1812 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1813 HISTORY is a symbol representing a variable to store the history in."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1814 (semantic-complete-read-tag-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1815 (semantic-collector-buffer-deep prompt :buffer (current-buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1816 (semantic-displayor-traditional-with-focus-highlight "simple")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1817 ;;(semantic-displayor-tooltip "simple")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1818 prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1819 default-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1820 initial-input
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1821 history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1822 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1823
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1824 (defun semantic-complete-read-tag-local-members (prompt &optional
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1825 default-tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1826 initial-input
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1827 history)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1828 "Ask for a tag by name from the local type members.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1829 Available tags are from the the current scope.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1830 Completion options are presented in a traditional way, with highlighting
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1831 to resolve same-name collisions.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1832 PROMPT is a string to prompt with.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1833 DEFAULT-TAG is a semantic tag or string to use as the default value.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1834 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1835 HISTORY is a symbol representing a variable to store the history in."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1836 (semantic-complete-read-tag-engine
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1837 (semantic-collector-local-members prompt :buffer (current-buffer))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1838 (semantic-displayor-traditional-with-focus-highlight "simple")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1839 ;;(semantic-displayor-tooltip "simple")
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1840 prompt
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1841 default-tag
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1842 initial-input
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1843 history)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1844 )
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
1845
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1846 (defun semantic-complete-read-tag-project (prompt &optional
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1847 default-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1848 initial-input
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1849 history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1850 "Ask for a tag by name from the current project.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1851 Available tags are from the current project, at the top level.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1852 Completion options are presented in a traditional way, with highlighting
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1853 to resolve same-name collisions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1854 PROMPT is a string to prompt with.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1855 DEFAULT-TAG is a semantic tag or string to use as the default value.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1856 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1857 HISTORY is a symbol representing a variable to store the history in."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1858 (semantic-complete-read-tag-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1859 (semantic-collector-project-brutish prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1860 :buffer (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1861 :path (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1862 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1863 (semantic-displayor-traditional-with-focus-highlight "simple")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1864 prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1865 default-tag
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1866 initial-input
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1867 history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1868 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1869
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1870 (defun semantic-complete-inline-tag-project ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1871 "Complete a symbol name by name from within the current project.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1872 This is similar to `semantic-complete-read-tag-project', except
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1873 that the completion interaction is in the buffer where the context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1874 was calculated from.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1875 Customize `semantic-complete-inline-analyzer-displayor-class'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1876 to control how completion options are displayed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1877 See `semantic-complete-inline-tag-engine' for details on how
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1878 completion works."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1879 (let* ((collector (semantic-collector-project-brutish
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1880 "inline"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1881 :buffer (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1882 :path (current-buffer)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1883 (sbounds (semantic-ctxt-current-symbol-and-bounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1884 (syms (car sbounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1885 (start (car (nth 2 sbounds)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1886 (end (cdr (nth 2 sbounds)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1887 (rsym (reverse syms))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1888 (thissym (nth 1 sbounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1889 (nextsym (car-safe (cdr rsym)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1890 (complst nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1891 (when (and thissym (or (not (string= thissym ""))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1892 nextsym))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1893 ;; Do a quick calcuation of completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1894 (semantic-collector-calculate-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1895 collector thissym nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1896 ;; Get the master list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1897 (setq complst (semanticdb-strip-find-results
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1898 (semantic-collector-all-completions collector thissym)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1899 ;; Shorten by name
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1900 (setq complst (semantic-unique-tag-table-by-name complst))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1901 (if (or (and (= (length complst) 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1902 ;; Check to see if it is the same as what is there.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1903 ;; if so, we can offer to complete.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1904 (let ((compname (semantic-tag-name (car complst))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1905 (not (string= compname thissym))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1906 (> (length complst) 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1907 ;; There are several options. Do the completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1908 (semantic-complete-inline-tag-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1909 collector
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1910 (funcall semantic-complete-inline-analyzer-displayor-class
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1911 "inline displayor")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1912 ;;(semantic-displayor-tooltip "simple")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1913 (current-buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1914 start end))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1915 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1916
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1917 (defun semantic-complete-read-tag-analyzer (prompt &optional
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1918 context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1919 history)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1920 "Ask for a tag by name based on the current context.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1921 The function `semantic-analyze-current-context' is used to
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1922 calculate the context. `semantic-analyze-possible-completions' is used
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1923 to generate the list of possible completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1924 PROMPT is the first part of the prompt. Additional prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1925 is added based on the contexts full prefix.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1926 CONTEXT is the semantic analyzer context to start with.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105279
diff changeset
1927 HISTORY is a symbol representing a variable to store the history in.
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1928 usually a default-tag and initial-input are available for completion
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1929 prompts. these are calculated from the CONTEXT variable passed in."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1930 (if (not context) (setq context (semantic-analyze-current-context (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1931 (let* ((syms (semantic-ctxt-current-symbol (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1932 (inp (car (reverse syms))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1933 (setq syms (nreverse (cdr (nreverse syms))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1934 (semantic-complete-read-tag-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1935 (semantic-collector-analyze-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1936 prompt
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1937 :buffer (oref context buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1938 :context context)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1939 (semantic-displayor-traditional-with-focus-highlight "simple")
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105652
diff changeset
1940 (with-current-buffer (oref context buffer)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1941 (goto-char (cdr (oref context bounds)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1942 (concat prompt (mapconcat 'identity syms ".")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1943 (if syms "." "")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1944 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1945 nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1946 inp
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1947 history)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1948
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1949 (defun semantic-complete-inline-analyzer (context)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1950 "Complete a symbol name by name based on the current context.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1951 This is similar to `semantic-complete-read-tag-analyze', except
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1952 that the completion interaction is in the buffer where the context
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1953 was calculated from.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1954 CONTEXT is the semantic analyzer context to start with.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1955 Customize `semantic-complete-inline-analyzer-displayor-class'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1956 to control how completion options are displayed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1957
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1958 See `semantic-complete-inline-tag-engine' for details on how
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1959 completion works."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1960 (if (not context) (setq context (semantic-analyze-current-context (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1961 (if (not context) (error "Nothing to complete on here"))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1962 (let* ((collector (semantic-collector-analyze-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1963 "inline"
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1964 :buffer (oref context buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1965 :context context))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1966 (syms (semantic-ctxt-current-symbol (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1967 (rsym (reverse syms))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1968 (thissym (car rsym))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1969 (nextsym (car-safe (cdr rsym)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1970 (complst nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1971 (when (and thissym (or (not (string= thissym ""))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1972 nextsym))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1973 ;; Do a quick calcuation of completions.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1974 (semantic-collector-calculate-completions
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1975 collector thissym nil)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1976 ;; Get the master list
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1977 (setq complst (semanticdb-strip-find-results
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1978 (semantic-collector-all-completions collector thissym)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1979 ;; Shorten by name
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1980 (setq complst (semantic-unique-tag-table-by-name complst))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1981 (if (or (and (= (length complst) 1)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1982 ;; Check to see if it is the same as what is there.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1983 ;; if so, we can offer to complete.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1984 (let ((compname (semantic-tag-name (car complst))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1985 (not (string= compname thissym))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1986 (> (length complst) 1))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1987 ;; There are several options. Do the completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1988 (semantic-complete-inline-tag-engine
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1989 collector
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1990 (funcall semantic-complete-inline-analyzer-displayor-class
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1991 "inline displayor")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1992 ;;(semantic-displayor-tooltip "simple")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1993 (oref context buffer)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1994 (car (oref context bounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1995 (cdr (oref context bounds))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1996 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1997 )))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1998
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1999 (defcustom semantic-complete-inline-analyzer-idle-displayor-class
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2000 'semantic-displayor-ghost
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2001 "*Class for displayor to use with inline completion at idle time."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2002 :group 'semantic
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2003 :type semantic-complete-inline-custom-type
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2004 )
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2005
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2006 (defun semantic-complete-inline-analyzer-idle (context)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2007 "Complete a symbol name by name based on the current context for idle time.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2008 CONTEXT is the semantic analyzer context to start with.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2009 This function is used from `semantic-idle-completions-mode'.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2010
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2011 This is the same as `semantic-complete-inline-analyzer', except that
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2012 it uses `semantic-complete-inline-analyzer-idle-displayor-class'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2013 to control how completions are displayed.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2014
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2015 See `semantic-complete-inline-tag-engine' for details on how
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2016 completion works."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2017 (let ((semantic-complete-inline-analyzer-displayor-class
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2018 semantic-complete-inline-analyzer-idle-displayor-class))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2019 (semantic-complete-inline-analyzer context)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2020 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2021
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2022
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2023 ;;;###autoload
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2024 (defun semantic-complete-jump-local ()
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2025 "Jump to a local semantic symbol."
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2026 (interactive)
106188
ac73aedf0825 * cedet/semantic/complete.el (semantic-complete-read-tag-engine)
Chong Yidong <cyd@stupidchicken.com>
parents: 106165
diff changeset
2027 (let ((tag (semantic-complete-read-tag-buffer-deep "Jump to symbol: ")))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2028 (when (semantic-tag-p tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2029 (push-mark)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2030 (goto-char (semantic-tag-start tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2031 (semantic-momentary-highlight-tag tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2032 (message "%S: %s "
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2033 (semantic-tag-class tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2034 (semantic-tag-name tag)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2035
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2036 ;;;###autoload
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2037 (defun semantic-complete-jump ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2038 "Jump to a semantic symbol."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2039 (interactive)
106188
ac73aedf0825 * cedet/semantic/complete.el (semantic-complete-read-tag-engine)
Chong Yidong <cyd@stupidchicken.com>
parents: 106165
diff changeset
2040 (let* ((tag (semantic-complete-read-tag-project "Jump to symbol: ")))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2041 (when (semantic-tag-p tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2042 (push-mark)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2043 (semantic-go-to-tag tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2044 (switch-to-buffer (current-buffer))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2045 (semantic-momentary-highlight-tag tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2046 (message "%S: %s "
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2047 (semantic-tag-class tag)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2048 (semantic-tag-name tag)))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2049
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2050 ;;;###autoload
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2051 (defun semantic-complete-jump-local-members ()
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2052 "Jump to a semantic symbol."
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2053 (interactive)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2054 (let* ((tag (semantic-complete-read-tag-local-members "Jump to symbol: ")))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2055 (when (semantic-tag-p tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2056 (let ((start (condition-case nil (semantic-tag-start tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2057 (error nil))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2058 (unless start
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2059 (error "Tag %s has no location" (semantic-format-tag-prototype tag)))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2060 (push-mark)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2061 (goto-char start)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2062 (semantic-momentary-highlight-tag tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2063 (message "%S: %s "
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2064 (semantic-tag-class tag)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2065 (semantic-tag-name tag))))))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2066
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2067 ;;;###autoload
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2068 (defun semantic-complete-analyze-and-replace ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2069 "Perform prompt completion to do in buffer completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2070 `semantic-analyze-possible-completions' is used to determine the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2071 possible values.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2072 The minibuffer is used to perform the completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2073 The result is inserted as a replacement of the text that was there."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2074 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2075 (let* ((c (semantic-analyze-current-context (point)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2076 (tag (save-excursion (semantic-complete-read-tag-analyzer "" c))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2077 ;; Take tag, and replace context bound with its name.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2078 (goto-char (car (oref c bounds)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2079 (delete-region (point) (cdr (oref c bounds)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2080 (insert (semantic-tag-name tag))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2081 (message "%S" (semantic-format-tag-summarize tag))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2082
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2083 ;;;###autoload
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2084 (defun semantic-complete-analyze-inline ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2085 "Perform prompt completion to do in buffer completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2086 `semantic-analyze-possible-completions' is used to determine the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2087 possible values.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2088 The function returns immediately, leaving the buffer in a mode that
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2089 will perform the completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2090 Configure `semantic-complete-inline-analyzer-displayor-class' to change
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2091 how completion options are displayed."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2092 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2093 ;; Only do this if we are not already completing something.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2094 (if (not (semantic-completion-inline-active-p))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2095 (semantic-complete-inline-analyzer
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2096 (semantic-analyze-current-context (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2097 ;; Report a message if things didn't startup.
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106188
diff changeset
2098 (if (and (called-interactively-p 'any)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2099 (not (semantic-completion-inline-active-p)))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2100 (message "Inline completion not needed.")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2101 ;; Since this is most likely bound to something, and not used
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2102 ;; at idle time, throw in a TAB for good measure.
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106188
diff changeset
2103 (semantic-complete-inline-TAB)))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2104
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2105 ;;;###autoload
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2106 (defun semantic-complete-analyze-inline-idle ()
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2107 "Perform prompt completion to do in buffer completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2108 `semantic-analyze-possible-completions' is used to determine the
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2109 possible values.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2110 The function returns immediately, leaving the buffer in a mode that
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2111 will perform the completion.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2112 Configure `semantic-complete-inline-analyzer-idle-displayor-class'
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2113 to change how completion options are displayed."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2114 (interactive)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2115 ;; Only do this if we are not already completing something.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2116 (if (not (semantic-completion-inline-active-p))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2117 (semantic-complete-inline-analyzer-idle
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2118 (semantic-analyze-current-context (point))))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2119 ;; Report a message if things didn't startup.
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106188
diff changeset
2120 (if (and (called-interactively-p 'interactive)
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2121 (not (semantic-completion-inline-active-p)))
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106188
diff changeset
2122 (message "Inline completion not needed.")))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2123
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2124 ;;;###autoload
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2125 (defun semantic-complete-self-insert (arg)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2126 "Like `self-insert-command', but does completion afterwards.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2127 ARG is passed to `self-insert-command'. If ARG is nil,
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2128 use `semantic-complete-analyze-inline' to complete."
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2129 (interactive "p")
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2130 ;; If we are already in a completion scenario, exit now, and then start over.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2131 (semantic-complete-inline-exit)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2132
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2133 ;; Insert the key
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2134 (self-insert-command arg)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2135
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2136 ;; Prepare for doing completion, but exit quickly if there is keyboard
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2137 ;; input.
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2138 (when (save-window-excursion
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2139 (save-excursion
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2140 (and (not (semantic-exit-on-input 'csi
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2141 (semantic-fetch-tags)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2142 (semantic-throw-on-input 'csi)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2143 nil))
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2144 (= arg 1)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2145 (not (semantic-exit-on-input 'csi
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2146 (semantic-analyze-current-context)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2147 (semantic-throw-on-input 'csi)
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 107149
diff changeset
2148 nil)))))
104419
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2149 (condition-case nil
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2150 (semantic-complete-analyze-inline)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2151 ;; Ignore errors. Seems likely that we'll get some once in a while.
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2152 (error nil))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2153 ))
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2154
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2155 (provide 'semantic/complete)
b1ac14799f78 cedet/semantic/analyze.el, cedet/semantic/complete.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2156
104457
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2157 ;; Local variables:
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2158 ;; generated-autoload-file: "loaddefs.el"
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2159 ;; generated-autoload-load-name: "semantic/complete"
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2160 ;; End:
724ff52eda98 lisp/cedet/semantic/complete.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104444
diff changeset
2161
104439
da5b2513c225 cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents: 104419
diff changeset
2162 ;;; semantic/complete.el ends here