* lisp/version.el (emacs-version): Change '*Step' to 'NS' for consistency with other...
[bpt/emacs.git] / lisp / version.el
1 ;;; version.el --- record version number of Emacs -*- no-byte-compile: t -*-
2
3 ;; Copyright (C) 1985, 1992, 1994, 1995, 1999, 2000, 2001, 2002,
4 ;; 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5
6 ;; Maintainer: FSF
7 ;; Keywords: internal
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs 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 ;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Commentary:
25
26 ;;; Code:
27
28 (defconst emacs-copyright "Copyright (C) 2008 Free Software Foundation, Inc."
29 "Short copyright string for this version of Emacs.")
30
31 (defconst emacs-version "23.0.60" "\
32 Version numbers of this version of Emacs.")
33
34 (defconst emacs-major-version
35 (progn (string-match "^[0-9]+" emacs-version)
36 (string-to-number (match-string 0 emacs-version)))
37 "Major version number of this version of Emacs.
38 This variable first existed in version 19.23.")
39
40 (defconst emacs-minor-version
41 (progn (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
42 (string-to-number (match-string 1 emacs-version)))
43 "Minor version number of this version of Emacs.
44 This variable first existed in version 19.23.")
45
46 (defconst emacs-build-time (current-time) "\
47 Time at which Emacs was dumped out.")
48
49 (defconst emacs-build-system (system-name))
50
51 (defun emacs-version (&optional here) "\
52 Return string describing the version of Emacs that is running.
53 If optional argument HERE is non-nil, insert string at point.
54 Don't use this function in programs to choose actions according
55 to the system configuration; look at `system-configuration' instead."
56 (interactive "P")
57 (let ((version-string
58 (format (if (not (interactive-p))
59 "GNU Emacs %s (%s%s%s)\n of %s on %s"
60 "GNU Emacs %s (%s%s%s) of %s on %s")
61 emacs-version
62 system-configuration
63 (cond ((featurep 'motif)
64 (concat ", " (substring motif-version-string 4)))
65 ((featurep 'gtk)
66 (concat ", GTK+ Version " gtk-version-string))
67 ((featurep 'x-toolkit) ", X toolkit")
68 ((featurep 'ns)
69 (format ", NS %s" ns-version-string))
70 (t ""))
71 (if (and (boundp 'x-toolkit-scroll-bars)
72 (memq x-toolkit-scroll-bars '(xaw xaw3d)))
73 (format ", %s scroll bars"
74 (capitalize (symbol-name x-toolkit-scroll-bars)))
75 "")
76 (format-time-string "%Y-%m-%d" emacs-build-time)
77 emacs-build-system)))
78 (if here
79 (insert version-string)
80 (if (interactive-p)
81 (message "%s" version-string)
82 version-string))))
83
84 ;; We hope that this alias is easier for people to find.
85 (defalias 'version 'emacs-version)
86
87 ;; We put version info into the executable in the form that `ident' uses.
88 (or (eq system-type 'windows-nt)
89 (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
90 " $\n")))
91
92 ;;Local variables:
93 ;;version-control: never
94 ;;End:
95
96 ;; arch-tag: e60dc445-6218-4a4c-a7df-f15a818642a0
97 ;;; version.el ends here