]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/db-file.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / semantic / db-file.el
index 661bc8d6841270ba47dbc397b53f14b7518aceb3..5b76d851b1d1d623736b402822151fefc7913619 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/db-file.el --- Save a semanticdb to a cache file.
 
-;;; Copyright (C) 2000-2005, 2007-201 Free Software Foundation, Inc.
+;;; Copyright (C) 2000-2005, 2007-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
@@ -25,9 +25,9 @@
 ;; A set of semanticdb classes for persistently saving caches on disk.
 ;;
 
-(require 'semantic)
 (require 'semantic/db)
 (require 'cedet-files)
+(require 'data-debug)
 
 (defvar semanticdb-file-version semantic-version
   "Version of semanticdb we are writing files to disk with.")
@@ -44,6 +44,8 @@
 (defcustom semanticdb-default-save-directory
   (locate-user-emacs-file "semanticdb" ".semanticdb")
   "Directory name where semantic cache files are stored.
+By default, it is either ~/.emacs.d/semanticdb, or ~/.semanticdb depending
+on which exists.
 If this value is nil, files are saved in the current directory.  If the value
 is a valid directory, then it overrides `semanticdb-default-file-name' and
 stores caches in a coded file name in this directory."
@@ -67,7 +69,9 @@ passes a list of predicates in `semanticdb-project-predicate-functions'."
   :group 'semanticdb
   :type nil)
 
-(defcustom semanticdb-save-database-hooks nil
+(define-obsolete-variable-alias 'semanticdb-save-database-hooks
+  'semanticdb-save-database-functions "24.3")
+(defcustom semanticdb-save-database-functions nil
   "Abnormal hook run after a database is saved.
 Each function is called with one argument, the object representing
 the database recently written."
@@ -140,7 +144,7 @@ If DIRECTORY doesn't exist, create a new one."
                          directory))
                        "/")
                :file fn :tables nil
-               :semantic-tag-version semantic-version
+               :semantic-tag-version semantic-tag-version
                :semanticdb-version semanticdb-file-version)))
     ;; Set this up here.   We can't put it in the constructor because it
     ;; would be saved, and we want DB files to be portable.
@@ -154,7 +158,7 @@ If DIRECTORY doesn't exist, create a new one."
 (defun semanticdb-load-database (filename)
   "Load the database FILENAME."
   (condition-case foo
-      (let* ((r (eieio-persistent-read filename))
+      (let* ((r (eieio-persistent-read filename semanticdb-project-database-file))
             (c (semanticdb-get-database-tables r))
             (tv (oref r semantic-tag-version))
             (fv (oref r semanticdb-version))
@@ -193,16 +197,16 @@ If DIRECTORY doesn't exist, create a new one."
   (eieio-instance-tracker-find filename 'file 'semanticdb-database-list))
 
 (defmethod semanticdb-file-directory-exists-p ((DB semanticdb-project-database-file)
-                                              &optional supress-questions)
+                                              &optional suppress-questions)
   "Does the directory the database DB needs to write to exist?
-If SUPRESS-QUESTIONS, then do not ask to create the directory."
+If SUPPRESS-QUESTIONS, then do not ask to create the directory."
   (let ((dest (file-name-directory (oref DB file)))
        )
     (cond ((null dest)
           ;; @TODO - If it was never set up... what should we do ?
           nil)
          ((file-exists-p dest) t)
-         ((or supress-questions
+         ((or suppress-questions
               (and (boundp 'semanticdb--inhibit-make-directory)
                    semanticdb--inhibit-make-directory))
           nil)
@@ -216,13 +220,13 @@ If SUPRESS-QUESTIONS, then do not ask to create the directory."
 
 (defmethod semanticdb-save-db ((DB semanticdb-project-database-file)
                               &optional
-                              supress-questions)
+                              suppress-questions)
   "Write out the database DB to its file.
 If DB is not specified, then use the current database."
   (let ((objname (oref DB file)))
     (when (and (semanticdb-dirty-p DB)
               (semanticdb-live-p DB)
-              (semanticdb-file-directory-exists-p DB supress-questions)
+              (semanticdb-file-directory-exists-p DB suppress-questions)
               (semanticdb-write-directory-p DB)
               )
       ;;(message "Saving tag summary for %s..." objname)
@@ -243,12 +247,12 @@ If DB is not specified, then use the current database."
          (t
           ;; @todo - It should ask if we are not called from a hook.
           ;;         How?
-          (if (or supress-questions
+          (if (or suppress-questions
                   (y-or-n-p (format "Skip Error: %s ?" (car (cdr foo)))))
               (message "Save Error: %S: %s" (car (cdr foo))
                        objname)
             (error "%S" (car (cdr foo))))))))
-      (run-hook-with-args 'semanticdb-save-database-hooks
+      (run-hook-with-args 'semanticdb-save-database-functions
                          (or DB semanticdb-current-database))
       ;;(message "Saving tag summary for %s...done" objname)
       )
@@ -289,7 +293,7 @@ Argument OBJ is the object to write."
        (when (and (boundp semantic-show-unmatched-syntax-mode)
                   semantic-show-unmatched-syntax-mode)
          ;; Only do this if the user runs unmatched syntax
-         ;; mode display enties.
+         ;; mode display entries.
          (oset obj unmatched-syntax
                (semantic-show-unmatched-lex-tokens-fetch))
          )
@@ -314,7 +318,7 @@ Argument OBJ is the object to write."
         (data-debug-new-buffer (concat "*SEMANTICDB ERROR*"))
         (data-debug-insert-thing obj "*" "")
         (setq semanticdb-data-debug-on-write-error nil))
-       (message "Error Writing Table: %s" (object-name obj))
+       (message "Error Writing Table: %s" (eieio-object-name obj))
        (error "%S" (car (cdr tableerror)))))
 
     ;; Clear the dirty bit.