1 ;;; vm-version.el --- Version information about VM and the Emacs running VM.
3 ;; Copyright (C) Kyle E. Jones, Robert Widhopf-Fenk
4 ;; Copyright (C) 2003-2007 Robert Widhopf-Fenk
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2 of the License, or
9 ;; (at your option) any later version.
11 ;; This program is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License along
17 ;; with this program; if not, write to the Free Software Foundation, Inc.,
18 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 (defvar vm-version nil
22 "Version number of VM.
23 Call `vm-version' instead of accessing this variable!")
25 (defvar vm-version-info nil
26 "The exact version information for tarbundles.")
29 "Return the value of the variable `vm-version'."
33 (set-buffer (get-buffer-create " *vm-version*"))
34 (let* ((f (locate-library "vm"))
35 (d (file-name-directory f))
36 (b (get-buffer " *vm-version*"))
37 (bzrdir (expand-file-name ".bzr" (concat d "../")))
38 (bzr (and (file-exists-p bzrdir)
39 (if (functionp 'locate-file)
40 (or (locate-file "bzr.exe" exec-path)
41 (locate-file "bzr.bat" exec-path)
42 (locate-file "bzr" exec-path))
44 (setq default-directory d)
48 (= 0 (call-process bzr nil b))
51 ;; get the current branch nick and revno from bzr
52 (call-process bzr nil b nil "--no-aliases" "--no-plugins" "nick")
54 (call-process bzr nil b nil "--no-aliases" "--no-plugins" "revno"))
56 (locate-library "vm-revno")
57 (load-library "vm-revno"))
61 (message "ERROR: Cannot determine VM version!")
63 (goto-char (point-min))
64 (if (looking-at "vm-")
66 ;; remove any whitespace
67 (while (re-search-forward "[\n\t\r ]+" (point-max) t)
69 (setq vm-version (buffer-substring (point-min) (point-max)))))
74 (defconst vm-xemacs-mule-p
75 (and vm-xemacs-p (featurep 'mule)))
76 (defconst vm-xemacs-file-coding-p
77 (and vm-xemacs-p (featurep 'file-coding)
80 'set-buffer-file-coding-system)))
81 (defconst vm-fsfemacs-p
83 (defconst vm-fsfemacs-mule-p
84 (and (not vm-xemacs-mule-p) (featurep 'mule)
85 (fboundp 'set-buffer-file-coding-system)))
87 (defun vm-xemacs-p () vm-xemacs-p)
88 (defun vm-xemacs-mule-p () vm-xemacs-mule-p)
89 (defun vm-xemacs-file-coding-p () vm-xemacs-file-coding-p)
90 (defun vm-fsfemacs-p () vm-fsfemacs-p)
91 (defun vm-fsfemacs-mule-p () vm-fsfemacs-mule-p)
93 (defun vm-mouse-fsfemacs-mouse-p ()
95 (fboundp 'set-mouse-position)))
97 (defun vm-mouse-xemacs-mouse-p ()
99 (fboundp 'set-mouse-position)))
101 (defun vm-menu-fsfemacs-menus-p ()
103 (fboundp 'menu-bar-mode)))
105 (defun vm-menu-fsfemacs19-menus-p ()
107 (fboundp 'menu-bar-mode)
108 (= emacs-major-version 19)))
110 (defun vm-menu-xemacs-menus-p ()
112 (fboundp 'set-buffer-menubar)))
114 (defun vm-menu-can-eval-item-name ()
116 (fboundp 'check-menu-syntax)
118 (check-menu-syntax '("bar" ((identity "foo") 'ding t)))
121 (defun vm-multiple-frames-possible-p ()
123 (or (memq 'win (device-matching-specifier-tag-list))
124 (featurep 'tty-frames)))
126 (fboundp 'make-frame))))
128 (defun vm-mouse-support-possible-p ()
130 (featurep 'window-system))
132 (fboundp 'track-mouse))))
134 (defun vm-mouse-support-possible-here-p ()
136 (memq 'win (device-matching-specifier-tag-list)))
138 (memq window-system '(x mac w32 win32)))))
140 (defun vm-menu-support-possible-p ()
144 (fboundp 'menu-bar-mode))))
146 (defun vm-toolbar-support-possible-p ()
147 (or (and vm-xemacs-p (featurep 'toolbar))
148 (and vm-fsfemacs-p (fboundp 'tool-bar-mode) (boundp 'tool-bar-map))))
150 (defun vm-multiple-fonts-possible-p ()
152 (memq (device-type) '(x gtk mswindows)))
154 (memq window-system '(x mac w32 win32)))))
156 (defun vm-images-possible-here-p ()
157 (or (and vm-xemacs-p (memq (device-type) '(x gtk mswindows)))
158 (and vm-fsfemacs-p window-system
159 (or (fboundp 'image-type-available-p)
160 (and (stringp vm-imagemagick-convert-program)
161 (stringp vm-imagemagick-identify-program))))))
163 (defun vm-image-type-available-p (type)
164 (if (fboundp 'image-type-available-p)
165 (image-type-available-p type)
166 (or (featurep type) (eq type 'xbm))))
168 (provide 'vm-version)
170 ;;; vm-version.el ends here