]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/complete.el
Add bug number.
[gnu-emacs] / lisp / cedet / semantic / complete.el
index 154defb417af2354b9df3d2d454b5fe2fabf934d..fa9ebed92636708acf70e7b48eb13c1a60d0f69f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/complete.el --- Routines for performing tag completion
 
-;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
+;; Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
@@ -192,7 +192,7 @@ Keeps STRINGS only in the history.")
                                                    default-tag initial-input
                                                    history)
   "Read a semantic tag, and return a tag for the selection.
-Argument COLLECTOR is an object which can be used to to calculate
+Argument COLLECTOR is an object which can be used to calculate
 a list of possible hits.  See `semantic-completion-collector-engine'
 for details on COLLECTOR.
 Argument DISPLAYOR is an object used to display a list of possible
@@ -224,7 +224,7 @@ HISTORY is a symbol representing a variable to story the history in."
       (if (string-match ":" prompt)
          (setq prompt (concat
                        (substring prompt 0 (match-beginning 0))
-                       " (" default-as-string ")"
+                       " (default " default-as-string ")"
                        (substring prompt (match-beginning 0))))
        (setq prompt (concat prompt " (" default-as-string "): "))))
     ;;
@@ -394,7 +394,7 @@ Return value can be:
 \f
 ;;; Keybindings
 ;;
-;; Keys are bound to to perform completion using our mechanisms.
+;; Keys are bound to perform completion using our mechanisms.
 ;; Do that work here.
 (defun semantic-complete-done ()
   "Accept the current input."
@@ -515,8 +515,13 @@ if INLINE, then completion is happening inline in a buffer."
        (semantic-displayor-set-completions
         displayor
         (or
-         (and (not (eq na 'displayend))
-              (semantic-collector-current-exact-match collector))
+         ;; For the below - This caused problems for Chong Yidong
+         ;; when experimenting with the completion engine.  I don't
+         ;; remember what the problem was though, and I wasn't sure why
+         ;; the below two lines were there since they obviously added
+         ;; some odd behavior.  -EML
+         ;; (and (not (eq na 'displayend))
+         ;;      (semantic-collector-current-exact-match collector))
          (semantic-collector-all-completions collector contents))
         contents)
        ;; Ask the displayor to display them.
@@ -553,8 +558,7 @@ if INLINE, then completion is happening inline in a buffer."
       (lambda () (interactive)
        (describe-variable 'semantic-complete-inline-map)))
     km)
-  "Keymap used while performing Semantic inline completion.
-\\{semantic-complete-inline-map}")
+  "Keymap used while performing Semantic inline completion.")
 
 (defface semantic-complete-inline-face
   '((((class color) (background dark))
@@ -734,7 +738,7 @@ DO NOT CALL THIS IF THE INLINE COMPLETION ENGINE IS NOT ACTIVE."
 (defun semantic-complete-inline-tag-engine
   (collector displayor buffer start end)
   "Perform completion based on semantic tags in a buffer.
-Argument COLLECTOR is an object which can be used to to calculate
+Argument COLLECTOR is an object which can be used to calculate
 a list of possible hits.  See `semantic-completion-collector-engine'
 for details on COLLECTOR.
 Argument DISPLAYOR is an object used to display a list of possible
@@ -947,8 +951,7 @@ 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
-  (let ((table (save-excursion
-                (set-buffer (oref obj buffer))
+  (let ((table (with-current-buffer (oref obj buffer)
                 semanticdb-current-table))
        (result (semantic-find-tags-for-completion
                 prefix
@@ -1227,8 +1230,7 @@ inserted into the current context.")
            (semantic-analyze-possible-completions (oref obj context))))
   ;; search our cached completion list.  make it look like a semanticdb
   ;; results type.
-  (list (cons (save-excursion
-               (set-buffer (oref (oref obj context) buffer))
+  (list (cons (with-current-buffer (oref (oref obj context) buffer)
                semanticdb-current-table)
              (semantic-find-tags-for-completion
               prefix
@@ -1463,8 +1465,7 @@ one in the source buffer."
                   (and table (semanticdb-get-buffer table)))))
       ;; If no buffer is provided, then we can make up a summary buffer.
       (when (not buf)
-       (save-excursion
-         (set-buffer (get-buffer-create "*Completion Focus*"))
+       (with-current-buffer (get-buffer-create "*Completion Focus*")
          (erase-buffer)
          (insert "Focus on tag: \n")
          (insert (semantic-format-tag-summarize tag nil t) "\n\n")
@@ -1893,8 +1894,7 @@ prompts.  these are calculated from the CONTEXT variable passed in."
       :buffer (oref context buffer)
       :context context)
      (semantic-displayor-traditional-with-focus-highlight "simple")
-     (save-excursion
-       (set-buffer (oref context buffer))
+     (with-current-buffer (oref context buffer)
        (goto-char (cdr (oref context bounds)))
        (concat prompt (mapconcat 'identity syms ".")
               (if syms "." "")
@@ -1981,7 +1981,7 @@ completion works."
 (defun semantic-complete-jump-local ()
   "Jump to a semantic symbol."
   (interactive)
-  (let ((tag (semantic-complete-read-tag-buffer-deep "Symbol: ")))
+  (let ((tag (semantic-complete-read-tag-buffer-deep "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
       (goto-char (semantic-tag-start tag))
@@ -1994,7 +1994,7 @@ completion works."
 (defun semantic-complete-jump ()
   "Jump to a semantic symbol."
   (interactive)
-  (let* ((tag (semantic-complete-read-tag-project "Symbol: ")))
+  (let* ((tag (semantic-complete-read-tag-project "Jump to symbol: ")))
     (when (semantic-tag-p tag)
       (push-mark)
       (semantic-go-to-tag tag)
@@ -2035,13 +2035,12 @@ how completion options are displayed."
       (semantic-complete-inline-analyzer
        (semantic-analyze-current-context (point))))
   ;; Report a message if things didn't startup.
-  (if (and (interactive-p)
+  (if (and (called-interactively-p 'any)
           (not (semantic-completion-inline-active-p)))
       (message "Inline completion not needed.")
     ;; Since this is most likely bound to something, and not used
     ;; at idle time, throw in a TAB for good measure.
-    (semantic-complete-inline-TAB)
-    ))
+    (semantic-complete-inline-TAB)))
 
 ;;;###autoload
 (defun semantic-complete-analyze-inline-idle ()
@@ -2058,10 +2057,9 @@ to change how completion options are displayed."
       (semantic-complete-inline-analyzer-idle
        (semantic-analyze-current-context (point))))
   ;; Report a message if things didn't startup.
-  (if (and (interactive-p)
+  (if (and (called-interactively-p 'interactive)
           (not (semantic-completion-inline-active-p)))
-      (message "Inline completion not needed."))
-  )
+      (message "Inline completion not needed.")))
 
 ;;;###autoload
 (defun semantic-complete-self-insert (arg)
@@ -2096,7 +2094,6 @@ use `semantic-complete-analyze-inline' to complete."
 
 ;; Local variables:
 ;; generated-autoload-file: "loaddefs.el"
-;; generated-autoload-feature: semantic/loaddefs
 ;; generated-autoload-load-name: "semantic/complete"
 ;; End: