1;;; cedet.el --- Setup CEDET environment  -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2002-2021 Free Software Foundation, Inc.
4
5;; Author: David Ponce <david@dponce.com>
6;; Maintainer: Eric M. Ludlam <zappo@gnu.org>
7;; Version: 2.0
8;; Keywords: OO, lisp
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software: you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation, either version 3 of the License, or
15;; (at your option) any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
24
25;;; Commentary:
26
27;;; Code:
28;;
29;; This file depends on the major components of CEDET, so that you can
30;; load them all by doing (require 'cedet).  This is mostly for
31;; compatibility with the upstream, stand-alone CEDET distribution.
32
33(declare-function inversion-find-version "inversion")
34
35(defconst cedet-version "2.0"
36  "Current version of CEDET.")
37
38(defconst cedet-packages
39  `(
40    ;;PACKAGE   MIN-VERSION      INSTALLDIR  DOCDIR
41    (cedet         ,cedet-version "common"   "common" 	        )
42    (eieio         "1.4"           nil       "eieio"       )
43    (semantic      "2.2"           nil       "semantic/doc")
44    (srecode       "1.2"           nil       "srecode"     )
45    (ede           "1.2"           nil       "ede"         )
46    )
47  "Table of CEDET packages to install.")
48
49(defvar cedet-menu-map ;(make-sparse-keymap "CEDET menu")
50  (let ((map (make-sparse-keymap "CEDET menu")))
51    (define-key map [semantic-force-refresh]     #'undefined)
52    (define-key map [semantic-edit-menu]         #'undefined)
53    (define-key map [navigate-menu]              #'undefined)
54    (define-key map [semantic-options-separator] #'undefined)
55    (define-key map [global-semantic-highlight-func-mode]   #'undefined)
56    (define-key map [global-semantic-stickyfunc-mode]       #'undefined)
57    (define-key map [global-semantic-decoration-mode]       #'undefined)
58    (define-key map [global-semantic-idle-completions-mode] #'undefined)
59    (define-key map [global-semantic-idle-summary-mode]     #'undefined)
60    (define-key map [global-semantic-idle-scheduler-mode]   #'undefined)
61    (define-key map [global-semanticdb-minor-mode]          #'undefined)
62    (define-key map [cedet-menu-separator] #'undefined)
63    (define-key map [ede-find-file]        #'undefined)
64    (define-key map [ede-speedbar]         #'undefined)
65    (define-key map [ede]                  #'undefined)
66    (define-key map [ede-new]              #'undefined)
67    (define-key map [ede-target-options]   #'undefined)
68    (define-key map [ede-project-options]  #'undefined)
69    (define-key map [ede-build-forms-menu] #'undefined)
70    map)
71  "Menu keymap for the CEDET package.
72This is used by `semantic-mode' and `global-ede-mode'.")
73
74(defun cedet-version ()
75  "Display all active versions of CEDET and dependent packages.
76
77The PACKAGE column is the name of a given package from CEDET.
78
79REQUESTED VERSION is the version requested by the CEDET load script.
80See `cedet-packages' for details.
81
82FILE VERSION is the version number found in the source file
83for the specified PACKAGE.
84
85LOADED VERSION is the version of PACKAGE currently loaded in Emacs
86memory and (presumably) running in this Emacs instance.  Value is X
87if the package has not been loaded."
88  (declare (obsolete emacs-version "28.1"))
89  (interactive)
90  (require 'inversion)
91  (with-output-to-temp-buffer "*CEDET*"
92    (princ "CEDET Version:\t") (princ cedet-version)
93    (princ "\n  \t\t\tRequested\tFile\t\tLoaded")
94    (princ "\n  Package\t\tVersion\t\tVersion\t\tVersion")
95    (princ "\n  ----------------------------------------------------------")
96    (let ((p cedet-packages))
97      (while p
98	(let ((sym (symbol-name (car (car p)))))
99	  (princ "\n  ")
100	  (princ sym)
101	  (princ ":\t")
102	  (if (< (length sym) 5)
103	      (princ "\t"))
104	  (if (< (length sym) 13)
105	      (princ "\t"))
106	  (let ((reqver (nth 1 (car p)))
107		(filever (car (inversion-find-version sym)))
108		(loadver (when (featurep (car (car p)))
109			   (symbol-value (intern-soft (concat sym "-version"))))))
110	    (princ reqver)
111	    (if (< (length reqver) 8) (princ "\t"))
112	    (princ "\t")
113	    (if (string= filever reqver)
114		;; I tried the words "check" and "match", but that
115		;; just looked lame.
116		(princ "ok\t")
117	      (princ filever)
118	      (if (< (length filever) 8) (princ "\t")))
119	    (princ "\t")
120	    (if loadver
121		(if (string= loadver reqver)
122		    (princ "ok")
123		  (princ loadver))
124	      (princ "Not Loaded"))
125	    ))
126	(setq p (cdr p))))
127    (princ "\n\n\nC-h f cedet-version RET\n  for details on output format.")
128    ))
129
130(provide 'cedet)
131
132;;; cedet.el ends here
133