Function: semantic-collector-try-completion-whitespace

semantic-collector-try-completion-whitespace is a byte-compiled function defined in complete.el.gz.

Signature

(semantic-collector-try-completion-whitespace ARG &rest ARGS)

Implementations

((obj semantic-collector-abstract) prefix) in `semantic/complete.el'.

For OBJ, do whitespace completion based on PREFIX. This implies that if there are two completions, one matching the test "prefix\>", and one not, the one matching the full word version of PREFIX will be chosen, and that text returned. This function requires that `semantic-collector-calculate-completions' has been run first.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/complete.el.gz
(cl-defmethod semantic-collector-try-completion-whitespace
  ((obj semantic-collector-abstract) prefix)
  "For OBJ, do whitespace completion based on PREFIX.
This implies that if there are two completions, one matching
the test \"prefix\\>\", and one not, the one matching the full
word version of PREFIX will be chosen, and that text returned.
This function requires that `semantic-collector-calculate-completions'
has been run first."
  (let* ((ac (semantic-collector-all-completions obj prefix))
	 (matchme (concat "^" prefix "\\>"))
	 (compare (semanticdb-find-tags-by-name-regexp matchme ac))
	 (numtag (semanticdb-find-result-length compare))
	 )
    (if compare
	(let* ((idx 0)
	       (cutlen (1+ (length prefix)))
	       (twws (semanticdb-find-result-nth compare idx)))
	  ;; Is our tag with whitespace a match that has whitespace
	  ;; after it, or just an already complete symbol?
	  (while (and (< idx numtag)
		      (< (length (semantic-tag-name (car twws))) cutlen))
	    (setq idx (1+ idx)
		  twws (semanticdb-find-result-nth compare idx)))
	  (when (and twws (car-safe twws))
	    ;; If COMPARE has succeeded, then we should take the very
	    ;; first match, and extend prefix by one character.
	    (oset obj last-whitespace-completion
		  (substring (semantic-tag-name (car twws))
			     0 cutlen))))
      )))