]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/ede.el
; Merge from origin/emacs-25
[gnu-emacs] / lisp / cedet / ede.el
index 074fda978621f65f032db085dfdb21d8db6f9d88..f013d4302b71e98969d520f00ab1e6d93a2c126a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ede.el --- Emacs Development Environment gloss
 
 ;;; ede.el --- Emacs Development Environment gloss
 
-;; Copyright (C) 1998-2005, 2007-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: project, make
@@ -40,6 +40,7 @@
 ;;  (global-ede-mode t)
 
 (require 'cedet)
 ;;  (global-ede-mode t)
 
 (require 'cedet)
+(require 'cl-lib)
 (require 'eieio)
 (require 'cl-generic)
 (require 'eieio-speedbar)
 (require 'eieio)
 (require 'cl-generic)
 (require 'eieio-speedbar)
   "Whether a new source file should be automatically added to a target.
 Whenever a new file is encountered in a directory controlled by a
 project file, all targets are queried to see if it should be added.
   "Whether a new source file should be automatically added to a target.
 Whenever a new file is encountered in a directory controlled by a
 project file, all targets are queried to see if it should be added.
-If the value is 'always, then the new file is added to the first
-target encountered.  If the value is 'multi-ask, then if more than one
+If the value is `always', then the new file is added to the first
+target encountered.  If the value is `multi-ask', then if more than one
 target wants the file, the user is asked.  If only one target wants
 the file, then it is automatically added to that target.  If the
 target wants the file, the user is asked.  If only one target wants
 the file, then it is automatically added to that target.  If the
-value is 'ask, then the user is always asked, unless there is no
-target willing to take the file.  'never means never perform the check."
+value is `ask', then the user is always asked, unless there is no
+target willing to take the file.  `never' means never perform the check."
   :group 'ede
   :type '(choice (const always)
                 (const multi-ask)
   :group 'ede
   :type '(choice (const always)
                 (const multi-ask)
@@ -95,7 +96,7 @@ target willing to take the file.  'never means never perform the check."
 (defcustom ede-debug-program-function 'gdb
   "Default Emacs command used to debug a target."
   :group 'ede
 (defcustom ede-debug-program-function 'gdb
   "Default Emacs command used to debug a target."
   :group 'ede
-  :type 'sexp) ; make this be a list of options some day
+  :type 'function) ; make this be a list of options some day
 
 (defcustom ede-project-directories nil
   "Directories in which EDE may search for project files.
 
 (defcustom ede-project-directories nil
   "Directories in which EDE may search for project files.
@@ -259,10 +260,10 @@ Argument LIST-O-O is the list of objects to choose from."
 (defun ede-menu-obj-of-class-p (class)
   "Return non-nil if some member of `ede-object' is a child of CLASS."
   (if (listp ede-object)
 (defun ede-menu-obj-of-class-p (class)
   "Return non-nil if some member of `ede-object' is a child of CLASS."
   (if (listp ede-object)
-      (eval (cons 'or (mapcar (lambda (o) (obj-of-class-p o class)) ede-object)))
+      (cl-some (lambda (o) (obj-of-class-p o class)) ede-object)
     (obj-of-class-p ede-object class)))
 
     (obj-of-class-p ede-object class)))
 
-(defun ede-build-forms-menu (menu-def)
+(defun ede-build-forms-menu (_menu-def)
   "Create a sub menu for building different parts of an EDE system.
 Argument MENU-DEF is the menu definition to use."
   (easy-menu-filter-return
   "Create a sub menu for building different parts of an EDE system.
 Argument MENU-DEF is the menu definition to use."
   (easy-menu-filter-return
@@ -306,7 +307,7 @@ Argument MENU-DEF is the menu definition to use."
        (append newmenu (list [ "Make distribution" ede-make-dist t ]))
        )))))
 
        (append newmenu (list [ "Make distribution" ede-make-dist t ]))
        )))))
 
-(defun ede-target-forms-menu (menu-def)
+(defun ede-target-forms-menu (_menu-def)
   "Create a target MENU-DEF based on the object belonging to this buffer."
   (easy-menu-filter-return
    (easy-menu-create-menu
   "Create a target MENU-DEF based on the object belonging to this buffer."
   (easy-menu-filter-return
    (easy-menu-create-menu
@@ -327,7 +328,7 @@ Argument MENU-DEF is the menu definition to use."
             ;; This is bad, but I'm not sure what else to do.
             (oref (car obj) menu)))))))))
 
             ;; This is bad, but I'm not sure what else to do.
             (oref (car obj) menu)))))))))
 
-(defun ede-project-forms-menu (menu-def)
+(defun ede-project-forms-menu (_menu-def)
   "Create a target MENU-DEF based on the object belonging to this buffer."
   (easy-menu-filter-return
    (easy-menu-create-menu
   "Create a target MENU-DEF based on the object belonging to this buffer."
   (easy-menu-filter-return
    (easy-menu-create-menu
@@ -339,7 +340,7 @@ Argument MENU-DEF is the menu definition to use."
          (progn
            (while (and class (slot-exists-p class 'menu))
              ;;(message "Looking at class %S" class)
          (progn
            (while (and class (slot-exists-p class 'menu))
              ;;(message "Looking at class %S" class)
-             (setq menu (append menu (oref class menu))
+             (setq menu (append menu (oref-default class menu))
                    class (eieio-class-parent class))
              (if (listp class) (setq class (car class))))
            (append
                    class (eieio-class-parent class))
              (if (listp class) (setq class (car class))))
            (append
@@ -353,7 +354,7 @@ Argument MENU-DEF is the menu definition to use."
               menu)
        )))))
 
               menu)
        )))))
 
-(defun ede-configuration-forms-menu (menu-def)
+(defun ede-configuration-forms-menu (_menu-def)
   "Create a submenu for selecting the default configuration for this project.
 The current default is in the current object's CONFIGURATION-DEFAULT slot.
 All possible configurations are in CONFIGURATIONS.
   "Create a submenu for selecting the default configuration for this project.
 The current default is in the current object's CONFIGURATION-DEFAULT slot.
 All possible configurations are in CONFIGURATIONS.
@@ -388,7 +389,7 @@ but can also be used interactively."
           (eieio-object-name (ede-current-project))
           newconfig))
 
           (eieio-object-name (ede-current-project))
           newconfig))
 
-(defun ede-customize-forms-menu (menu-def)
+(defun ede-customize-forms-menu (_menu-def)
   "Create a menu of the project, and targets that can be customized.
 Argument MENU-DEF is the definition of the current menu."
   (easy-menu-filter-return
   "Create a menu of the project, and targets that can be customized.
 Argument MENU-DEF is the definition of the current menu."
   (easy-menu-filter-return
@@ -411,7 +412,7 @@ Argument MENU-DEF is the definition of the current menu."
                        targ)))))))
 
 
                        targ)))))))
 
 
-(defun ede-apply-object-keymap (&optional default)
+(defun ede-apply-object-keymap (&optional _default)
   "Add target specific keybindings into the local map.
 Optional argument DEFAULT indicates if this should be set to the default
 version of the keymap."
   "Add target specific keybindings into the local map.
 Optional argument DEFAULT indicates if this should be set to the default
 version of the keymap."
@@ -419,14 +420,13 @@ version of the keymap."
        (proj ede-object-project))
     (condition-case nil
        (let ((keys (ede-object-keybindings object)))
        (proj ede-object-project))
     (condition-case nil
        (let ((keys (ede-object-keybindings object)))
-         ;; Add keys for the project to whatever is in the current object
-         ;; so long as it isn't the same.
-         (when (not (eq object proj))
-           (setq keys (append keys (ede-object-keybindings proj))))
-         (while keys
-           (local-set-key (concat "\C-c." (car (car keys)))
-                          (cdr (car keys)))
-           (setq keys (cdr keys))))
+         (dolist (key
+                   ;; Add keys for the project to whatever is in the current
+                   ;; object so long as it isn't the same.
+                   (if (eq object proj)
+                       keys
+                     (append keys (ede-object-keybindings proj))))
+           (local-set-key (concat "\C-c." (car key)) (cdr key))))
       (error nil))))
 
 ;;; Menu building methods for building
       (error nil))))
 
 ;;; Menu building methods for building
@@ -512,7 +512,7 @@ Sets buffer local variables for EDE."
        (when projdetect
          ;; No project was loaded, but we have a project description
          ;; object.  This means that we try to load it.
        (when projdetect
          ;; No project was loaded, but we have a project description
          ;; object.  This means that we try to load it.
-         ;; 
+         ;;
          ;; Before loading, we need to check if it is a safe
          ;; project to load before requesting it to be loaded.
 
          ;; Before loading, we need to check if it is a safe
          ;; project to load before requesting it to be loaded.
 
@@ -550,19 +550,15 @@ Sets buffer local variables for EDE."
 (defun ede-reset-all-buffers ()
   "Reset all the buffers due to change in EDE."
   (interactive)
 (defun ede-reset-all-buffers ()
   "Reset all the buffers due to change in EDE."
   (interactive)
-  (let ((b (buffer-list)))
-    (while b
-      (when (buffer-file-name (car b))
-       (with-current-buffer (car b)
-         ;; Reset all state variables
-         (setq ede-object nil
-               ede-object-project nil
-               ede-object-root-project nil)
-         ;; Now re-initialize this buffer.
-         (ede-initialize-state-current-buffer)
-         )
-       )
-      (setq b (cdr b)))))
+  (dolist (b (buffer-list))
+    (when (buffer-file-name b)
+      (with-current-buffer b
+        ;; Reset all state variables
+        (setq ede-object nil
+              ede-object-project nil
+              ede-object-root-project nil)
+        ;; Now re-initialize this buffer.
+        (ede-initialize-state-current-buffer)))))
 
 ;;;###autoload
 (define-minor-mode global-ede-mode
 
 ;;;###autoload
 (define-minor-mode global-ede-mode
@@ -626,13 +622,10 @@ of objects with the `ede-want-file-p' method."
   (if (or (eq ede-auto-add-method 'never)
          (ede-ignore-file (buffer-file-name)))
       nil
   (if (or (eq ede-auto-add-method 'never)
          (ede-ignore-file (buffer-file-name)))
       nil
-    (let (wants desires)
-      ;; Find all the objects.
-      (setq wants (oref (ede-current-project) targets))
-      (while wants
-       (if (ede-want-file-p (car wants) (buffer-file-name))
-           (setq desires (cons (car wants) desires)))
-       (setq wants (cdr wants)))
+    (let (desires)
+      (dolist (want (oref (ede-current-project) targets));Find all the objects.
+       (if (ede-want-file-p want (buffer-file-name))
+            (push want desires)))
       (if desires
          (cond ((or (eq ede-auto-add-method 'ask)
                     (and (eq ede-auto-add-method 'multi-ask)
       (if desires
          (cond ((or (eq ede-auto-add-method 'ask)
                     (and (eq ede-auto-add-method 'multi-ask)
@@ -728,9 +721,10 @@ Return nil if DIR should not be in `ede-project-directories'."
       (when (listp ede-project-directories)
        (or (member dir ede-project-directories)
            (when (funcall ede-check-project-query-fcn
       (when (listp ede-project-directories)
        (or (member dir ede-project-directories)
            (when (funcall ede-check-project-query-fcn
-                          (format "`%s' is not listed in `ede-project-directories'.
+                          (format-message
+                           "`%s' is not listed in `ede-project-directories'.
 Add it to the list of allowed project directories? "
 Add it to the list of allowed project directories? "
-                                  dir))
+                           dir))
              (push dir ede-project-directories)
              ;; If possible, save `ede-project-directories'.
              (if (or custom-file user-init-file)
              (push dir ede-project-directories)
              ;; If possible, save `ede-project-directories'.
              (if (or custom-file user-init-file)
@@ -753,7 +747,7 @@ Optional argument NAME is the name to give this project."
                                  (r nil))
                             (while l
                               (if cs
                                  (r nil))
                             (while l
                               (if cs
-                                  (if (eq (oref (car l) :class-sym)
+                                  (if (eq (oref (car l) class-sym)
                                           cs)
                                       (setq r (cons (car l) r)))
                                 (if (oref (car l) new-p)
                                           cs)
                                       (setq r (cons (car l) r)))
                                 (if (oref (car l) new-p)
@@ -763,7 +757,7 @@ Optional argument NAME is the name to give this project."
                               (if cs
                                   (error "No valid interactive sub project types for %s"
                                          cs)
                               (if cs
                                   (error "No valid interactive sub project types for %s"
                                          cs)
-                                (error "EDE error: Can't fin project types to create")))
+                                (error "EDE error: Can't find project types to create")))
                             r)
                           )
                          nil t)))
                             r)
                           )
                          nil t)))
@@ -799,11 +793,11 @@ Optional argument NAME is the name to give this project."
                                              "Unknown file name specifier %S"
                                              pf)))
                                :targets nil)
                                              "Unknown file name specifier %S"
                                              pf)))
                                :targets nil)
-                
+
                 ))
         (inits (oref obj initializers)))
     ;; Force the name to match for new objects.
                 ))
         (inits (oref obj initializers)))
     ;; Force the name to match for new objects.
-    (eieio-object-set-name-string nobj (oref nobj :name))
+    (eieio-object-set-name-string nobj (oref nobj name))
     ;; Handle init args.
     (while inits
       (eieio-oset nobj (car inits) (car (cdr inits)))
     ;; Handle init args.
     (while inits
       (eieio-oset nobj (car inits) (car (cdr inits)))
@@ -857,7 +851,7 @@ Different projects accept different arguments ARGS.
 Typically you can specify NAME, target TYPE, and AUTOADD, where AUTOADD is
 a string \"y\" or \"n\", which answers the y/n question done interactively."
   (interactive)
 Typically you can specify NAME, target TYPE, and AUTOADD, where AUTOADD is
 a string \"y\" or \"n\", which answers the y/n question done interactively."
   (interactive)
-  (apply 'project-new-target (ede-current-project) args)
+  (apply #'project-new-target (ede-current-project) args)
   (when (and buffer-file-name
             (not (file-directory-p buffer-file-name)))
     (setq ede-object nil)
   (when (and buffer-file-name
             (not (file-directory-p buffer-file-name)))
     (setq ede-object nil)
@@ -1003,21 +997,21 @@ Argument PROMPT is the prompt to use when querying the user for a target."
   "Make sure placeholder THIS is replaced with the real thing, and pass through."
   (project-add-file this file))
 
   "Make sure placeholder THIS is replaced with the real thing, and pass through."
   (project-add-file this file))
 
-(cl-defmethod project-add-file ((ot ede-target) file)
+(cl-defmethod project-add-file ((ot ede-target) _file)
   "Add the current buffer into project project target OT.
 Argument FILE is the file to add."
   (error "add-file not supported by %s" (eieio-object-name ot)))
 
   "Add the current buffer into project project target OT.
 Argument FILE is the file to add."
   (error "add-file not supported by %s" (eieio-object-name ot)))
 
-(cl-defmethod project-remove-file ((ot ede-target) fnnd)
+(cl-defmethod project-remove-file ((ot ede-target) _fnnd)
   "Remove the current buffer from project target OT.
 Argument FNND is an argument."
   (error "remove-file not supported by %s" (eieio-object-name ot)))
 
   "Remove the current buffer from project target OT.
 Argument FNND is an argument."
   (error "remove-file not supported by %s" (eieio-object-name ot)))
 
-(cl-defmethod project-edit-file-target ((ot ede-target))
+(cl-defmethod project-edit-file-target ((_ot ede-target))
   "Edit the target OT associated with this file."
   (find-file (oref (ede-current-project) file)))
 
   "Edit the target OT associated with this file."
   (find-file (oref (ede-current-project) file)))
 
-(cl-defmethod project-new-target ((proj ede-project) &rest args)
+(cl-defmethod project-new-target ((proj ede-project) &rest _args)
   "Create a new target.  It is up to the project PROJ to get the name."
   (error "new-target not supported by %s" (eieio-object-name proj)))
 
   "Create a new target.  It is up to the project PROJ to get the name."
   (error "new-target not supported by %s" (eieio-object-name proj)))
 
@@ -1029,12 +1023,12 @@ Argument FNND is an argument."
   "Delete the current target OT from its parent project."
   (error "add-file not supported by %s" (eieio-object-name ot)))
 
   "Delete the current target OT from its parent project."
   (error "add-file not supported by %s" (eieio-object-name ot)))
 
-(cl-defmethod project-compile-project ((obj ede-project) &optional command)
+(cl-defmethod project-compile-project ((obj ede-project) &optional _command)
   "Compile the entire current project OBJ.
 Argument COMMAND is the command to use when compiling."
   (error "compile-project not supported by %s" (eieio-object-name obj)))
 
   "Compile the entire current project OBJ.
 Argument COMMAND is the command to use when compiling."
   (error "compile-project not supported by %s" (eieio-object-name obj)))
 
-(cl-defmethod project-compile-target ((obj ede-target) &optional command)
+(cl-defmethod project-compile-target ((obj ede-target) &optional _command)
   "Compile the current target OBJ.
 Argument COMMAND is the command to use for compiling the target."
   (error "compile-target not supported by %s" (eieio-object-name obj)))
   "Compile the current target OBJ.
 Argument COMMAND is the command to use for compiling the target."
   (error "compile-target not supported by %s" (eieio-object-name obj)))
@@ -1094,7 +1088,7 @@ Flush the dead projects from the project cache."
   (interactive)
   (let ((dead nil))
     (dolist (P ede-projects)
   (interactive)
   (let ((dead nil))
     (dolist (P ede-projects)
-      (when (not (file-exists-p (oref P :file)))
+      (when (not (file-exists-p (oref P file)))
        (add-to-list 'dead P)))
     (dolist (D dead)
       (ede-delete-project-from-global-list D))
        (add-to-list 'dead P)))
     (dolist (D dead)
       (ede-delete-project-from-global-list D))
@@ -1107,9 +1101,9 @@ Flush the dead projects from the project cache."
   (interactive)
   (let ((scanned nil))
     (dolist (P ede-projects)
   (interactive)
   (let ((scanned nil))
     (dolist (P ede-projects)
-      (if (member (oref P :directory) scanned)
-         (error "Duplicate project (by dir) found in %s!" (oref P :directory))
-       (push (oref P :directory) scanned)))
+      (if (member (oref P directory) scanned)
+         (error "Duplicate project (by dir) found in %s!" (oref P directory))
+       (push (oref P directory) scanned)))
     (unless ede--disable-inode
       (setq scanned nil)
       (dolist (P ede-projects)
     (unless ede--disable-inode
       (setq scanned nil)
       (dolist (P ede-projects)
@@ -1134,8 +1128,7 @@ Optional ROOTRETURN will return the root project for DIR."
 
     ;; Do the load
     ;;(message "EDE LOAD : %S" file)
 
     ;; Do the load
     ;;(message "EDE LOAD : %S" file)
-    (let* ((file dir)
-          (path (file-name-as-directory (expand-file-name dir)))
+    (let* ((path (file-name-as-directory (expand-file-name dir)))
           (detect (or detectin (ede-directory-project-cons path)))
           (autoloader nil)
           (toppath nil)
           (detect (or detectin (ede-directory-project-cons path)))
           (autoloader nil)
           (toppath nil)
@@ -1301,7 +1294,7 @@ could become slow in time."
 Handles complex path issues."
   (member (ede-convert-path this (buffer-file-name buffer)) source))
 
 Handles complex path issues."
   (member (ede-convert-path this (buffer-file-name buffer)) source))
 
-(cl-defmethod ede-buffer-mine ((this ede-project) buffer)
+(cl-defmethod ede-buffer-mine ((_this ede-project) _buffer)
   "Return non-nil if object THIS lays claim to the file in BUFFER."
   nil)
 
   "Return non-nil if object THIS lays claim to the file in BUFFER."
   nil)
 
@@ -1374,7 +1367,7 @@ See also `ede-map-all-subprojects'."
   "For object THIS, execute PROC on THIS and all subprojects.
 This function also applies PROC to sub-sub projects.
 See also `ede-map-subprojects'."
   "For object THIS, execute PROC on THIS and all subprojects.
 This function also applies PROC to sub-sub projects.
 See also `ede-map-subprojects'."
-  (apply 'append
+  (apply #'append
         (list (funcall allproc this))
         (ede-map-subprojects
          this
         (list (funcall allproc this))
         (ede-map-subprojects
          this
@@ -1391,7 +1384,7 @@ See also `ede-map-subprojects'."
 (cl-defmethod ede-map-any-target-p ((this ede-project) proc)
   "For project THIS, map PROC to all targets and return if any non-nil.
 Return the first non-nil value returned by PROC."
 (cl-defmethod ede-map-any-target-p ((this ede-project) proc)
   "For project THIS, map PROC to all targets and return if any non-nil.
 Return the first non-nil value returned by PROC."
-  (eval (cons 'or (ede-map-targets this proc))))
+  (cl-some proc (oref this targets)))
 
 \f
 ;;; Some language specific methods.
 
 \f
 ;;; Some language specific methods.
@@ -1400,15 +1393,15 @@ Return the first non-nil value returned by PROC."
 ;; configuring items for Semantic.
 
 ;; Generic paths
 ;; configuring items for Semantic.
 
 ;; Generic paths
-(cl-defmethod ede-system-include-path ((this ede-project))
+(cl-defmethod ede-system-include-path ((_this ede-project))
   "Get the system include path used by project THIS."
   nil)
 
   "Get the system include path used by project THIS."
   nil)
 
-(cl-defmethod ede-system-include-path ((this ede-target))
+(cl-defmethod ede-system-include-path ((_this ede-target))
   "Get the system include path used by project THIS."
   nil)
 
   "Get the system include path used by project THIS."
   nil)
 
-(cl-defmethod ede-source-paths ((this ede-project) mode)
+(cl-defmethod ede-source-paths ((_this ede-project) _mode)
   "Get the base to all source trees in the current project for MODE.
 For example, <root>/src for sources of c/c++, Java, etc,
 and <root>/doc for doc sources."
   "Get the base to all source trees in the current project for MODE.
 For example, <root>/src for sources of c/c++, Java, etc,
 and <root>/doc for doc sources."
@@ -1436,20 +1429,20 @@ and <root>/doc for doc sources."
        (message "Choosing preprocessor syms for project %s"
                 (eieio-object-name (car objs)))))))
 
        (message "Choosing preprocessor syms for project %s"
                 (eieio-object-name (car objs)))))))
 
-(cl-defmethod ede-system-include-path ((this ede-project))
+(cl-defmethod ede-system-include-path ((_this ede-project))
   "Get the system include path used by project THIS."
   nil)
 
   "Get the system include path used by project THIS."
   nil)
 
-(cl-defmethod ede-preprocessor-map ((this ede-project))
+(cl-defmethod ede-preprocessor-map ((_this ede-project))
   "Get the pre-processor map for project THIS."
   nil)
 
   "Get the pre-processor map for project THIS."
   nil)
 
-(cl-defmethod ede-preprocessor-map ((this ede-target))
+(cl-defmethod ede-preprocessor-map ((_this ede-target))
   "Get the pre-processor map for project THIS."
   nil)
 
 ;; Java
   "Get the pre-processor map for project THIS."
   nil)
 
 ;; Java
-(cl-defmethod ede-java-classpath ((this ede-project))
+(cl-defmethod ede-java-classpath ((_this ede-project))
   "Return the classpath for this project."
   ;; @TODO - Can JDEE add something here?
   nil)
   "Return the classpath for this project."
   ;; @TODO - Can JDEE add something here?
   nil)
@@ -1462,8 +1455,7 @@ and <root>/doc for doc sources."
 If VARIABLE is not project local, just use set.  Optional argument PROJ
 is the project to use, instead of `ede-current-project'."
   (interactive "sVariable: \nxExpression: ")
 If VARIABLE is not project local, just use set.  Optional argument PROJ
 is the project to use, instead of `ede-current-project'."
   (interactive "sVariable: \nxExpression: ")
-  (let ((p (or proj (ede-toplevel)))
-       a)
+  (let ((p (or proj (ede-toplevel))))
     ;; Make the change
     (ede-make-project-local-variable variable p)
     (ede-set-project-local-variable variable value p)
     ;; Make the change
     (ede-make-project-local-variable variable p)
     (ede-set-project-local-variable variable value p)
@@ -1513,10 +1505,26 @@ It does not apply the value to buffers."
       (make-local-variable (car v))
       (set (car v) (cdr v)))))
 
       (make-local-variable (car v))
       (set (car v) (cdr v)))))
 
-(cl-defmethod ede-commit-local-variables ((proj ede-project))
+(cl-defmethod ede-commit-local-variables ((_proj ede-project))
   "Commit change to local variables in PROJ."
   nil)
 
   "Commit change to local variables in PROJ."
   nil)
 
+;;; Integration with project.el
+
+(defun project-try-ede (dir)
+  (let ((project-dir
+         (locate-dominating-file
+          dir
+          (lambda (dir)
+            (ede-directory-get-open-project dir 'ROOT)))))
+    (when project-dir
+      (ede-directory-get-open-project project-dir 'ROOT))))
+
+(cl-defmethod project-roots ((project ede-project))
+  (list (ede-project-root-directory project)))
+
+(add-hook 'project-find-functions #'project-try-ede)
+
 (provide 'ede)
 
 ;; Include this last because it depends on ede.
 (provide 'ede)
 
 ;; Include this last because it depends on ede.