Spelling fixes.
[bpt/emacs.git] / lisp / cedet / semantic / complete.el
index 9c2da9f..47cf860 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/complete.el --- Routines for performing tag completion
 
-;; Copyright (C) 2003-2005, 2007-201 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2007-2014 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
@@ -678,7 +678,8 @@ a reasonable distance."
            ;;(message "Inline Hook installed, but overlay deleted.")
            (semantic-complete-inline-exit))
        ;; Exit if commands caused us to exit the area of interest
-       (let ((s (semantic-overlay-start semantic-complete-inline-overlay))
+       (let ((os (semantic-overlay-get semantic-complete-inline-overlay 'semantic-original-start))
+             (s (semantic-overlay-start semantic-complete-inline-overlay))
              (e (semantic-overlay-end semantic-complete-inline-overlay))
              (b (semantic-overlay-buffer semantic-complete-inline-overlay))
              (txt nil)
@@ -686,8 +687,10 @@ a reasonable distance."
          (cond
           ;; EXIT when we are no longer in a good place.
           ((or (not (eq b (current-buffer)))
-               (<= (point) s)
-               (> (point) e))
+               (< (point) s)
+               (< (point) os)
+               (> (point) e)
+               )
            ;;(message "Exit: %S %S %S" s e (point))
            (semantic-complete-inline-exit)
            )
@@ -710,7 +713,6 @@ a reasonable distance."
           (t
            ;; Else, show completions now
            (semantic-complete-inline-force-display)
-
            ))))
     ;; If something goes terribly wrong, clean up after ourselves.
     (error (semantic-complete-inline-exit))))
@@ -761,6 +763,10 @@ END is at the end of the current symbol being completed."
   (semantic-overlay-put semantic-complete-inline-overlay
                        'window-config-start
                        (current-window-configuration))
+  ;; Save the original start.  We need to exit completion if START
+  ;; moves.
+  (semantic-overlay-put semantic-complete-inline-overlay
+                       'semantic-original-start start)
   ;; Install our command hooks
   (add-hook 'pre-command-hook 'semantic-complete-pre-command-hook)
   (add-hook 'post-command-hook 'semantic-complete-post-command-hook)
@@ -982,14 +988,17 @@ Calculate the cache if there isn't one."
   "Calculate the completions for prefix from completionlist.
 Output must be in semanticdb Find result format."
   ;; Must output in semanticdb format
+  (unless completionlist
+    (setq completionlist
+         (or (oref obj cache)
+             (semantic-collector-calculate-cache obj))))
   (let ((table (with-current-buffer (oref obj buffer)
                 semanticdb-current-table))
        (result (semantic-find-tags-for-completion
                 prefix
                 ;; To do this kind of search with a pre-built completion
                 ;; list, we need to strip it first.
-                (semanticdb-strip-find-results completionlist)))
-       )
+                (semanticdb-strip-find-results completionlist))))
     (if result
        (list (cons table result)))))
 
@@ -1171,7 +1180,7 @@ These collectors track themselves on a per-buffer basis."
   (let ((old nil)
        (bl semantic-collector-per-buffer-list))
     (while (and bl (null old))
-      (if (eq (object-class (car bl)) this)
+      (if (eq (eieio-object-class (car bl)) this)
          (setq old (car bl))))
     (unless old
       (let ((new (call-next-method)))
@@ -1510,7 +1519,7 @@ one in the source buffer."
          (insert (semantic-format-tag-summarize tag nil t) "\n\n")
          (when table
            (insert "From table: \n")
-           (insert (object-name table) "\n\n"))
+           (insert (eieio-object-name table) "\n\n"))
          (when buf
            (insert "In buffer: \n\n")
            (insert (format "%S" buf)))
@@ -1625,6 +1634,8 @@ Display mechanism using tooltip for a list of possible completions.")
     (error nil))
   )
 
+(defvar tooltip-mode)
+
 (defmethod semantic-displayor-show-request ((obj semantic-displayor-tooltip))
   "A request to show the current tags table."
   (if (or (not (featurep 'tooltip)) (not tooltip-mode))
@@ -1658,7 +1669,7 @@ Display mechanism using tooltip for a list of possible completions.")
          (setq msg "...")))
        ((eq mode 'verbose)
        ;; Always show extended match set.
-       (oset obj max-tags semantic-displayor-tooltip-max-tags)
+       (oset obj max-tags-initial semantic-displayor-tooltip-max-tags)
        (setq max-tags semantic-displayor-tooltip-max-tags)))
       (unless msg
        (oset obj shown t)
@@ -1717,6 +1728,9 @@ Return a cons cell (X . Y)"
           (+ (cdr point-pix-pos) (cadr edges) top))))
 
 
+(defvar tooltip-frame-parameters)
+(declare-function tooltip-show "tooltip" (text &optional use-echo-area))
+
 (defun semantic-displayor-tooltip-show (text)
   "Display a tooltip with TEXT near cursor."
   (let ((point-pix-pos (semantic-displayor-point-position))
@@ -2088,6 +2102,7 @@ completion works."
 (defun semantic-complete-jump-local ()
   "Jump to a local semantic symbol."
   (interactive)
+  (semantic-error-if-unparsed)
   (let ((tag (semantic-complete-read-tag-buffer-deep "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
@@ -2101,6 +2116,7 @@ completion works."
 (defun semantic-complete-jump ()
   "Jump to a semantic symbol."
   (interactive)
+  (semantic-error-if-unparsed)
   (let* ((tag (semantic-complete-read-tag-project "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
@@ -2115,6 +2131,7 @@ completion works."
 (defun semantic-complete-jump-local-members ()
   "Jump to a semantic symbol."
   (interactive)
+  (semantic-error-if-unparsed)
   (let* ((tag (semantic-complete-read-tag-local-members "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (let ((start (condition-case nil (semantic-tag-start tag)
@@ -2216,7 +2233,7 @@ use `semantic-complete-analyze-inline' to complete."
       (error nil))
     ))
 
-;;;;###autoload
+;;;###autoload
 (defun semantic-complete-inline-project ()
   "Perform inline completion for any symbol in the current project.
 `semantic-analyze-possible-completions' is used to determine the