emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/last-cedet-merge b4bcc84 32/37: semantic: completi


From: David Engster
Subject: [Emacs-diffs] scratch/last-cedet-merge b4bcc84 32/37: semantic: completion fixes
Date: Sun, 22 Jan 2017 21:26:33 +0000 (UTC)

branch: scratch/last-cedet-merge
commit b4bcc8424f96db6d3357cc0ba5c45fcaedf6f0d3
Author: Eric Ludlam <address@hidden>
Commit: David Engster <address@hidden>

    semantic: completion fixes
    
    * lisp/cedet/semantic/complete.el (semantic-complete-read-tag-engine):
     Don't allow buffer switching.
     (semantic-collector-calculate-completions): Protect against
     cases where the context being completed with isn't a smart completion case.
---
 lisp/cedet/semantic/complete.el |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 5bd76f0..ba640a2 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -209,7 +209,8 @@ HISTORY is a symbol representing a variable to story the 
history in."
         (semantic-completion-display-engine displayor)
         (semantic-complete-active-default nil)
         (semantic-complete-current-matched-tag nil)
-        (default-as-tag (semantic-complete-default-to-tag default-tag))
+        (default-as-tag (save-current-buffer
+                          (semantic-complete-default-to-tag default-tag)))
         (default-as-string (when (semantic-tag-p default-as-tag)
                              (semantic-tag-name default-as-tag)))
         )
@@ -1026,14 +1027,19 @@ Output must be in semanticdb Find result format."
                      (eq (compare-strings
                           prefix 0 nil
                           last-prefix 0 (length prefix)) t))
-                  ;; The new prefix is a substring of the old
-                  ;; prefix, and it's longer than one character.
-                  ;; Perform a full search to pull in additional
-                  ;; matches.
-                (let ((context (semantic-analyze-current-context (point))))
-                  ;; Set new context and make first-pass-completions
-                  ;; unbound so that they are newly calculated.
-                  (oset obj context context)
+                ;; The new prefix is a substring of the old
+                ;; prefix, and it's longer than one character.
+                ;; Perform a full search to pull in additional
+                ;; matches.
+                (when (slot-exists-p obj 'context)
+                  ;; If this collector wants an analyzed context,
+                  ;; then restart here.
+                  (save-current-buffer
+                    (set-buffer (oref obj buffer))
+                    (let ((context (semantic-analyze-current-context (point))))
+                      ;; Set new context and make first-pass-completions
+                      ;; unbound so that they are newly calculated.
+                      (oset obj context context)))
                   (when (slot-boundp obj 'first-pass-completions)
                     (slot-makeunbound obj 'first-pass-completions)))
                 nil)))



reply via email to

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