emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master f7572b7: Fix Semantic completion-at-point functions


From: Dmitry Gutov
Subject: [Emacs-diffs] master f7572b7: Fix Semantic completion-at-point functions in non-Semantic buffers
Date: Sun, 14 Dec 2014 10:59:45 +0000

branch: master
commit f7572b72fd448c8ab6002bc6a545dfb765bbc520
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    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.
---
 lisp/cedet/ChangeLog   |    7 ++++++
 lisp/cedet/semantic.el |   57 +++++++++++++++++++++++++----------------------
 2 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index c132a42..46296d3 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-14  Dmitry Gutov  <address@hidden>
+
+       * 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 (bug#19077).
+
 2014-12-08  Matt Curtis  <address@hidden>  (tiny change)
 
        * pulse.el (pulse-momentary-highlight-one-line): Respect the POINT
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 6bd090c..50e2082 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -1174,17 +1174,18 @@ Semantic mode.
   "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'."
-  (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))
-    ))
+  (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.
@@ -1192,14 +1193,15 @@ 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'."
-  (let* ((ctxt (semantic-analyze-current-context))
-        (possible (semantic-analyze-possible-completions ctxt 'no-tc)))
+  (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))
-    ))
+      (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.
@@ -1207,15 +1209,16 @@ 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'."
-  (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))
-    ))
+  (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))
+      )))
 
 ;;; Autoload some functions that are not in semantic/loaddefs
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]