1 ;;; ede/simple.el --- Overlay an EDE structure on an existing project
3 ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 ;; A vast majority of projects use non-EDE project techniques, such
25 ;; as hand written Makefiles, or other IDE's.
27 ;; The EDE-SIMPLE project type allows EDE to wrap an existing mechanism
28 ;; with minimal configuration, and then provides project-root
29 ;; information to Semantic or other tools, and also provides structure
30 ;; information for in-project include header discovery, or speedbar
33 ;; It will also support a the minimal EDE UI for compilation and
36 ;; @todo - Add support for cpp-root as an ede-simple project.
37 ;; @todo - Allow ede-simple to store locally.
40 (require 'cedet-files
)
44 (defcustom ede-simple-save-directory
"~/.ede"
45 "*Directory where simple EDE project overlays are saved."
49 (defcustom ede-simple-save-file-name
"ProjSimple.ede"
50 "*File name used for simple project wrappers."
54 (defun ede-simple-projectfile-for-dir (&optional dir
)
55 "Return a full file name to the project file stored in the current directory.
56 The directory has three parts:
57 <STORAGE ROOT>/<PROJ DIR AS FILE>/ProjSimple.ede"
58 (let ((d (or dir default-directory
)))
61 (file-name-as-directory (expand-file-name ede-simple-save-directory
))
62 ;; Convert directory to filename
63 (cedet-directory-name-to-file-name d
)
65 ede-simple-save-file-name
)
68 (defun ede-simple-load (dir &optional rootproj
)
69 "Load a project of type `Simple' for the directory DIR.
70 Return nil if there isn't one.
71 ROOTPROJ is nil, since we will only create a single EDE project here."
72 (let ((pf (ede-simple-projectfile-for-dir dir
))
75 (setq obj
(eieio-persistent-read pf
))
76 (oset obj
:directory dir
)
80 (defclass ede-simple-target
(ede-target)
82 "EDE Simple project target.
83 All directories need at least one target.")
85 (defclass ede-simple-project
(ede-project eieio-persistent
)
86 ((extension :initform
".ede")
87 (file-header-line :initform
";; EDE Simple Project")
89 "EDE Simple project class.
90 Each directory needs a project file to control it.")
92 (defmethod ede-commit-project ((proj ede-simple-project
))
93 "Commit any change to PROJ to its file."
94 (when (not (file-exists-p ede-simple-save-directory
))
95 (if (y-or-n-p (concat ede-simple-save-directory
96 " doesn't exist. Create? "))
97 (make-directory ede-simple-save-directory
)
98 (error "No save directory for new project")))
99 (eieio-persistent-save proj
))
101 (defmethod ede-find-subproject-for-directory ((proj ede-simple-project
)
103 "Return PROJ, for handling all subdirs below DIR."
106 (provide 'ede
/simple
)
108 ;; arch-tag: a0c4264a-89ce-4364-afab-2512acd3b22a
109 ;;; ede/simple.el ends here