1 ;;; wl-version.el -- Version information for Wanderlust.
3 ;; Copyright (C) 2000 Yuuichi Teranishi <teranisi@gohome.org>
4 ;; Copyright (C) 2000 TAKAHASHI Kaoru <kaoru@kaisei.org>
6 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
7 ;; TAKAHASHI Kaoru <kaoru@kaisei.org>
8 ;; Keywords: mail, net news
10 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
12 ;; This program is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; This program is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
34 (provide 'wl-version) ; have to declare in the top.
35 (require 'elmo-version) ; product-version-as-string
37 ;; product-define in the first place
38 (product-provide 'wl-version
42 ;;; (require 'elmo-version)
43 (product-version (product-find 'elmo-version))) ; equals to ELMO version.
47 (product-version-as-string 'wl-version)
49 ;; require wl-util after product-provide.
50 (eval-when-compile (require 'wl-util)) ; wl-match-string
52 (defun wl-version (&optional with-codename)
53 "Return Wanderlust version.
54 If WITH-CODENAME add codename."
55 (product-string-1 'wl-version with-codename))
57 (defun wl-version-show (&optional arg)
58 "Print Wanderlust version.
59 If ARG insert string at point."
62 (insert (message "%s" (wl-version t)))
63 (message "%s" (wl-version t))))
65 (defvar wl-version-status-alist
66 '(((eq (% (nth 1 (product-version (product-find 'wl-version))) 2) 0)
69 "An alist to define the version status.")
71 (defun wl-version-status ()
72 "Return version status (\"stable\" or \"beta\")."
73 (let ((salist wl-version-status-alist)
76 (when (eval (car (car salist)))
77 (setq status (cdr (car salist)))
79 (setq salist (cdr salist)))
84 (defvar nemacs-version)
85 (defvar emacs-beta-version)
86 (defvar xemacs-codename)
87 (defvar mime-edit-insert-user-agent-field)
88 (defvar mime-edit-user-agent-value)
89 (defvar mime-editor/version)
90 (defvar mime-editor/codename)
92 (defun wl-generate-user-agent-string ()
93 "A candidate of `wl-generate-mailer-string-func'.
94 Insert User-Agent field instead of X-Mailer field."
95 (concat "User-Agent: "
96 (wl-generate-user-agent-string-1
97 (or (and (boundp 'mime-edit-insert-user-agent-field)
98 mime-edit-insert-user-agent-field)
99 (and (boundp 'mime-editor/version)
100 mime-editor/version)))))
102 (defun wl-generate-user-agent-string-1 (&optional verbose)
103 "Return User-Agent field value.
104 If VERBOSE return with SEMI, FLIM and APEL version."
106 ;; Don't use product-string-verbose for short User-Agent field value.
107 (concat (product-string-1 'wl-version t) " "
108 (wl-extended-emacs-version3 "/" t))
112 ((and (boundp 'mime-edit-user-agent-value) mime-edit-user-agent-value)
113 (concat (product-string-verbose 'wl-version) " "
114 mime-edit-user-agent-value))
116 ((and (boundp 'mime-editor/version) mime-editor/version)
117 (concat (product-string-verbose 'wl-version) " "
118 "tm/" mime-editor/version
119 (if (and (boundp 'mime-editor/codename)
120 mime-editor/codename)
121 (concat " (" mime-editor/codename ")"))
122 (if (and (boundp 'mime-library-product)
123 mime-library-product)
124 (concat " " (aref mime-library-product 0)
126 (mapconcat 'int-to-string
127 (aref mime-library-product 1)
129 " (" (aref mime-library-product 2) ")"))
133 (concat " " (apel-version)))
135 " " (wl-extended-emacs-version3 "/" t)))
138 (product-string-1 'wl-version nil)))))
141 (defun wl-extended-emacs-version (&optional with-codename)
142 "Stringified Emacs version.
143 If WITH-CODENAME add XEmacs codename."
145 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
146 (concat "Emacs " (wl-match-string 1 emacs-version)
147 (and (boundp 'mule-version)(concat "/Mule " mule-version))))
148 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
150 (concat (wl-match-string 1 emacs-version)
151 (format " %d.%d" emacs-major-version emacs-minor-version)
152 (if (and (boundp 'emacs-beta-version)
154 (format "b%d" emacs-beta-version))
156 (if (boundp 'xemacs-codename)
157 (concat " - \"" xemacs-codename "\"")))))
160 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
161 "Stringified Emacs version.
162 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
164 ((and (boundp 'mule-version)
166 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
167 (format "Mule%s%s@%d.%d%s"
169 (wl-match-string 1 mule-version)
173 (wl-match-string 2 mule-version)
175 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
176 (if (boundp 'nemacs-version)
177 (concat "Nemacs" (or delimiter " ")
180 (substring emacs-version
183 (concat "Emacs" (or delimiter " ")
184 (wl-match-string 1 emacs-version))))
185 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
187 (concat (wl-match-string 1 emacs-version)
189 (format "%d.%d" emacs-major-version emacs-minor-version)
190 (if (and (boundp 'emacs-beta-version)
192 (format "b%d" emacs-beta-version))
193 (if (and with-codename
194 (boundp 'xemacs-codename)
196 (format " (%s)" xemacs-codename))))
199 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
200 "Stringified Emacs version.
201 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
203 ((and (boundp 'mule-version)
205 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
206 (format "Emacs%s%d.%d Mule%s%s%s"
211 (wl-match-string 1 mule-version)
213 (wl-match-string 2 mule-version)
215 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
216 (if (boundp 'nemacs-version)
217 (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
218 ("3.3.1" . " (HINAMATSURI)")
219 ("3.2.3" . " (YUMENO-AWAYUKI)"))))
220 (format "Emacs%s%s Nemacs%s%s%s"
222 (wl-match-string 1 emacs-version)
225 (or (and with-codename
226 (cdr (assoc nemacs-version
227 nemacs-codename-assoc)))
229 (concat "Emacs" (or delimiter " ")
230 (wl-match-string 1 emacs-version))))
231 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
233 (concat (wl-match-string 1 emacs-version)
235 (format "%d.%d" emacs-major-version emacs-minor-version)
236 (if (and (boundp 'emacs-beta-version)
238 (format "b%d" emacs-beta-version))
239 (if (and with-codename
240 (boundp 'xemacs-codename)
242 (format " (%s)" xemacs-codename))))
246 ;; for backward compatibility
247 (defconst wl-appname (product-name (product-find 'wl-version)))
248 (make-obsolete-variable
250 "use (product-name (product-find 'wl-version)) insteaed.")
252 (defconst wl-version (product-version-string (product-find 'wl-version)))
253 (make-obsolete-variable
255 "use (product-version-string (product-find 'wl-version)) instead.")
257 (defconst wl-codename (product-code-name (product-find 'wl-version)))
258 (make-obsolete-variable
260 "use (product-code-name (product-find 'wl-version)) instead.")
262 ;;; wl-version.el ends here