aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2014-12-14 12:59:05 +0200
committerDmitry Gutov2014-12-14 12:59:05 +0200
commitf7572b72fd448c8ab6002bc6a545dfb765bbc520 (patch)
tree96de7fc807e817c7046b602d63e3525f4185fdbd
parent9f28cb59dc77213e1496f4ded40017739d734114 (diff)
downloademacs-f7572b72fd448c8ab6002bc6a545dfb765bbc520.tar.gz
emacs-f7572b72fd448c8ab6002bc6a545dfb765bbc520.zip
Fix Semantic completion-at-point functions in non-Semantic buffers
Fixes: debbugs:19077 * lisp/cedet/semantic.el (semantic-analyze-completion-at-point-function) (semantic-analyze-notc-completion-at-point-function) (semantic-analyze-nolongprefix-completion-at-point-function): Do nothing if the current buffer is not using Semantic.
-rw-r--r--lisp/cedet/ChangeLog7
-rw-r--r--lisp/cedet/semantic.el57
2 files changed, 37 insertions, 27 deletions
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index c132a423f19..46296d3e39f 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,10 @@
12014-12-14 Dmitry Gutov <dgutov@yandex.ru>
2
3 * semantic.el (semantic-analyze-completion-at-point-function)
4 (semantic-analyze-notc-completion-at-point-function)
5 (semantic-analyze-nolongprefix-completion-at-point-function): Do
6 nothing if the current buffer is not using Semantic (bug#19077).
7
12014-12-08 Matt Curtis <matt.r.curtis@gmail.com> (tiny change) 82014-12-08 Matt Curtis <matt.r.curtis@gmail.com> (tiny change)
2 9
3 * pulse.el (pulse-momentary-highlight-one-line): Respect the POINT 10 * pulse.el (pulse-momentary-highlight-one-line): Respect the POINT
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 6bd090cf838..50e2082600b 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -1174,17 +1174,18 @@ Semantic mode.
1174 "Return possible analysis completions at point. 1174 "Return possible analysis completions at point.
1175The completions provided are via `semantic-analyze-possible-completions'. 1175The completions provided are via `semantic-analyze-possible-completions'.
1176This function can be used by `completion-at-point-functions'." 1176This function can be used by `completion-at-point-functions'."
1177 (let* ((ctxt (semantic-analyze-current-context)) 1177 (when (semantic-active-p)
1178 (possible (semantic-analyze-possible-completions ctxt))) 1178 (let* ((ctxt (semantic-analyze-current-context))
1179 1179 (possible (semantic-analyze-possible-completions ctxt)))
1180 ;; The return from this is either: 1180
1181 ;; nil - not applicable here. 1181 ;; The return from this is either:
1182 ;; A list: (START END COLLECTION . PROPS) 1182 ;; nil - not applicable here.
1183 (when possible 1183 ;; A list: (START END COLLECTION . PROPS)
1184 (list (car (oref ctxt bounds)) 1184 (when possible
1185 (cdr (oref ctxt bounds)) 1185 (list (car (oref ctxt bounds))
1186 possible)) 1186 (cdr (oref ctxt bounds))
1187 )) 1187 possible))
1188 )))
1188 1189
1189(defun semantic-analyze-notc-completion-at-point-function () 1190(defun semantic-analyze-notc-completion-at-point-function ()
1190 "Return possible analysis completions at point. 1191 "Return possible analysis completions at point.
@@ -1192,14 +1193,15 @@ The completions provided are via `semantic-analyze-possible-completions',
1192but with the 'no-tc option passed in, which means constraints based 1193but with the 'no-tc option passed in, which means constraints based
1193on what is being assigned to are ignored. 1194on what is being assigned to are ignored.
1194This function can be used by `completion-at-point-functions'." 1195This function can be used by `completion-at-point-functions'."
1195 (let* ((ctxt (semantic-analyze-current-context)) 1196 (when (semantic-active-p)
1196 (possible (semantic-analyze-possible-completions ctxt 'no-tc))) 1197 (let* ((ctxt (semantic-analyze-current-context))
1198 (possible (semantic-analyze-possible-completions ctxt 'no-tc)))
1197 1199
1198 (when possible 1200 (when possible
1199 (list (car (oref ctxt bounds)) 1201 (list (car (oref ctxt bounds))
1200 (cdr (oref ctxt bounds)) 1202 (cdr (oref ctxt bounds))
1201 possible)) 1203 possible))
1202 )) 1204 )))
1203 1205
1204(defun semantic-analyze-nolongprefix-completion-at-point-function () 1206(defun semantic-analyze-nolongprefix-completion-at-point-function ()
1205 "Return possible analysis completions at point. 1207 "Return possible analysis completions at point.
@@ -1207,15 +1209,16 @@ The completions provided are via `semantic-analyze-possible-completions',
1207but with the 'no-tc and 'no-longprefix option passed in, which means 1209but with the 'no-tc and 'no-longprefix option passed in, which means
1208constraints resulting in a long multi-symbol dereference are ignored. 1210constraints resulting in a long multi-symbol dereference are ignored.
1209This function can be used by `completion-at-point-functions'." 1211This function can be used by `completion-at-point-functions'."
1210 (let* ((ctxt (semantic-analyze-current-context)) 1212 (when (semantic-active-p)
1211 (possible (semantic-analyze-possible-completions 1213 (let* ((ctxt (semantic-analyze-current-context))
1212 ctxt 'no-tc 'no-longprefix))) 1214 (possible (semantic-analyze-possible-completions
1213 1215 ctxt 'no-tc 'no-longprefix)))
1214 (when possible 1216
1215 (list (car (oref ctxt bounds)) 1217 (when possible
1216 (cdr (oref ctxt bounds)) 1218 (list (car (oref ctxt bounds))
1217 possible)) 1219 (cdr (oref ctxt bounds))
1218 )) 1220 possible))
1221 )))
1219 1222
1220;;; Autoload some functions that are not in semantic/loaddefs 1223;;; Autoload some functions that are not in semantic/loaddefs
1221 1224