]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/complete.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / semantic / complete.el
index 1c2ddf45c9de439bddd54458bbae874ba39e46df..f1fbc7538c2ccff3a20b2a6c7181e191d0e7bfb5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/complete.el --- Routines for performing tag completion
 
-;; Copyright (C) 2003-2005, 2007-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2007-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
 (eval-when-compile
   ;; For the semantic-find-tags-for-completion macro.
   (require 'semantic/find))
+(require 'semantic/db-find)          ;For type semanticdb-find-result-with-nil.
 
 ;;; Code:
 
@@ -988,14 +989,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)))))
 
@@ -1631,6 +1635,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))
@@ -1664,7 +1670,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)
@@ -1713,9 +1719,14 @@ Display mechanism using tooltip for a list of possible completions.")
   "Return the location of POINT as positioned on the selected frame.
 Return a cons cell (X . Y)"
   (let* ((frame (selected-frame))
-        (left (or (car-safe (cdr-safe (frame-parameter frame 'left)))
-                  (frame-parameter frame 'left)))
-         (top (or (car-safe (cdr-safe (frame-parameter frame 'top)))
+        (toolbarleft
+         (if (eq (cdr (assoc 'tool-bar-position default-frame-alist)) 'left)
+             (tool-bar-pixel-width)
+           0))
+        (left (+ (or (car-safe (cdr-safe (frame-parameter frame 'left)))
+                     (frame-parameter frame 'left))
+                 toolbarleft))
+        (top (or (car-safe (cdr-safe (frame-parameter frame 'top)))
                  (frame-parameter frame 'top)))
         (point-pix-pos (posn-x-y (posn-at-point)))
         (edges (window-inside-pixel-edges (selected-window))))
@@ -1723,6 +1734,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))
@@ -1960,7 +1974,7 @@ completion works."
         (complst nil))
     (when (and thissym (or (not (string= thissym ""))
                           nextsym))
-      ;; Do a quick calcuation of completions.
+      ;; Do a quick calculation of completions.
       (semantic-collector-calculate-completions
        collector thissym nil)
       ;; Get the master list
@@ -2040,7 +2054,7 @@ completion works."
         (complst nil))
     (when (and thissym (or (not (string= thissym ""))
                           nextsym))
-      ;; Do a quick calcuation of completions.
+      ;; Do a quick calculation of completions.
       (semantic-collector-calculate-completions
        collector thissym nil)
       ;; Get the master list