* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
[bpt/emacs.git] / lisp / cedet / semantic / analyze / debug.el
index 09c1e70..2b5325f 100644 (file)
 ;; Provide a top-order debugging tool for figuring out what's going on with
 ;; smart completion and analyzer mode.
 
+(require 'semantic)
 (require 'semantic/analyze)
+(require 'semantic/analyze/complete)
 (require 'semantic/db-typecache)
 
+;; For semantic-find-tags-by-class:
+(eval-when-compile (require 'semantic/find))
+
+(declare-function ede-get-locator-object "ede/files")
+
 ;;; Code:
 
 (defun semantic-analyze-debug-assist ()
@@ -97,8 +104,7 @@ Argument COMP are possible completions here."
        ;; NOTE: This line is copied from semantic-analyze-current-context.
        ;;       You will need to update both places.
        (condition-case err
-           (save-excursion
-             (set-buffer origbuf)
+           (with-current-buffer origbuf
              (let* ((position (or (cdr-safe (oref ctxt bounds)) (point)))
                     (prefixtypes nil) ; Used as type return
                     (scope (semantic-calculate-scope position))
@@ -239,13 +245,11 @@ with the command:
          (princ "\nSemantic has found the datatype ")
          (semantic-analyzer-debug-insert-tag dt)
          (if (or (not (semantic-equivalent-tag-p ots dt))
-                 (not (save-excursion
-                        (set-buffer orig-buffer)
+                 (not (with-current-buffer orig-buffer
                         (car (semantic-analyze-dereference-metatype
                          ots (oref ctxt scope))))))
              (let ((lasttype ots)
-                   (nexttype (save-excursion
-                               (set-buffer orig-buffer)
+                   (nexttype (with-current-buffer orig-buffer
                                (car (semantic-analyze-dereference-metatype
                                 ots (oref ctxt scope))))))
                (if (eq nexttype lasttype)
@@ -267,8 +271,7 @@ with the command:
                  (princ "\n")
                  (setq lasttype nexttype
                        nexttype
-                       (save-excursion
-                         (set-buffer orig-buffer)
+                       (with-current-buffer orig-buffer
                          (car (semantic-analyze-dereference-metatype
                           nexttype (oref ctxt scope)))))
                  )
@@ -375,28 +378,28 @@ or implementing a version specific to ")
       (princ "\n"))
     (princ "\n")))
 
+(defvar semantic-dependency-system-include-path)
+
 (defun semantic-analyzer-debug-insert-include-summary (table)
   "Display a summary of includes for the semanticdb TABLE."
+  (require 'semantic/dep)
   (semantic-fetch-tags)
   (let ((inc (semantic-find-tags-by-class 'include table))
        ;;(path (semanticdb-find-test-translate-path-no-loading))
        (unk
-        (save-excursion
-          (set-buffer (semanticdb-get-buffer table))
+        (with-current-buffer (semanticdb-get-buffer table)
           semanticdb-find-lost-includes))
        (ip
-        (save-excursion
-          (set-buffer (semanticdb-get-buffer table))
+        (with-current-buffer (semanticdb-get-buffer table)
           semantic-dependency-system-include-path))
        (edeobj
-        (save-excursion
-          (set-buffer (semanticdb-get-buffer table))
-          ede-object))
+        (with-current-buffer (semanticdb-get-buffer table)
+          (and (boundp 'ede-object)
+               ede-object)))
        (edeproj
-        (save-excursion
-          (set-buffer (semanticdb-get-buffer table))
-          ede-object-project))
-       )
+        (with-current-buffer (semanticdb-get-buffer table)
+          (and (boundp 'ede-object-project)
+               ede-object-project))))
 
     (princ "\n\nInclude Path Summary:")
     (when edeobj
@@ -578,9 +581,8 @@ PARENT is a possible parent (by nesting) tag."
 Look for key expressions, and add push-buttons near them."
   (let ((orig-buffer (make-marker)))
     (set-marker orig-buffer (point) (current-buffer))
-    (save-excursion
-      ;; Get a buffer ready.
-      (set-buffer "*Help*")
+    ;; Get a buffer ready.
+    (with-current-buffer "*Help*"
       (toggle-read-only -1)
       (goto-char (point-min))
       (set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer)
@@ -610,4 +612,5 @@ Look for key expressions, and add push-buttons near them."
 
 (provide 'semantic/analyze/debug)
 
+;; arch-tag: 943db1e5-47e6-4bec-9989-78ebfadf0358
 ;;; semantic/analyze/debug.el ends here