]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/ede/emacs.el
Update copyright year to 2015
[gnu-emacs] / lisp / cedet / ede / emacs.el
index e3a5789cf3b875f70edac94ec985cfc99b093310..621e8951dd73ab346b1226a26c1314c4d46ecd82 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ede/emacs.el --- Special project for Emacs
 
-;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
 (declare-function semanticdb-refresh-table "semantic/db")
 
 ;;; Code:
-(defvar ede-emacs-project-list nil
-  "List of projects created by option `ede-emacs-project'.")
-
-(defun ede-emacs-file-existing (dir)
-  "Find a Emacs project in the list of Emacs projects.
-DIR is the directory to search from."
-  (let ((projs ede-emacs-project-list)
-       (ans nil))
-    (while (and projs (not ans))
-      (let ((root (ede-project-root-directory (car projs))))
-       (when (string-match (concat "^" (regexp-quote root))
-                           (file-name-as-directory dir))
-         (setq ans (car projs))))
-      (setq projs (cdr projs)))
-    ans))
 
-;;;###autoload
+;; @TODO - get rid of this.  Stuck in loaddefs right now.
+
 (defun ede-emacs-project-root (&optional dir)
   "Get the root directory for DIR."
-  (when (not dir) (setq dir default-directory))
-  (let ((case-fold-search t)
-       (proj (ede-emacs-file-existing dir)))
-    (if proj
-       (ede-up-directory (file-name-directory
-                          (oref proj :file)))
-      ;; No pre-existing project.  Let's take a wild-guess if we have
-      ;; an Emacs project here.
-      (when (string-match "emacs[^/]*" dir)
-       (let ((base (substring dir 0 (match-end 0))))
-         (when (file-exists-p (expand-file-name "src/emacs.c" base))
-             base))))))
+  nil)
 
 (defun ede-emacs-version (dir)
   "Find the Emacs version for the Emacs src in DIR.
@@ -80,12 +55,6 @@ Return a tuple of ( EMACSNAME . VERSION )."
     (with-current-buffer buff
       (erase-buffer)
       (setq default-directory (file-name-as-directory dir))
-      (or (file-exists-p configure_ac)
-         (setq configure_ac "configure.in"))
-      ;(call-process "egrep" nil buff nil "-n" "-e" "^version=" "Makefile")
-      (call-process "egrep" nil buff nil "-n" "-e" "AC_INIT" configure_ac)
-      (goto-char (point-min))
-      ;(re-search-forward "version=\\([0-9.]+\\)")
       (cond
        ;; Maybe XEmacs?
        ((file-exists-p "version.sh")
@@ -113,18 +82,19 @@ m4_define(\\[SXEM4CS_BETA_VERSION\\], \\[\\([0-9]+\\)\\])")
        ;; Insert other Emacs here...
 
        ;; Vaguely recent version of GNU Emacs?
-       (t
+       ((or (file-exists-p configure_ac)
+           (file-exists-p (setq configure_ac "configure.in")))
        (insert-file-contents configure_ac)
        (goto-char (point-min))
-       (re-search-forward "AC_INIT(emacs,\\s-*\\([0-9.]+\\)\\s-*)")
+       (re-search-forward "AC_INIT(\\(?:GNU \\)?[eE]macs,\\s-*\\([0-9.]+\\)\\s-*[,)]")
        (setq ver (match-string 1))
        )
        )
       ;; Return a tuple
       (cons emacs ver))))
 
-(defclass ede-emacs-project (ede-project eieio-instance-tracker)
-  ((tracking-symbol :initform 'ede-emacs-project-list)
+(defclass ede-emacs-project (ede-project)
+  (
    )
   "Project Type for the Emacs source code."
   :method-invocation-order :depth-first)
@@ -134,17 +104,15 @@ m4_define(\\[SXEM4CS_BETA_VERSION\\], \\[\\([0-9]+\\)\\])")
 Return nil if there isn't one.
 Argument DIR is the directory it is created for.
 ROOTPROJ is nil, since there is only one project."
-  (or (ede-emacs-file-existing dir)
-      ;; Doesn't already exist, so let's make one.
-      (let* ((vertuple (ede-emacs-version dir))
-            (proj (ede-emacs-project
-                   (car vertuple)
-                   :name (car vertuple)
-                   :version (cdr vertuple)
-                   :directory (file-name-as-directory dir)
-                   :file (expand-file-name "src/emacs.c"
-                                           dir))))
-       (ede-add-project-to-global-list proj))))
+  ;; Doesn't already exist, so let's make one.
+  (let* ((vertuple (ede-emacs-version dir)))
+    (ede-emacs-project
+     (car vertuple)
+     :name (car vertuple)
+     :version (cdr vertuple)
+     :directory (file-name-as-directory dir)
+     :file (expand-file-name "src/emacs.c"
+                            dir))))
 
 ;;;###autoload
 (ede-add-project-autoload
@@ -152,8 +120,6 @@ ROOTPROJ is nil, since there is only one project."
                       :name "EMACS ROOT"
                       :file 'ede/emacs
                       :proj-file "src/emacs.c"
-                      :proj-root-dirmatch "emacs[^/]*"
-                      :proj-root 'ede-emacs-project-root
                       :load-type 'ede-emacs-load
                       :class-sym 'ede-emacs-project
                       :new-p nil
@@ -307,6 +273,15 @@ Knows about how the Emacs source tree is organized."
       (ede-emacs-find-in-directories name dir dirs))
     ))
 
+;;; Command Support
+;;
+(defmethod project-rescan ((this ede-emacs-project))
+  "Rescan this Emacs project from the sources."
+  (let ((ver (ede-emacs-version (ede-project-root-directory this))))
+    (oset this name (car ver))
+    (oset this version (cdr ver))
+    ))
+
 (provide 'ede/emacs)
 
 ;; Local variables: