Permalink
Browse files

Make compatible with Emacs >= 23.2 and its integrated CVS-suite

  • Loading branch information...
1 parent 59a0238 commit 57e2c0d42b7f7cc2673bc925206c0ea33532cf7f berndl committed Feb 21, 2010
Showing with 282 additions and 175 deletions.
  1. +8 −8 Makefile
  2. +15 −3 NEWS
  3. +161 −24 ecb-cedet-wrapper.el
  4. +12 −8 ecb-upgrade.el
  5. +10 −101 ecb.el
  6. +71 −31 ecb.texi
  7. +5 −0 make.bat
View
@@ -2,14 +2,11 @@
# Copyright (C) 2000 - 2005 Jesper Nordenberg,
# Klaus Berndl,
-# Kevin A. Burton,
# Free Software Foundation, Inc.
# Author: Jesper Nordenberg <mayhem@home.se>
# Klaus Berndl <klaus.berndl@sdm.de>
-# Kevin A. Burton <burton@openprivacy.org>
# Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
-# Kevin A. Burton <burton@openprivacy.org>
# Keywords: browser, code, programming, tools
# Created: 2001
@@ -43,14 +40,15 @@ EMACS=emacs
# In the following path-settings of this section use always FORWARD-SLASHES
# as directory-separator even with MS Windows systems.
-# -------- Compiling ECB with the cedet-library 1.0 ----------------------
+# -------- Compiling ECB with the cedet-library ----------------------
-# cedet >= 1.0preX (contains a.o. semantic >= 2.0, eieio >= 0.18 and
+# cedet >= 1.0pre6 (contains a.o. semantic >= 2.0, eieio >= 0.18 and
# speedbar >= 0.15). Set here the full path to the cedet-installation
-# directory. Set this to empty if you want to use that cedet which is
+# directory. Set this to EMPTY if you want to use that cedet which is
# integrated into Emacs >= 23.2. For Emacs-versions < 23.2 you MUST set
# this path!
+#CEDET=
CEDET=c:/Programme/emacs-23.1/site-lisp/package-development/cedet
# You can set here more load-paths to arbitrary packages if you want. But
@@ -61,7 +59,7 @@ LOADPATH=
# - Call "make" to byte-compile the ECB. You can savely ignore the messages.
# - Or call
#
-# make [EMACS="path/to/emacs"] [CEDET="path/to/cedet"]
+# make [EMACS="path/to/emacs"] [CEDET="path/to/cedet" or empty]
#
# if you want to set either different load-paths or Emacs-binary and
# you do not want edit the Makefile. Do not forget quoting the arguments
@@ -122,7 +120,6 @@ INSTALLINFO=/usr/bin/install-info
# For the ECB-maintainers: Change the version-number here and not
# elsewhere!
ecb_VERSION=2.41
-#ecb_VERSION=2.32
include ecb-makedef.mk
@@ -132,6 +129,9 @@ ecb: $(ecb_LISP_EL)
@echo "(add-to-list 'load-path nil)" > ecb-compile-script
@if test ! -z "${CEDET}"; then\
echo "(load-file \"$(CEDET)/common/cedet.el\")" >> ecb-compile-script; \
+ else \
+ echo "(semantic-mode 1)" >> ecb-compile-script; \
+ echo "(require 'semantic/bovine/el)" >> ecb-compile-script; \
fi
@if test ! -z "${LOADPATH}"; then\
for loadpath in ${LOADPATH}; do \
View
18 NEWS
@@ -63,9 +63,21 @@
** Better compatibility with forthcoming Gnu Emacs 23.2
-*** Works with emacs-integrated cedet-suite
- TODO: Makefile ��berarbeiten!
- Installationsanweisung ��berarbeiten
+*** Works out of the box with the Emacs-integrated cedet-suite
+
+ If Emacs >= 23.2 is used then CEDET is already integrated into Emacs and
+ ECB can be used out of the box without further requirements.
+
+ PLEASE NOTE: If ECB detects an author version of CEDET (as available at
+ `http://cedet.sourceforge.net') then ECB will ALWAYS try to use that one
+ even if you use Emacs >= 23.2! This is for users who want to use latest
+ Emacs >= 23.2 but want to use still the latest author version of CEDET and
+ not the Emacs-integrated one.
+
+ So if you want to use the Emacs-integrated CEDET-suite you have to ensure
+ that no author-version of CEDET is in the `load-path'! This means that the
+ library cedet.el of the author-version MUST NOT be loaded into Emacs!
+ This is a valid check: (locate-library "semantic-ctxt") must return nil!
** Fixed Bugs
View
@@ -34,6 +34,8 @@
;; always point to the correct variable or function of cedet independent
;; which cedet version is loaded. ECB only uses the functions exported from
;; ecb-cedet-wrapper.el!
+;;
+;; In addition this file defines all requirements ECB needs of CEDET.
(eval-when-compile
@@ -43,41 +45,175 @@
;; to avoid compiler grips
(require 'cl))
-;; Add new cedet libraries needed by ecb!!
-(defconst ecb-cedet-lib-registry '((semantic . semantic)
+(require 'ecb-util)
+
+(defconst ecb-cedet-old-sourcetree-structure-detected-p
+ (locate-library "semantic-ctxt")
+ "Not nil if old cedet sourcetree-structure is detected.")
+
+;; Additonal cedet libraries needed by ecb must be added here!!
+;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: We have to pay attention if there
+;; are changes when Eric marriages the two styles for his CVS-repository
+(defconst ecb-cedet-lib-registry '((cedet . cedet)
+ (semantic . semantic)
(semantic-ctxt . semantic/ctxt)
(semantic-analyze . semantic/analyze)
(semanticdb . semantic/db)
(semanticdb-find . semantic/db-find)
(semanticdb-mode . semantic/db-mode)
+ (semantic-el . semantic/bovine/el)
(eieio . eieio)
(speedbar . speedbar))
- "Maps the cvs-library of cedet to the equivalent lib of Emacs >= 23.2
-The elemant is an assoc list where the car is the lib-symbol of a
-cedet-library and the cdr is the corresponding lib-symbol of the cedet-suite
-integrated into Emacs >= 23.2
+ "Maps the old library-structure of cedet to the equivalent libs
+of Emacs >= 23.2. The value is an assoc list where the car is the
+lib-symbol of an old-style cedet-library and the cdr is the
+corresponding lib-symbol of the new style library \(as with the
+cedet-suite integrated into Emacs >= 23.2).
ALL CEDET-LIBRARIES NEEDED BY ECB MUST BE REGISTERED HERE!")
-(defun ecb-cedet-require (cvs-lib)
+(defconst ecb-cedet-required-version-min '(1 0 2 6)
+ "Minimum version of cedet needed by ECB.
+The meaning is as follows:
+1. Major-version
+2. Minor-version
+3. 0 = alpha, 1 = beta, 2 = pre, 3 = nothing \(e.g. \"1.4\"), 4 = . \(e.g. \"1.4.3\"
+4. Subversion after the alpha, beta, pre or .")
+
+(defconst ecb-cedet-required-version-max '(1 0 4 9)
+ "Maximum version of CEDET currently accepted by ECB.
+See `ecb-required-cedet-version-min' for an explanation.")
+
+(defun ecb-cedet-missing-libs ()
+ "Return a list of names of missing cedet-libs.
+If no cedet libs are missing nil is returned."
+ (let ((missing-libs-list nil)
+ (lib nil))
+ (dolist (l-elem ecb-cedet-lib-registry)
+ (setq lib (symbol-name (if ecb-cedet-old-sourcetree-structure-detected-p
+ (car l-elem)
+ (cdr l-elem))))
+ (when (not (locate-library lib))
+ (push lib missing-libs-list)))
+ missing-libs-list))
+
+(defun ecb-cedet-require (old-style-lib)
"Loads a cedet-library CVS-LIB into Emacs.
-CVS-LIB is the symbol-name of the cedet-library in the cvs-version of cedet.
+OLD-STYLE-LIB is the symbol-name of the cedet-library as in the cvs-version of
+cedet in feb 2010 \(ie. there is a lib semantic-ctxt instead of semantic/ctxt).
All cedet libaryies needed by ECB must be loaded with this function! Do not
use `require' for looading a cedet-library into Emacs!"
- (require (if (featurep 'cedet)
- cvs-lib
- (cdr (assoc cvs-lib ecb-cedet-lib-registry)))))
-
-
-(ecb-cedet-require 'semantic)
-(ecb-cedet-require 'semantic-ctxt)
-(ecb-cedet-require 'semantic-analyze)
-(ecb-cedet-require 'semanticdb)
-(ecb-cedet-require 'semanticdb-find)
-(ecb-cedet-require 'semanticdb-mode)
-(ecb-cedet-require 'eieio)
-
-(defconst ecb-semantic-2-loaded (string-match "^2" semantic-version))
+ (require (if ecb-cedet-old-sourcetree-structure-detected-p
+ old-style-lib
+ (cdr (assoc old-style-lib ecb-cedet-lib-registry)))))
+
+;; With old style CEDET-load-mechanism cedet.el must be loaded "by
+;; hand" to setup load-path correctly for cedet.
+;; + Old-style CEDET-loader: The following require for 'cedet fails if
+;; cedet.el is either not loaded or cedet/common is not contained in the
+;; load-path. For these cases we encapsulate it with ignore-errors.
+;; + New-style CEDET-loader (as in Emacs >= 23.2): cedet.el is not needed to
+;; setup the load-path but it contains the costant `cedet-version' which is
+;; needed by ECB.
+(ignore-errors (ecb-cedet-require 'cedet))
+
+(defconst ecb-cedet-missing-libraries
+ (ecb-cedet-missing-libs)
+ "List of library-names of CEDET missed by ECB.
+Nil if all libs needed by ECB are found.")
+
+(unless ecb-cedet-missing-libraries
+ (ecb-cedet-require 'semantic)
+ (ecb-cedet-require 'semantic-ctxt)
+ (ecb-cedet-require 'semantic-analyze)
+ (ecb-cedet-require 'semanticdb)
+ (ecb-cedet-require 'semanticdb-find)
+ (ecb-cedet-require 'semanticdb-mode)
+ (ecb-cedet-require 'eieio))
+
+(defconst ecb-compiled-in-semantic-version
+ (eval-when-compile (ignore-errors semantic-version))
+ "Semantic-version used for byte-compiling ECB. Either nil when no semantic
+is loaded or the value of `semantic-version' at ECB-compilation time.")
+
+(defconst ecb-compiled-in-cedet-version
+ (eval-when-compile (ignore-errors cedet-version))
+ "Cedet-version used for byte-compiling ECB. Either nil when no semantic
+is loaded or the value of `cedet-version' at ECB-compilation time.")
+
+(defun ecb-check-semantic-load ()
+ "Checks if cedet is correctly loaded if semantic 2.X is used and if the same
+semantic-version has been used for byte-compiling ECB and loading into Emacs.
+If ECB detects a problem it is reported and then an error is thrown."
+ (when (boundp 'semantic-version)
+ (let ((err-msg
+ (cond ;; Different semantic-version used for byte-compiling ECB and
+ ;; loading into Emacs.
+ ((not (string= semantic-version ecb-compiled-in-semantic-version))
+ (concat "ECB has been byte-compiled with another semantic-version than currently\n"
+ "loaded into Emacs:\n"
+ (format " + Semantic used for byte-compiling ECB: %s\n"
+ ecb-compiled-in-semantic-version)
+ (format " + Semantic currently loaded into Emacs: %s\n"
+ semantic-version)
+ "Please ensure that ECB is byte-compiled with the same semantic-version as you\n"
+ "you load into your Emacs. Check if you have byte-compiled ECB with the cedet-\n"
+ "suite but loaded old semantic 1.X into Emacs or vice versa.\n\n"
+ "In general it is recommended to start ECB first-time not byte-compiled\n"
+ "and then call the command `ecb-byte-compile'. This ensures you byte-compile ECB\n"
+ "with the same library-versions \(semantic etc.) as you load into Emacs.\n"
+ "If you use the Makefile check the variables CEDET before compiling!\n"
+ ))
+ (t ""))))
+ (unless (= 0 (length err-msg))
+ (with-output-to-temp-buffer "*ECB semantic-load problems*"
+ (princ "Currently ECB can not be activated cause of the following reason:\n\n")
+ (princ err-msg)
+ (princ "\n\nPlease fix the reported problem and restart Emacs\n"))
+ (ecb-error "Please fix the reported problem and restart Emacs!")))))
+
+(defun ecb-check-cedet-load ()
+ "Checks if cedet is correctly loaded if semantic 2.X is used and if the same
+semantic-version has been used for byte-compiling ECB and loading into Emacs.
+If ECB detects a problem it is reported and then an error is thrown."
+ (when (boundp 'cedet-version)
+ (let ((err-msg
+ (cond ;; cedet was not compiled into ECB
+ ((null ecb-compiled-in-cedet-version)
+ (concat (format "Currently CEDET %s is loaded but ECB has been byte-compiled without\n"
+ cedet-version)
+ "any CEDET. Please either use ECB un-byte-compiled \(remove all *.elc\n"
+ "files from the ECB-directory) or byte-compile ECB correctly with CEDET!\n"
+ "In the later case it is recommended to start ECB first-time not byte-compiled\n"
+ "and then call the command `ecb-byte-compile'. This ensures you byte-compile ECB\n"
+ "with the same CEDET-library-version as you load into Emacs.\n"
+ "If you use the Makefile check the variable CEDET before compiling!\n"
+ ))
+ ;; Different cedet-version used for byte-compiling ECB and
+ ;; loading into Emacs.
+ ((not (string= cedet-version ecb-compiled-in-cedet-version))
+ (concat "ECB has been byte-compiled with another cedet-version than currently\n"
+ "loaded into Emacs:\n"
+ (format " + CECET used for byte-compiling ECB: %s\n"
+ ecb-compiled-in-cedet-version)
+ (format " + CEDET currently loaded into Emacs: %s\n"
+ cedet-version)
+ "Please ensure that ECB is byte-compiled with the same cedet-version as you\n"
+ "you load into your Emacs.\n\n"
+ "In general it is recommended to start ECB first-time not byte-compiled\n"
+ "and then call the command `ecb-byte-compile'. This ensures you byte-compile ECB\n"
+ "with the same CEDET-library-version as you load into Emacs.\n"
+ "If you use the Makefile check the variable CEDET before compiling!\n"))
+ (t ""))))
+ (unless (= 0 (length err-msg))
+ (with-output-to-temp-buffer "*ECB cedet-load problems*"
+ (princ "Currently ECB can not be activated cause of the following reason:\n\n")
+ (princ err-msg)
+ (princ "\n\nPlease fix the reported problem and restart Emacs\n"))
+ (ecb-error "Please fix the reported problem and restart Emacs!")))))
+
+(defconst ecb-semantic-2-loaded (ignore-errors
+ (string-match "^2" semantic-version)))
;; -- getter functions for all variables of cedet currently used by ECB ---
@@ -223,8 +359,9 @@ use `require' for looading a cedet-library into Emacs!"
;; new let us create the aliase. Each alias has the name "ecb--"<function of
;; cedet >= 1.0
-(dolist (f-elem (append ecb--cedet-function-list ecb--semantic-format-function-list))
- (defalias (intern (concat "ecb--" (symbol-name f-elem))) f-elem))
+(unless ecb-cedet-missing-libraries
+ (dolist (f-elem (append ecb--cedet-function-list ecb--semantic-format-function-list))
+ (defalias (intern (concat "ecb--" (symbol-name f-elem))) f-elem)))
(silentcomp-provide 'ecb-cedet-wrapper)
View
@@ -1145,9 +1145,9 @@ options with their old \(before the upgrade/reset) and new values."
;; all needs for the requirements check
;; ----------------------------------------------------------------------
-;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: maybe we should set this to pre6
-(defconst ecb-required-cedet-version-min '(1 0 2 6))
-(defconst ecb-required-cedet-version-max '(1 0 4 9))
+;; we need the min and max version of cedet and the list of missing libraries
+;; of cedet (if there are any)
+(require 'ecb-cedet-wrapper)
(defvar ecb-all-requirements-available nil)
@@ -1162,20 +1162,24 @@ Currently this is a check if the right `cedet-version is loaded."
(when ecb-regular-xemacs-package-p
(ecb-error "Sorry, but ECB is currently not runnable as XEmacs-package. Install \"by hand\"."))
+ (when ecb-cedet-missing-libraries
+ (ecb-error "ECB is missing the libs %s of CEDET - check the CEDET-installation/setup!"
+ ecb-cedet-missing-libraries))
+
(when (and (or (not (boundp 'ecb-version-check)) ecb-version-check)
(not ecb-all-requirements-available))
(let ((cedet-required-version-str-min (ecb-package-version-list2str
- ecb-required-cedet-version-min))
+ ecb-cedet-required-version-min))
(cedet-required-version-str-max (ecb-package-version-list2str
- ecb-required-cedet-version-max))
+ ecb-cedet-required-version-max))
(version-error nil))
- ;; check if vedet-version is correct
+ ;; check if cedet-version is correct
(when (or (not (boundp 'cedet-version))
(ecb-package-version-list<
(ecb-package-version-str2list cedet-version)
- ecb-required-cedet-version-min)
+ ecb-cedet-required-version-min)
(ecb-package-version-list<
- ecb-required-cedet-version-max
+ ecb-cedet-required-version-max
(ecb-package-version-str2list cedet-version)))
(setq version-error (concat "cedet ["
cedet-required-version-str-min
Oops, something went wrong.

0 comments on commit 57e2c0d

Please sign in to comment.