(setwins): generalized a little.
[emacs.git] / lisp / version.el
blobd6591c6bdfbba1978a08a841e1ee006c52b60125
1 ;;; version.el --- record version number of Emacs.
3 ;;; Copyright (C) 1985, 1992, 1994, 1995, 1999 Free Software Foundation, Inc.
5 ;; Maintainer: FSF
6 ;; Keywords: internal
8 ;; This file is part of GNU Emacs.
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.
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.
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.
25 ;;; Code:
27 (defconst emacs-version "20.5.92" "\
28 Version numbers of this version of Emacs.")
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.
34 This variable first existed in version 19.23.")
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.
40 This variable first existed in version 19.23.")
42 (defconst emacs-build-time (current-time) "\
43 Time at which Emacs was dumped out.")
45 (defconst emacs-build-system (system-name))
47 (defun emacs-version (&optional here) "\
48 Return string describing the version of Emacs that is running.
49 If optional argument HERE is non-nil, insert string at point.
50 Don't use this function in programs to choose actions according
51 to 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))))
70 ;;; We hope that this alias is easier for people to find.
71 (defalias 'version 'emacs-version)
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")))
78 ;;Local variables:
79 ;;version-control: never
80 ;;End:
82 ;;; version.el ends here