unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 3883f00856d28da1a26c4c4aebec78fa6451788d 4097 bytes (raw)
name: lisp/cedet/ede/simple.el 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
;;; ede/simple.el --- Overlay an EDE structure on an existing project

;; Copyright (C) 2007-2020 Free Software Foundation, Inc.

;; Author: Eric M. Ludlam <zappo@gnu.org>

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; NOTE: EDE Simple Projects are considered obsolete.  Use generic
;; projects instead.  They have much better automatic support and
;; simpler configuration.
;;
;; A vast majority of projects use non-EDE project techniques, such
;; as hand written Makefiles, or other IDE's.
;;
;; The EDE-SIMPLE project type allows EDE to wrap an existing mechanism
;; with minimal configuration, and then provides project-root
;; information to Semantic or other tools, and also provides structure
;; information for in-project include header discovery, or speedbar
;; support.
;;
;; It will also support a the minimal EDE UI for compilation and
;; configuration.

;; @todo - Add support for cpp-root as an ede-simple project.
;; @todo - Allow ede-simple to store locally.

(require 'ede)
(require 'cedet-files)

;;; Code:

(add-to-list 'ede-project-class-files
	     (ede-project-autoload
	      :name "Simple" :file 'ede/simple
	      :proj-file 'ede-simple-projectfile-for-dir
	      :load-type 'ede-simple-load
	      :class-sym 'ede-simple-project
	      :safe-p nil)
	     t)

(defcustom ede-simple-save-directory "~/.ede"
  "Directory where simple EDE project overlays are saved."
 :group 'ede
 :type 'directory)

(defcustom ede-simple-save-file-name "ProjSimple.ede"
  "File name used for simple project wrappers."
  :group 'ede
  :type 'string)

(defun ede-simple-projectfile-for-dir (&optional dir)
  "Return a full file name to the project file stored in the current directory.
The directory has three parts:
  <STORAGE ROOT>/<PROJ DIR AS FILE>/ProjSimple.ede"
  (let ((d (or dir default-directory)))
    (concat
     ;; Storage root
     (file-name-as-directory (expand-file-name ede-simple-save-directory))
     ;; Convert directory to filename
     (cedet-directory-name-to-file-name d)
     ;; Filename
     ede-simple-save-file-name)
    ))

(defun ede-simple-load (dir &optional rootproj)
  "Load a project of type `Simple' for the directory DIR.
Return nil if there isn't one.
ROOTPROJ is nil, since we will only create a single EDE project here."
  (let ((pf (ede-simple-projectfile-for-dir dir))
	(obj nil))
    (when pf
      (setq obj (eieio-persistent-read pf))
      (setf (oref obj :directory) dir))
    obj))

(defclass ede-simple-target (ede-target)
  ()
  "EDE Simple project target.
All directories need at least one target.")

(defclass ede-simple-project (ede-project eieio-persistent)
  ((extension :initform ".ede")
   (file-header-line :initform ";; EDE Simple Project")
   )
  "EDE Simple project class.
Each directory needs a project file to control it.")

(cl-defmethod ede-commit-project ((proj ede-simple-project))
  "Commit any change to PROJ to its file."
  (when (not (file-exists-p ede-simple-save-directory))
    (if (y-or-n-p (concat ede-simple-save-directory
			  " doesn't exist.  Create? "))
	(make-directory ede-simple-save-directory)
      (error "No save directory for new project")))
  (eieio-persistent-save proj))

(cl-defmethod ede-find-subproject-for-directory ((proj ede-simple-project)
					      dir)
  "Return PROJ, for handling all subdirs below DIR."
  proj)

(provide 'ede/simple)

;; Local variables:
;; generated-autoload-load-name: "ede/simple"
;; End:

;;; ede/simple.el ends here

debug log:

solving 3883f00856 ...
found 3883f00856 in https://yhetil.org/emacs-devel/87tv0vdxf6.fsf@tcd.ie/
found b1cfd6523f in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 b1cfd6523f950d35082d80cf2a1219d4ce1b2ff3	lisp/cedet/ede/simple.el

applying [1/1] https://yhetil.org/emacs-devel/87tv0vdxf6.fsf@tcd.ie/
diff --git a/lisp/cedet/ede/simple.el b/lisp/cedet/ede/simple.el
index b1cfd6523f..3883f00856 100644

Checking patch lisp/cedet/ede/simple.el...
Applied patch lisp/cedet/ede/simple.el cleanly.

index at:
100644 3883f00856d28da1a26c4c4aebec78fa6451788d	lisp/cedet/ede/simple.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).