aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-04-29 11:32:11 -0400
committerChong Yidong2010-04-29 11:32:11 -0400
commit3a07ffce2fe88d64f98deb072c3d35b61bb0a81a (patch)
tree49abf42b86970c97b86564402b31a31597aed5fb
parent3d14bb734b6d2c58d042ffe7e62762527e5048ca (diff)
downloademacs-3a07ffce2fe88d64f98deb072c3d35b61bb0a81a.tar.gz
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 @@
12010-04-29 Chong Yidong <cyd@stupidchicken.com>
2
3 * minibuffer.el (tags-completion-at-point-function): New function.
4 (completion-at-point-functions): Use it.
5
6 * cedet/semantic.el (semantic-completion-at-point-function): New function.
7 (semantic-mode): Use semantic-completion-at-point-function for
8 completion-at-point-functions instead.
9
10 * progmodes/etags.el (complete-tag): Revert last change.
11
12010-04-29 Alan Mackenzie <acm@muc.de> 122010-04-29 Alan Mackenzie <acm@muc.de>
2 13
3 * progmodes/cc-mode.el (c-extend-region-for-CPP): Fix an 14 * 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.
1083 ;; Add semantic-ia-complete-symbol to 1083 ;; Add semantic-ia-complete-symbol to
1084 ;; completion-at-point-functions, so that it is run from 1084 ;; completion-at-point-functions, so that it is run from
1085 ;; M-TAB. 1085 ;; M-TAB.
1086 (add-hook 'completion-at-point-functions 'semantic-ia-complete-symbol) 1086 (add-hook 'completion-at-point-functions
1087 'semantic-completion-at-point-function)
1087 (if global-ede-mode 1088 (if global-ede-mode
1088 (define-key cedet-menu-map [cedet-menu-separator] '("--"))) 1089 (define-key cedet-menu-map [cedet-menu-separator] '("--")))
1089 (dolist (b (buffer-list)) 1090 (dolist (b (buffer-list))
@@ -1091,7 +1092,8 @@ Semantic mode.
1091 (semantic-new-buffer-fcn)))) 1092 (semantic-new-buffer-fcn))))
1092 ;; Disable all Semantic features. 1093 ;; Disable all Semantic features.
1093 (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn) 1094 (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
1094 (remove-hook 'completion-at-point-functions 'semantic-ia-complete-symbol) 1095 (remove-hook 'completion-at-point-functions
1096 'semantic-completion-at-point-function)
1095 (define-key cedet-menu-map [cedet-menu-separator] nil) 1097 (define-key cedet-menu-map [cedet-menu-separator] nil)
1096 (define-key cedet-menu-map [semantic-options-separator] nil) 1098 (define-key cedet-menu-map [semantic-options-separator] nil)
1097 ;; FIXME: handle semanticdb-load-ebrowse-caches 1099 ;; FIXME: handle semanticdb-load-ebrowse-caches
@@ -1099,6 +1101,9 @@ Semantic mode.
1099 (if (and (boundp mode) (eval mode)) 1101 (if (and (boundp mode) (eval mode))
1100 (funcall mode -1))))) 1102 (funcall mode -1)))))
1101 1103
1104(defun semantic-completion-at-point-function ()
1105 'semantic-ia-complete-symbol)
1106
1102;;; Autoload some functions that are not in semantic/loaddefs 1107;;; Autoload some functions that are not in semantic/loaddefs
1103 1108
1104(autoload 'global-semantic-idle-completions-mode "semantic/idle" 1109(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."
1157 (call-interactively 'minibuffer-complete) 1157 (call-interactively 'minibuffer-complete)
1158 (delete-overlay ol))))) 1158 (delete-overlay ol)))))
1159 1159
1160(defvar completion-at-point-functions '(complete-tag) 1160(defvar completion-at-point-functions '(tags-completion-at-point-function)
1161 "Special hook to find the completion table for the thing at point. 1161 "Special hook to find the completion table for the thing at point.
1162It is called without any argument and should return either nil, 1162It is called without any argument and should return either nil,
1163or a function of no argument to perform completion (discouraged), 1163or a function of no argument to perform completion (discouraged),
@@ -1169,14 +1169,9 @@ Currently supported properties are:
1169 `:predicate' a predicate that completion candidates need to satisfy. 1169 `:predicate' a predicate that completion candidates need to satisfy.
1170 `:annotation-function' the value to use for `completion-annotate-function'.") 1170 `:annotation-function' the value to use for `completion-annotate-function'.")
1171 1171
1172(declare-function tags-lazy-completion-table "etags.el" ()) 1172(defun tags-completion-at-point-function ()
1173 1173 "Using tags, return a completion table for the text around point.
1174(defun complete-tag () 1174If no tags table is loaded, do nothing and return nil."
1175 "Perform tags completion on the text around point.
1176If no tags table is loaded, do nothing and return nil.
1177Otherwise, complete to the set of names listed in the tags table.
1178The string to complete is chosen in the same way as the default
1179for `find-tag'."
1180 (interactive) 1175 (interactive)
1181 (when (or tags-table-list tags-file-name) 1176 (when (or tags-table-list tags-file-name)
1182 (require 'etags) 1177 (require 'etags)
@@ -1185,14 +1180,11 @@ for `find-tag'."
1185 case-fold-search)) 1180 case-fold-search))
1186 (pattern (funcall (or find-tag-default-function 1181 (pattern (funcall (or find-tag-default-function
1187 (get major-mode 'find-tag-default-function) 1182 (get major-mode 'find-tag-default-function)
1188 'find-tag-default))) 1183 'find-tag-default))))
1189 (comp-table (tags-lazy-completion-table))
1190 beg)
1191 (when pattern 1184 (when pattern
1192 (search-backward pattern) 1185 (tags-lazy-completion-table)))))
1193 (setq beg (point)) 1186
1194 (forward-char (length pattern)) 1187(declare-function tags-lazy-completion-table "etags.el" ())
1195 (completion-in-region beg (point) comp-table)))))
1196 1188
1197(defun complete-symbol (&optional arg) 1189(defun complete-symbol (&optional arg)
1198 "Perform completion on the text around point. 1190 "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."
2027 (interactive) 2027 (interactive)
2028 (quit-window t (selected-window))) 2028 (quit-window t (selected-window)))
2029 2029
2030;;;###autoload
2031(defun complete-tag ()
2032 "Perform tags completion on the text around point.
2033Completes to the set of names listed in the current tags table.
2034The string to complete is chosen in the same way as the default
2035for \\[find-tag] (which see)."
2036 (interactive)
2037 (or tags-table-list
2038 tags-file-name
2039 (error "%s"
2040 (substitute-command-keys
2041 "No tags table loaded; try \\[visit-tags-table]")))
2042 (let ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
2043 tags-case-fold-search
2044 case-fold-search))
2045 (pattern (funcall (or find-tag-default-function
2046 (get major-mode 'find-tag-default-function)
2047 'find-tag-default)))
2048 (comp-table (tags-lazy-completion-table))
2049 beg)
2050 (or pattern
2051 (error "Nothing to complete"))
2052 (search-backward pattern)
2053 (setq beg (point))
2054 (forward-char (length pattern))
2055 (completion-in-region beg (point) comp-table)))
2056
2030(dolist (x '("^No tags table in use; use .* to select one$" 2057(dolist (x '("^No tags table in use; use .* to select one$"
2031 "^There is no default tag$" 2058 "^There is no default tag$"
2032 "^No previous tag locations$" 2059 "^No previous tag locations$"