diff lisp/progmodes/etags.el @ 108166:15deb8699a13

* 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.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 29 Apr 2010 11:32:11 -0400
parents 56d11bda8235
children 8bcf1c901e9a
line wrap: on
line diff
--- a/lisp/progmodes/etags.el	Thu Apr 29 14:48:32 2010 +0000
+++ b/lisp/progmodes/etags.el	Thu Apr 29 11:32:11 2010 -0400
@@ -2027,6 +2027,33 @@
   (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$"