summaryrefslogtreecommitdiff
path: root/lisp/cedet/semantic
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-06-14 15:15:09 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-14 15:15:09 +0200
commit595e12c2da7b5053f56f57ba59a6156ac239bbf0 (patch)
tree619386fee9e918d62a409729fd80ac740ce6543f /lisp/cedet/semantic
parentc213422fd33cf00ef0e2515ec9639bdc06ea45c5 (diff)
downloademacs-595e12c2da7b5053f56f57ba59a6156ac239bbf0.tar.gz
Move functions from semantic.el to analyze.el to avoid warnings
* lisp/cedet/semantic.el (semantic-analyze-completion-at-point-function) (semantic-analyze-notc-completion-at-point-function) (semantic-analyze-nolongprefix-completion-at-point-function): Add autoloads for the moved functions. * lisp/cedet/semantic/analyze.el (semantic-analyze-completion-at-point-function) (semantic-analyze-notc-completion-at-point-function) (semantic-analyze-nolongprefix-completion-at-point-function): Move here from semantic.el to avoid getting compilation warnings about unknown slot `bounds'.
Diffstat (limited to 'lisp/cedet/semantic')
-rw-r--r--lisp/cedet/semantic/analyze.el52
1 files changed, 52 insertions, 0 deletions
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index 8f1d92822e6..6851ad556a7 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -819,6 +819,58 @@ CONTEXT's content is described in `semantic-analyze-current-context'."
(get-buffer-window "*Semantic Context Analysis*"))
)
+
+;;; Completion At Point functions
+(defun semantic-analyze-completion-at-point-function ()
+ "Return possible analysis completions at point.
+The completions provided are via `semantic-analyze-possible-completions'.
+This function can be used by `completion-at-point-functions'."
+ (when (semantic-active-p)
+ (let* ((ctxt (semantic-analyze-current-context))
+ (possible (semantic-analyze-possible-completions ctxt)))
+
+ ;; The return from this is either:
+ ;; nil - not applicable here.
+ ;; A list: (START END COLLECTION . PROPS)
+ (when possible
+ (list (car (oref ctxt bounds))
+ (cdr (oref ctxt bounds))
+ possible))
+ )))
+
+(defun semantic-analyze-notc-completion-at-point-function ()
+ "Return possible analysis completions at point.
+The completions provided are via `semantic-analyze-possible-completions',
+but with the `no-tc' option passed in, which means constraints based
+on what is being assigned to are ignored.
+This function can be used by `completion-at-point-functions'."
+ (when (semantic-active-p)
+ (let* ((ctxt (semantic-analyze-current-context))
+ (possible (semantic-analyze-possible-completions ctxt 'no-tc)))
+
+ (when possible
+ (list (car (oref ctxt bounds))
+ (cdr (oref ctxt bounds))
+ possible))
+ )))
+
+(defun semantic-analyze-nolongprefix-completion-at-point-function ()
+ "Return possible analysis completions at point.
+The completions provided are via `semantic-analyze-possible-completions',
+but with the `no-tc' and `no-longprefix' option passed in, which means
+constraints resulting in a long multi-symbol dereference are ignored.
+This function can be used by `completion-at-point-functions'."
+ (when (semantic-active-p)
+ (let* ((ctxt (semantic-analyze-current-context))
+ (possible (semantic-analyze-possible-completions
+ ctxt 'no-tc 'no-longprefix)))
+
+ (when possible
+ (list (car (oref ctxt bounds))
+ (cdr (oref ctxt bounds))
+ possible))
+ )))
+
(provide 'semantic/analyze)
;; Local variables: