Debug message fix
[sxemacs] / lisp / version.el
1 ;; version.el --- Record version number of SXEmacs.
2
3 ;; Copyright (C) 1985, 1991-1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 2004 Steve Youngs.
5
6 ;; Maintainer: SXEmacs Development Team
7 ;; Keywords: internal, dumped
8
9 ;; This file is part of SXEmacs.
10
11 ;; SXEmacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15
16 ;; SXEmacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Synched up with: not synched.
25
26 ;;; Commentary:
27
28 ;; This file is dumped with SXEmacs.
29
30 ;;; Code:
31
32 (defconst sxemacs-betaname
33   (and emacs-beta-version (format "(beta%d)" emacs-beta-version))
34   "Non-nil when this is a test (beta) version of XEmacs.
35 Warning, this variable did not exist in XEmacs versions prior to 20.3")
36
37 (defconst emacs-version (concat "SXEmacs: " sxemacs-git-version)
38   "Version numbers of this version of XEmacs.")
39
40 ;; Sadly, our `emacs-version' causes a problem for Dired.  This is because
41 ;; Dired uses some regex matching against `emacs-version' instead of simply
42 ;; using the "standard" `emacs-*-version' variables.  The following trivial
43 ;; patch to dired.el will fix Dired for you.  I have already been in touch
44 ;; with the Dired maintainers about this. --SY.
45 ;;
46 ;; --- dired.el.orig    2004-10-03 07:15:32.000000000 +1000
47 ;; +++ dired.el 2004-12-13 16:06:47.000000000 +1000
48 ;; @@ -81,7 +81,7 @@
49 ;;  ;; it been since Lucid went away?
50 ;;  (let ((lucid-p (string-match "XEmacs" emacs-version))
51 ;;        ver subver)
52 ;; -  (or (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
53 ;; +  (or (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
54 ;;        (error "dired does not work with emacs version %s" emacs-version))
55 ;;    (setq ver (string-to-int (substring emacs-version (match-beginning 1)
56 ;;                                    (match-end 1)))
57 ;; @@ -6617,7 +6617,7 @@
58 ;;
59 ;;  (let ((lucid-p (string-match "XEmacs" emacs-version))
60 ;;        ver)
61 ;; -  (or (string-match "^\\([0-9]+\\)\\." emacs-version)
62 ;; +  (or (string-match "\\([0-9]+\\)\\." emacs-version)
63 ;;        (error "Weird emacs version %s" emacs-version))
64 ;;    (setq ver (string-to-int (substring emacs-version (match-beginning 1)
65 ;;                                    (match-end 1))))
66
67 (if (featurep 'infodock)
68     (require 'id-vers))
69
70 (defconst emacs-build-time (current-time-string)
71   "Time at which Emacs was dumped out.")
72
73 (defconst emacs-build-system (system-name))
74
75 (defun emacs-version  (&optional arg)
76   "Return string describing the version of Emacs that is running.
77 When called interactively with a prefix argument, insert string at point.
78 Don't use this function in programs to choose actions according
79 to the system configuration; look at `system-configuration' instead."
80   (interactive "p")
81   (save-match-data
82     (let ((version-string
83            (format
84             "SXEmacs: %s, built %s on %s"
85             sxemacs-git-version
86             emacs-build-time
87             emacs-build-system)))
88       (cond
89        ((null arg) version-string)
90        ((eq arg 1) (message "%s" version-string))
91        (t          (insert version-string))))))
92
93 ;; from emacs-vers.el
94 (defun emacs-version>= (major &optional minor patch)
95   "Return true if the Emacs version is >= to the given MAJOR, MINOR,
96    and PATCH numbers.
97 The MAJOR version number argument is required, but the other arguments
98 argument are optional. Only the Non-nil arguments are used in the test."
99   (let ((emacs-patch (or emacs-patch-level emacs-beta-version -1)))
100     (cond ((> emacs-major-version major))
101           ((< emacs-major-version major) nil)
102           ((null minor))
103           ((> emacs-minor-version minor))
104           ((< emacs-minor-version minor) nil)
105           ((null patch))
106           ((>= emacs-patch patch)))))
107
108 ;;; We hope that this alias is easier for people to find.
109 (define-function 'version 'emacs-version)
110
111 ;; Put the emacs version number into the `pure[]' array in a form that
112 ;; `what(1)' can extract from the executable or a core file.  We don't
113 ;; actually need this to be pointed to from lisp; pure objects can't
114 ;; be GCed.
115 (concat "\n@" "(#)" (emacs-version)
116         "\n@" "(#)" "Configuration: "
117         system-configuration "\n")
118
119 (provide 'version)
120
121 ;;Local variables:
122 ;;version-control: never
123 ;;End:
124
125 ;;; version.el ends here