]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/db.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / semantic / db.el
index 8d9cfcccd7d27784f021720a74509f73e7763a55..43e5e5b435b20ef7e7fa2f281c68274910b34f37 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/db.el --- Semantic tag database manager
 
-;; Copyright (C) 2000-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
@@ -124,6 +124,18 @@ for a new table not associated with a buffer."
 If the buffer is not in memory, load it with `find-file-noselect'."
   nil)
 
+;; This generic method allows for sloppier coding.  Many
+;; functions treat "table" as something that could be a buffer,
+;; file name, or other.  This makes use of table more robust.
+(defmethod semanticdb-full-filename (buffer-or-string)
+  "Fetch the full filename that BUFFER-OR-STRING refers to.
+This uses semanticdb to get a better file name."
+  (cond ((bufferp buffer-or-string)
+        (with-current-buffer buffer-or-string
+          (semanticdb-full-filename semanticdb-current-table)))
+       ((and (stringp buffer-or-string) (file-exists-p buffer-or-string))
+        (expand-file-name buffer-or-string))))
+
 (defmethod semanticdb-full-filename ((obj semanticdb-abstract-table))
   "Fetch the full filename that OBJ refers to.
 Abstract tables do not have file names associated with them."
@@ -469,7 +481,7 @@ other than :table."
   (let ((cache (oref table cache))
        (obj nil))
     (while (and (not obj) cache)
-      (if (eq (eieio--object-class (car cache)) desired-class)
+      (if (eq (eieio-object-class (car cache)) desired-class)
          (setq obj (car cache)))
       (setq cache (cdr cache)))
     (if obj
@@ -520,7 +532,7 @@ other than :table."
   (let ((cache (oref db cache))
        (obj nil))
     (while (and (not obj) cache)
-      (if (eq (eieio--object-class (car cache)) desired-class)
+      (if (eq (eieio-object-class (car cache)) desired-class)
          (setq obj (car cache)))
       (setq cache (cdr cache)))
     (if obj
@@ -560,8 +572,9 @@ This will call `semantic-fetch-tags' if that file is in memory."
    ;;
    ;; Already in a buffer, just do it.
    ((semanticdb-in-buffer-p obj)
-    (semanticdb-set-buffer obj)
-    (semantic-fetch-tags))
+    (save-excursion
+      (semanticdb-set-buffer obj)
+      (semantic-fetch-tags)))
    ;;
    ;; Not in a buffer.  Forcing a load.
    (force
@@ -697,7 +710,7 @@ form."
   (interactive)
   (unless noninteractive
     (message "Saving tag summaries..."))
-  (let ((semanticdb--inhibit-make-directory nil))
+  (let ((semanticdb--inhibit-make-directory noninteractive))
     (mapc 'semanticdb-save-db semanticdb-database-list))
   (unless noninteractive
     (message "Saving tag summaries...done")))