summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-04-29 11:32:11 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-04-29 11:32:11 -0400
commit3a07ffce2fe88d64f98deb072c3d35b61bb0a81a (patch)
tree49abf42b86970c97b86564402b31a31597aed5fb
parent3d14bb734b6d2c58d042ffe7e62762527e5048ca (diff)
downloademacs-3a07ffce2fe88d64f98deb072c3d35b61bb0a81a.tar.gz
emacs-3a07ffce2fe88d64f98deb072c3d35b61bb0a81a.tar.bz2
emacs-3a07ffce2fe88d64f98deb072c3d35b61bb0a81a.zip
* minibuffer.el (tags-completion-at-point-function): New function.
(completion-at-point-functions): Use it. * cedet/semantic.el (semantic-completion-at-point-function): New function. (semantic-mode): Use semantic-completion-at-point-function for completion-at-point-functions instead. * progmodes/etags.el (complete-tag): Revert last change.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/cedet/semantic.el9
-rw-r--r--lisp/minibuffer.el24
-rw-r--r--lisp/progmodes/etags.el27
4 files changed, 53 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d752fd3fb69..e04ebf63812 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
+2010-04-29 Chong Yidong <cyd@stupidchicken.com>
+
+ * minibuffer.el (tags-completion-at-point-function): New function.
+ (completion-at-point-functions): Use it.
+
+ * cedet/semantic.el (semantic-completion-at-point-function): New function.
+ (semantic-mode): Use semantic-completion-at-point-function for
+ completion-at-point-functions instead.
+
+ * progmodes/etags.el (complete-tag): Revert last change.
+
2010-04-29 Alan Mackenzie <acm@muc.de>
* progmodes/cc-mode.el (c-extend-region-for-CPP): Fix an
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 8df4feaa2bb..99e594a4638 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -1083,7 +1083,8 @@ Semantic mode.
;; Add semantic-ia-complete-symbol to
;; completion-at-point-functions, so that it is run from
;; M-TAB.
- (add-hook 'completion-at-point-functions 'semantic-ia-complete-symbol)
+ (add-hook 'completion-at-point-functions
+ 'semantic-completion-at-point-function)
(if global-ede-mode
(define-key cedet-menu-map [cedet-menu-separator] '("--")))
(dolist (b (buffer-list))
@@ -1091,7 +1092,8 @@ Semantic mode.
(semantic-new-buffer-fcn))))
;; Disable all Semantic features.
(remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
- (remove-hook 'completion-at-point-functions 'semantic-ia-complete-symbol)
+ (remove-hook 'completion-at-point-functions
+ 'semantic-completion-at-point-function)
(define-key cedet-menu-map [cedet-menu-separator] nil)
(define-key cedet-menu-map [semantic-options-separator] nil)
;; FIXME: handle semanticdb-load-ebrowse-caches
@@ -1099,6 +1101,9 @@ Semantic mode.
(if (and (boundp mode) (eval mode))
(funcall mode -1)))))
+(defun semantic-completion-at-point-function ()
+ 'semantic-ia-complete-symbol)
+
;;; Autoload some functions that are not in semantic/loaddefs
(autoload 'global-semantic-idle-completions-mode "semantic/idle"
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index b44742c0bdc..80e5f0ad10f 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1157,7 +1157,7 @@ Point needs to be somewhere between START and END."
(call-interactively 'minibuffer-complete)
(delete-overlay ol)))))
-(defvar completion-at-point-functions '(complete-tag)
+(defvar completion-at-point-functions '(tags-completion-at-point-function)
"Special hook to find the completion table for the thing at point.
It is called without any argument and should return either nil,
or a function of no argument to perform completion (discouraged),
@@ -1169,14 +1169,9 @@ Currently supported properties are:
`:predicate' a predicate that completion candidates need to satisfy.
`:annotation-function' the value to use for `completion-annotate-function'.")
-(declare-function tags-lazy-completion-table "etags.el" ())
-
-(defun complete-tag ()
- "Perform tags completion on the text around point.
-If no tags table is loaded, do nothing and return nil.
-Otherwise, complete to the set of names listed in the tags table.
-The string to complete is chosen in the same way as the default
-for `find-tag'."
+(defun tags-completion-at-point-function ()
+ "Using tags, return a completion table for the text around point.
+If no tags table is loaded, do nothing and return nil."
(interactive)
(when (or tags-table-list tags-file-name)
(require 'etags)
@@ -1185,14 +1180,11 @@ for `find-tag'."
case-fold-search))
(pattern (funcall (or find-tag-default-function
(get major-mode 'find-tag-default-function)
- 'find-tag-default)))
- (comp-table (tags-lazy-completion-table))
- beg)
+ 'find-tag-default))))
(when pattern
- (search-backward pattern)
- (setq beg (point))
- (forward-char (length pattern))
- (completion-in-region beg (point) comp-table)))))
+ (tags-lazy-completion-table)))))
+
+(declare-function tags-lazy-completion-table "etags.el" ())
(defun complete-symbol (&optional arg)
"Perform completion on the text around point.
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index bde75179be8..23e175cbe7d 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2027,6 +2027,33 @@ see the doc of that variable if you want to add names to the list."
(interactive)
(quit-window t (selected-window)))
+;;;###autoload
+(defun complete-tag ()
+ "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)."
+ (interactive)
+ (or tags-table-list
+ tags-file-name
+ (error "%s"
+ (substitute-command-keys
+ "No tags table loaded; try \\[visit-tags-table]")))
+ (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
+ tags-case-fold-search
+ case-fold-search))
+ (pattern (funcall (or find-tag-default-function
+ (get major-mode 'find-tag-default-function)
+ 'find-tag-default)))
+ (comp-table (tags-lazy-completion-table))
+ beg)
+ (or pattern
+ (error "Nothing to complete"))
+ (search-backward pattern)
+ (setq beg (point))
+ (forward-char (length pattern))
+ (completion-in-region beg (point) comp-table)))
+
(dolist (x '("^No tags table in use; use .* to select one$"
"^There is no default tag$"
"^No previous tag locations$"