comparison lisp/cedet/semantic/db-file.el @ 104510:8c44231178fc

* cedet/semantic/db.el (semanticdb--inhibit-make-directory): New var. (semanticdb-save-all-db): Use it. * cedet/semantic/db-file.el (semanticdb-default-save-directory): Save in user-emacs-directory instead of the home directory. (semanticdb-file-directory-exists-p): Avoid prompting the user multiple times.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 21 Sep 2009 18:20:50 +0000
parents e59328b6f117
children a6a812dd2d88
comparison
equal deleted inserted replaced
104509:32af6b5a433d 104510:8c44231178fc
36 "Version of semanticdb we are not reverse compatible with.") 36 "Version of semanticdb we are not reverse compatible with.")
37 37
38 ;;; Settings 38 ;;; Settings
39 ;; 39 ;;
40 (defcustom semanticdb-default-file-name "semantic.cache" 40 (defcustom semanticdb-default-file-name "semantic.cache"
41 "*File name of the semantic tag cache." 41 "File name of the semantic tag cache."
42 :group 'semanticdb 42 :group 'semanticdb
43 :type 'string) 43 :type 'string)
44 44
45 (defcustom semanticdb-default-save-directory (expand-file-name "~/.semanticdb") 45 (defcustom semanticdb-default-save-directory
46 "*Directory name where semantic cache files are stored. 46 (expand-file-name "semanticdb" user-emacs-directory)
47 "Directory name where semantic cache files are stored.
47 If this value is nil, files are saved in the current directory. If the value 48 If this value is nil, files are saved in the current directory. If the value
48 is a valid directory, then it overrides `semanticdb-default-file-name' and 49 is a valid directory, then it overrides `semanticdb-default-file-name' and
49 stores caches in a coded file name in this directory." 50 stores caches in a coded file name in this directory."
50 :group 'semanticdb 51 :group 'semanticdb
51 :type '(choice :tag "Default-Directory" 52 :type '(choice :tag "Default-Directory"
52 :menu-tag "Default-Directory" 53 :menu-tag "Default-Directory"
53 (const :tag "Use current directory" :value nil) 54 (const :tag "Use current directory" :value nil)
54 (directory))) 55 (directory)))
55 56
56 (defcustom semanticdb-persistent-path '(always) 57 (defcustom semanticdb-persistent-path '(always)
57 "*List of valid paths that semanticdb will cache tags to. 58 "List of valid paths that semanticdb will cache tags to.
58 When `global-semanticdb-minor-mode' is active, tag lists will 59 When `global-semanticdb-minor-mode' is active, tag lists will
59 be saved to disk when Emacs exits. Not all directories will have 60 be saved to disk when Emacs exits. Not all directories will have
60 tags that should be saved. 61 tags that should be saved.
61 The value should be a list of valid paths. A path can be a string, 62 The value should be a list of valid paths. A path can be a string,
62 indicating a directory in which to save a variable. An element in the 63 indicating a directory in which to save a variable. An element in the
66 passes a list of predicates in `semanticdb-project-predicate-functions'." 67 passes a list of predicates in `semanticdb-project-predicate-functions'."
67 :group 'semanticdb 68 :group 'semanticdb
68 :type nil) 69 :type nil)
69 70
70 (defcustom semanticdb-save-database-hooks nil 71 (defcustom semanticdb-save-database-hooks nil
71 "*Hooks run after a database is saved. 72 "Hooks run after a database is saved.
72 Each function is called with one argument, the object representing 73 Each function is called with one argument, the object representing
73 the database recently written." 74 the database recently written."
74 :group 'semanticdb 75 :group 'semanticdb
75 :type 'hook) 76 :type 'hook)
76 77
200 ) 201 )
201 (cond ((null dest) 202 (cond ((null dest)
202 ;; @TODO - If it was never set up... what should we do ? 203 ;; @TODO - If it was never set up... what should we do ?
203 nil) 204 nil)
204 ((file-exists-p dest) t) 205 ((file-exists-p dest) t)
205 (supress-questions nil) 206 ((or supress-questions
206 ((y-or-n-p (format "Create directory %s for SemanticDB? " 207 (and (boundp 'semanticdb--inhibit-make-directory)
207 dest)) 208 semanticdb--inhibit-make-directory))
209 nil)
210 ((y-or-n-p (format "Create directory %s for SemanticDB? " dest))
208 (make-directory dest t) 211 (make-directory dest t)
209 t) 212 t)
210 (t nil)) 213 (t (if (boundp 'semanticdb--inhibit-make-directory)
211 )) 214 (setq semanticdb--inhibit-make-directory t))
215 nil))))
212 216
213 (defmethod semanticdb-save-db ((DB semanticdb-project-database-file) 217 (defmethod semanticdb-save-db ((DB semanticdb-project-database-file)
214 &optional 218 &optional
215 supress-questions) 219 supress-questions)
216 "Write out the database DB to its file. 220 "Write out the database DB to its file.