From 0ff60ec82f98032375e8569a98c08b72d879bce4 Mon Sep 17 00:00:00 2001 From: Stephen Leake Date: Mon, 31 Aug 2015 10:32:26 -0500 Subject: [PATCH] Fix some byte-compiler warnings in EDE This fixes a bug that caused ede-generic-new-autoloader to overwrite the existing autoloader list, rather than add to it. * lisp/cedet/ede/auto.el (ede-project-class-files): Delete obsolete name argument to eieio class constructor. (ede-show-supported-projects): New. (ede-add-project-autoload): Replace obsolete `eieio-object-name-string' with (oref ... name). (ede-auto-load-project): Use slot name, not initarg key. * lisp/cedet/ede/generic.el (ede-generic-load, ede-generic-find-matching-target): Use slot name, not initarg key. (ede-find-target): Use oref-default on class name. (ede-generic-new-autoloader): Delete obsolete name argument to eieio class constructor. (ede-enable-generic-projects): Make project type names unique. --- lisp/cedet/ede/auto.el | 32 +++++++++++++++++++---------- lisp/cedet/ede/generic.el | 42 +++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el index 482632f294a..51459fa7e74 100644 --- a/lisp/cedet/ede/auto.el +++ b/lisp/cedet/ede/auto.el @@ -155,9 +155,9 @@ into memory.") Specifying this matcher object will allow EDE to perform a complex check without loading the project. -NOTE: If you use dirmatch, you may need to set :root-only to nil. +NOTE: If you use dirmatch, you may need to set :root-only to `nil'. While it may be a root based project, all subdirs will happen to return -true for the dirmatch, so for scanning purposes, set it to nil.") +true for the dirmatch, so for scanning purposes, set it to `nil'.") (proj-root :initarg :proj-root :type function :documentation "A function symbol to call for the project root. @@ -197,23 +197,20 @@ type is required and the load function used.") (defvar ede-project-class-files (list - (ede-project-autoload "edeproject-makefile" - :name "Make" :file 'ede/proj + (ede-project-autoload :name "Make" :file 'ede/proj :proj-file "Project.ede" :root-only nil :load-type 'ede-proj-load :class-sym 'ede-proj-project :safe-p nil) - (ede-project-autoload "edeproject-automake" - :name "Automake" :file 'ede/proj + (ede-project-autoload :name "Automake" :file 'ede/proj :proj-file "Project.ede" :root-only nil :initializers '(:makefile-type Makefile.am) :load-type 'ede-proj-load :class-sym 'ede-proj-project :safe-p nil) - (ede-project-autoload "automake" - :name "automake" :file 'ede/project-am + (ede-project-autoload :name "automake" :file 'ede/project-am :proj-file "Makefile.am" :root-only nil :load-type 'project-am-load @@ -225,6 +222,19 @@ type is required and the load function used.") (put 'ede-project-class-files 'risky-local-variable t) +(defun ede-show-supported-projects () + "Display all the project types registered with EDE." + (interactive) + (let ((b (get-buffer-create "*EDE Autodetect Projects*"))) + (set-buffer b) + (setq buffer-read-only nil) + (erase-buffer) + (dolist (prj ede-project-class-files) + (insert (oref prj name)) + (newline)) + (display-buffer b) + )) + (defun ede-add-project-autoload (projauto &optional flag) "Add PROJAUTO, an EDE autoload definition to `ede-project-class-files'. Optional argument FLAG indicates how this autoload should be @@ -234,8 +244,8 @@ added. Possible values are: front of the list so more generic projects don't get priority." ;; First, can we identify PROJAUTO as already in the list? If so, replace. (let ((projlist ede-project-class-files) - (projname (eieio-object-name-string projauto))) - (while (and projlist (not (string= (eieio-object-name-string (car projlist)) projname))) + (projname (oref projauto name))) + (while (and projlist (not (string= (oref (car projlist) name) projname))) (setq projlist (cdr projlist))) (if projlist @@ -296,7 +306,7 @@ be loaded. NOTE: Do not call this - it should only be called from `ede-load-project-file'." ;; Last line of defense: don't load unsafe projects. - (when (not (or (oref this :safe-p) + (when (not (or (oref this safe-p) (ede-directory-safe-p dir))) (error "Attempt to load an unsafe project (bug elsewhere in EDE)")) ;; Things are good - so load the project. diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el index 9e6fc978376..8d013245bb6 100644 --- a/lisp/cedet/ede/generic.el +++ b/lisp/cedet/ede/generic.el @@ -74,7 +74,7 @@ ;; The ede-generic-target-c-cpp has some example methods setting up ;; the pre-processor map and system include path. ;; -;; NOTE: It is not necessary to modify ede-generic.el to add any of +;; NOTE: It is not necessary to modify ede/generic.el to add any of ;; the above described support features. (require 'eieio-opt) @@ -102,14 +102,14 @@ ROOTPROJ is nil, since there is only one project." (let* ((alobj ede-constructing)) (when (not alobj) (error "Cannot load generic project without the autoload instance")) ;;; - ;; TODO - find the root dir. + ;; TODO - find the root dir. (let ((rootdir dir)) (funcall (oref alobj class-sym) (symbol-name (oref alobj class-sym)) :name (file-name-nondirectory (directory-file-name dir)) :version "1.0" :directory (file-name-as-directory rootdir) - :file (expand-file-name (oref alobj :proj-file) + :file (expand-file-name (oref alobj proj-file) rootdir))) )) @@ -211,7 +211,7 @@ All directories need at least one target.") (let ((match nil)) (dolist (T targets) (when (and (object-of-class-p T class) - (string= (oref T :path) dir)) + (string= (oref T path) dir)) (setq match T) )) match)) @@ -241,7 +241,7 @@ If one doesn't exist, create a new one for this directory." (when (not ans) (setq ans (make-instance cls - :name (oref cls shortname) + :name (oref-default cls shortname) :path dir :source nil)) (object-add-to-list proj :targets ans) @@ -252,18 +252,18 @@ If one doesn't exist, create a new one for this directory." ;; ;; Derived projects need an autoloader so that EDE can find the ;; different projects on disk. -(defun ede-generic-new-autoloader (internal-name external-name - projectfile class) +(defun ede-generic-new-autoloader (_internal-name external-name + projectfile class) "Add a new EDE Autoload instance for identifying a generic project. -INTERNAL-NAME is a long name that identifies this project type. -EXTERNAL-NAME is a shorter human readable name to describe the project. +INTERNAL-NAME is obsolete and ignored. +EXTERNAL-NAME is a human readable name to describe the project; it +must be unique among all autoloaded projects. PROJECTFILE is a file name that identifies a project of this type to EDE, such as a Makefile, or SConstruct file. CLASS is the EIEIO class that is used to track this project. It should subclass -the class `ede-generic-project' project." +`ede-generic-project'." (ede-add-project-autoload - (ede-project-autoload internal-name - :name external-name + (ede-project-autoload :name external-name :file 'ede/generic :proj-file projectfile :root-only nil @@ -284,29 +284,29 @@ the class `ede-generic-project' project." (defun ede-enable-generic-projects () "Enable generic project loaders." (interactive) - (ede-generic-new-autoloader "generic-makefile" "Make" + (ede-generic-new-autoloader "generic-makefile" "Generic Make" "Makefile" 'ede-generic-makefile-project) - (ede-generic-new-autoloader "generic-scons" "SCons" + (ede-generic-new-autoloader "generic-scons" "Generic SCons" "SConstruct" 'ede-generic-scons-project) - (ede-generic-new-autoloader "generic-cmake" "CMake" + (ede-generic-new-autoloader "generic-cmake" "Generic CMake" "CMakeLists" 'ede-generic-cmake-project) ;; Super Generic found via revision control tags. - (ede-generic-new-autoloader "generic-git" "Git" + (ede-generic-new-autoloader "generic-git" "Generic Git" ".git" 'ede-generic-vc-project) - (ede-generic-new-autoloader "generic-bzr" "Bazaar" + (ede-generic-new-autoloader "generic-bzr" "Generic Bazaar" ".bzr" 'ede-generic-vc-project) - (ede-generic-new-autoloader "generic-hg" "Mercurial" + (ede-generic-new-autoloader "generic-hg" "Generic Mercurial" ".hg" 'ede-generic-vc-project) - (ede-generic-new-autoloader "generic-svn" "Subversions" + (ede-generic-new-autoloader "generic-svn" "Generic Subversions" ".svn" 'ede-generic-vc-project) - (ede-generic-new-autoloader "generic-cvs" "CVS" + (ede-generic-new-autoloader "generic-cvs" "Generic CVS" "CVS" 'ede-generic-vc-project) ;; Take advantage of existing 'projectile' based projects. ;; @TODO - if projectile supports compile commands etc, can we ;; read that out? Howto if projectile is not part of core emacs. - (ede-generic-new-autoloader "generic-projectile" ".projectile" + (ede-generic-new-autoloader "generic-projectile" "Generic .projectile" ".projectile" 'ede-generic-vc-project) ) -- 2.39.2