aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Ludlam2015-10-18 10:17:24 -0400
committerDavid Engster2017-01-22 22:25:16 +0100
commitb4bcc8424f96db6d3357cc0ba5c45fcaedf6f0d3 (patch)
treec9ec08c9c4fc04e3dd59176665322473532d2848
parent278c06c55479bca6ccbde13239de9a868fd8db23 (diff)
downloademacs-b4bcc8424f96db6d3357cc0ba5c45fcaedf6f0d3.tar.gz
emacs-b4bcc8424f96db6d3357cc0ba5c45fcaedf6f0d3.zip
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.
-rw-r--r--lisp/cedet/semantic/complete.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index 5bd76f018a1..ba640a2c5f0 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."
209 (semantic-completion-display-engine displayor) 209 (semantic-completion-display-engine displayor)
210 (semantic-complete-active-default nil) 210 (semantic-complete-active-default nil)
211 (semantic-complete-current-matched-tag nil) 211 (semantic-complete-current-matched-tag nil)
212 (default-as-tag (semantic-complete-default-to-tag default-tag)) 212 (default-as-tag (save-current-buffer
213 (semantic-complete-default-to-tag default-tag)))
213 (default-as-string (when (semantic-tag-p default-as-tag) 214 (default-as-string (when (semantic-tag-p default-as-tag)
214 (semantic-tag-name default-as-tag))) 215 (semantic-tag-name default-as-tag)))
215 ) 216 )
@@ -1026,14 +1027,19 @@ Output must be in semanticdb Find result format."
1026 (eq (compare-strings 1027 (eq (compare-strings
1027 prefix 0 nil 1028 prefix 0 nil
1028 last-prefix 0 (length prefix)) t)) 1029 last-prefix 0 (length prefix)) t))
1029 ;; The new prefix is a substring of the old 1030 ;; The new prefix is a substring of the old
1030 ;; prefix, and it's longer than one character. 1031 ;; prefix, and it's longer than one character.
1031 ;; Perform a full search to pull in additional 1032 ;; Perform a full search to pull in additional
1032 ;; matches. 1033 ;; matches.
1033 (let ((context (semantic-analyze-current-context (point)))) 1034 (when (slot-exists-p obj 'context)
1034 ;; Set new context and make first-pass-completions 1035 ;; If this collector wants an analyzed context,
1035 ;; unbound so that they are newly calculated. 1036 ;; then restart here.
1036 (oset obj context context) 1037 (save-current-buffer
1038 (set-buffer (oref obj buffer))
1039 (let ((context (semantic-analyze-current-context (point))))
1040 ;; Set new context and make first-pass-completions
1041 ;; unbound so that they are newly calculated.
1042 (oset obj context context)))
1037 (when (slot-boundp obj 'first-pass-completions) 1043 (when (slot-boundp obj 'first-pass-completions)
1038 (slot-makeunbound obj 'first-pass-completions))) 1044 (slot-makeunbound obj 'first-pass-completions)))
1039 nil))) 1045 nil)))