Commit 9a594ee6 authored by Chong Yidong's avatar Chong Yidong
Browse files

* bindings.el (complete-symbol): Call semantic-ia-complete-symbol if

possible.

* cedet/semantic/ia.el (semantic-ia-complete-symbol): Make argument
optional.
parent 212c5aef
2009-12-05 Chong Yidong <cyd@stupidchicken.com> 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). * shell.el (shell): Require ansi-color (Bug#5113).
* ansi-color.el (ansi-color-for-comint-mode): Default to t. * ansi-color.el (ansi-color-for-comint-mode): Default to t.
......
...@@ -671,23 +671,28 @@ is okay. See `mode-line-format'.") ...@@ -671,23 +671,28 @@ is okay. See `mode-line-format'.")
(define-key esc-map "\t" 'complete-symbol) (define-key esc-map "\t" 'complete-symbol)
(defun complete-symbol (arg) "\ (defun complete-symbol (arg)
Perform tags completion on the text around point. "Perform tags completion on the text around point.
Completes to the set of names listed in the current tags table. If a tags table is loaded, call `complete-tag'.
The string to complete is chosen in the same way as the default Otherwise, if Semantic is active, call `semantic-ia-complete-symbol'.
for \\[find-tag] (which see).
With a prefix argument, this command does completion within With a prefix argument, this command does completion within
the collection of symbols listed in the index of the manual for the the collection of symbols listed in the index of the manual for the
language you are using." language you are using."
(interactive "P") (interactive "P")
(if arg (cond (arg
(info-complete-symbol) (info-complete-symbol))
(if (fboundp 'complete-tag) ((or tags-table-list tags-file-name)
(complete-tag) (complete-tag))
;; Don't autoload etags if we have no tags table. ((and (fboundp 'semantic-ia-complete-symbol)
(error "%s" (substitute-command-keys (fboundp 'semantic-active-p)
"No tags table loaded; use \\[visit-tags-table] to load one"))))) (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 ;; Reduce total amount of space we must allocate during this function
;; that we will not need to keep permanently. ;; that we will not need to keep permanently.
......
...@@ -105,19 +105,21 @@ Supports caching." ...@@ -105,19 +105,21 @@ Supports caching."
symbols)) symbols))
;;;###autoload ;;;###autoload
(defun semantic-ia-complete-symbol (point) (defun semantic-ia-complete-symbol (&optional pos)
"Complete the current symbol at POINT. "Complete the current symbol at POS.
If POS is nil, default to point.
Completion options are calculated with `semantic-analyze-possible-completions'." Completion options are calculated with `semantic-analyze-possible-completions'."
(interactive "d") (interactive "d")
(or pos (setq pos (point)))
;; Calculating completions is a two step process. ;; Calculating completions is a two step process.
;; ;;
;; The first analyzer the current context, which finds tags ;; The first analyzer the current context, which finds tags
;; for all the stuff that may be references by the code around ;; for all the stuff that may be references by the code around
;; POINT. ;; POS.
;; ;;
;; The second step derives completions from that context. ;; The second step derives completions from that context.
(let* ((a (semantic-analyze-current-context point)) (let* ((a (semantic-analyze-current-context pos))
(syms (semantic-ia-get-completions a point)) (syms (semantic-ia-get-completions a pos))
(pre (car (reverse (oref a prefix)))) (pre (car (reverse (oref a prefix))))
) )
;; If PRE was actually an already completed symbol, it doesn't ;; If PRE was actually an already completed symbol, it doesn't
......
...@@ -2027,7 +2027,6 @@ see the doc of that variable if you want to add names to the list." ...@@ -2027,7 +2027,6 @@ see the doc of that variable if you want to add names to the list."
(interactive) (interactive)
(quit-window t (selected-window))) (quit-window t (selected-window)))
;; Note, there is another definition of this function in bindings.el.
;;;###autoload ;;;###autoload
(defun complete-tag () (defun complete-tag ()
"Perform tags completion on the text around point. "Perform tags completion on the text around point.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment