summaryrefslogtreecommitdiff
path: root/lisp/cedet/ede/base.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/cedet/ede/base.el')
-rw-r--r--lisp/cedet/ede/base.el36
1 files changed, 30 insertions, 6 deletions
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 1368ea348a..5302ac3207 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -135,7 +135,9 @@ other desired outcome.")
(dirinode :documentation "The inode id for :directory.")
(file :type string
:initarg :file
- :documentation "File name where this project is stored.")
+ :documentation "The File uniquely tagging this project instance.
+For some project types, this will be the file that stores the project configuration.
+In other projects types, this file is merely a unique identifier to this type of project.")
(rootproject ; :initarg - no initarg, don't save this slot!
:initform nil
:type (or null ede-project-placeholder-child)
@@ -350,12 +352,12 @@ All specific project types must derive from this project."
(defun ede-load-cache ()
"Load the cache of EDE projects."
(save-excursion
- (let ((cachebuffer nil))
+ (let ((cachebuffer (get-buffer-create "*ede cache*")))
(condition-case nil
- (progn
- (setq cachebuffer
- (find-file-noselect ede-project-placeholder-cache-file t))
- (set-buffer cachebuffer)
+ (with-current-buffer cachebuffer
+ (erase-buffer)
+ (when (file-exists-p ede-project-placeholder-cache-file)
+ (insert-file-contents ede-project-placeholder-cache-file))
(goto-char (point-min))
(let ((c (read (current-buffer)))
(new nil)
@@ -610,6 +612,28 @@ instead of the current project."
cp)))))
+;;; Utility functions
+;;
+
+(defun ede-normalize-file/directory (this project-file-name)
+ "Fills :directory or :file slots if they're missing in project THIS.
+The other slot will be used to calculate values.
+PROJECT-FILE-NAME is a name of project file (short name, like 'pom.xml', etc."
+ (when (and (or (not (slot-boundp this :file))
+ (not (oref this :file)))
+ (slot-boundp this :directory)
+ (oref this :directory))
+ (oset this :file (expand-file-name project-file-name (oref this :directory))))
+ (when (and (or (not (slot-boundp this :directory))
+ (not (oref this :directory)))
+ (slot-boundp this :file)
+ (oref this :file))
+ (oset this :directory (file-name-directory (oref this :file))))
+ )
+
+
+
+
;;; Hooks & Autoloads
;;
;; These let us watch various activities, and respond appropriately.