;;; semantic/db-file.el --- Save a semanticdb to a cache file.
-;;; Copyright (C) 2000-2005, 2007-2011 Free Software Foundation, Inc.
+;;; Copyright (C) 2000-2005, 2007-2015 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: tags
;; 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.")
(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."
: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."
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.
(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))
(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)
(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)
(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)
)
(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))
)
(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.