summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2009-12-05 22:01:00 +0000
committerChong Yidong <cyd@stupidchicken.com>2009-12-05 22:01:00 +0000
commit14ad517e65742c2c1e7c0f3e93bfb835d3c177d6 (patch)
treea9e231969bb1b3c7de7e719f32fa577ee0ec3b14
parentb6292a84dd5a02741d255eadd7bc7781f083b5b6 (diff)
downloademacs-14ad517e65742c2c1e7c0f3e93bfb835d3c177d6.tar.gz
* bindings.el (complete-symbol): Call semantic-ia-complete-symbol if
possible. * cedet/semantic/ia.el (semantic-ia-complete-symbol): Make argument optional.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/bindings.el29
-rw-r--r--lisp/cedet/semantic/ia.el12
-rw-r--r--lisp/progmodes/etags.el1
4 files changed, 30 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9a1d28e4829..95fb5d43b82 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
2009-12-05 Chong Yidong <cyd@stupidchicken.com>
+ * bindings.el (complete-symbol): Call semantic-ia-complete-symbol
+ if possible.
+
+ * cedet/semantic/ia.el (semantic-ia-complete-symbol): Make
+ argument optional.
+
* shell.el (shell): Require ansi-color (Bug#5113).
* ansi-color.el (ansi-color-for-comint-mode): Default to t.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index c02980f04b2..64c57d112c7 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -671,23 +671,28 @@ is okay. See `mode-line-format'.")
(define-key esc-map "\t" 'complete-symbol)
-(defun complete-symbol (arg) "\
-Perform tags completion on the text around point.
-Completes to the set of names listed in the current tags table.
-The string to complete is chosen in the same way as the default
-for \\[find-tag] (which see).
+(defun complete-symbol (arg)
+ "Perform tags completion on the text around point.
+If a tags table is loaded, call `complete-tag'.
+Otherwise, if Semantic is active, call `semantic-ia-complete-symbol'.
With a prefix argument, this command does completion within
the collection of symbols listed in the index of the manual for the
language you are using."
(interactive "P")
- (if arg
- (info-complete-symbol)
- (if (fboundp 'complete-tag)
- (complete-tag)
- ;; Don't autoload etags if we have no tags table.
- (error "%s" (substitute-command-keys
- "No tags table loaded; use \\[visit-tags-table] to load one")))))
+ (cond (arg
+ (info-complete-symbol))
+ ((or tags-table-list tags-file-name)
+ (complete-tag))
+ ((and (fboundp 'semantic-ia-complete-symbol)
+ (fboundp 'semantic-active-p)
+ (semantic-active-p))
+ (semantic-ia-complete-symbol))
+ (t
+ (error "%s"
+ (substitute-command-keys
+ "No completions available; use \\[visit-tags-table] \
+or \\[semantic-mode]")))))
;; Reduce total amount of space we must allocate during this function
;; that we will not need to keep permanently.
diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el
index 573f9fa867f..b0ae6301185 100644
--- a/lisp/cedet/semantic/ia.el
+++ b/lisp/cedet/semantic/ia.el
@@ -105,19 +105,21 @@ Supports caching."
symbols))
;;;###autoload
-(defun semantic-ia-complete-symbol (point)
- "Complete the current symbol at POINT.
+(defun semantic-ia-complete-symbol (&optional pos)
+ "Complete the current symbol at POS.
+If POS is nil, default to point.
Completion options are calculated with `semantic-analyze-possible-completions'."
(interactive "d")
+ (or pos (setq pos (point)))
;; Calculating completions is a two step process.
;;
;; The first analyzer the current context, which finds tags
;; for all the stuff that may be references by the code around
- ;; POINT.
+ ;; POS.
;;
;; The second step derives completions from that context.
- (let* ((a (semantic-analyze-current-context point))
- (syms (semantic-ia-get-completions a point))
+ (let* ((a (semantic-analyze-current-context pos))
+ (syms (semantic-ia-get-completions a pos))
(pre (car (reverse (oref a prefix))))
)
;; If PRE was actually an already completed symbol, it doesn't
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 2893fdfb766..82606362826 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2027,7 +2027,6 @@ see the doc of that variable if you want to add names to the list."
(interactive)
(quit-window t (selected-window)))
-;; Note, there is another definition of this function in bindings.el.
;;;###autoload
(defun complete-tag ()
"Perform tags completion on the text around point.