(Fconstrain_to_field): Make sure we don't violate the
[bpt/emacs.git] / lisp / version.el
CommitLineData
6edcb099
DL
1;;; version.el --- record version number of Emacs.
2
3;;; Copyright (C) 1985, 1992, 1994, 1995, 1999 Free Software Foundation, Inc.
4
5;; Maintainer: FSF
6;; Keywords: internal
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the
22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23;; Boston, MA 02111-1307, USA.
24
25;;; Code:
26
27(defconst emacs-version "20.5.92" "\
28Version numbers of this version of Emacs.")
29
30(defconst emacs-major-version
31 (progn (string-match "^[0-9]+" emacs-version)
32 (string-to-int (match-string 0 emacs-version)))
33 "Major version number of this version of Emacs.
34This variable first existed in version 19.23.")
35
36(defconst emacs-minor-version
37 (progn (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
38 (string-to-int (match-string 1 emacs-version)))
39 "Minor version number of this version of Emacs.
40This variable first existed in version 19.23.")
41
42(defconst emacs-build-time (current-time) "\
43Time at which Emacs was dumped out.")
44
45(defconst emacs-build-system (system-name))
46
47(defun emacs-version (&optional here) "\
48Return string describing the version of Emacs that is running.
49If optional argument HERE is non-nil, insert string at point.
50Don't use this function in programs to choose actions according
51to the system configuration; look at `system-configuration' instead."
52 (interactive "P")
53 (let ((version-string
54 (format (if (not (interactive-p))
55 "GNU Emacs %s (%s%s)\n of %s on %s"
56 "GNU Emacs %s (%s%s) of %s on %s")
57 emacs-version
58 system-configuration
59 (cond ((featurep 'motif) ", Motif")
60 ((featurep 'x-toolkit) ", X toolkit")
61 (t ""))
62 (format-time-string "%a %b %e %Y" emacs-build-time)
63 emacs-build-system)))
64 (if here
65 (insert version-string)
66 (if (interactive-p)
67 (message "%s" version-string)
68 version-string))))
69
70;;; We hope that this alias is easier for people to find.
71(defalias 'version 'emacs-version)
72
73;;; We put version info into the executable in the form that ident(1) uses.
74(or (memq system-type '(vax-vms windows-nt ms-dos))
75 (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ? (emacs-version))
76 " $\n")))
77
78;;Local variables:
79;;version-control: never
80;;End:
81
82;;; version.el ends here