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 (require 'elmo-version) ; product-version-as-string
35 (provide 'wl-version) ; before product-provide
37 ;; product-define in the first place
38 (product-provide 'wl-version
42 (product-version (product-find 'elmo-version))) ; equals to ELMO version.
46 (product-version-as-string 'wl-version)
48 ;; require wl-util after product-provide.
49 (eval-when-compile (require 'wl-util)) ; wl-match-string
51 (defun wl-version (&optional with-codename)
52 "Return Wanderlust version.
53 If WITH-CODENAME add codename."
54 (product-string-1 'wl-version with-codename))
56 (defun wl-version-show (&optional arg)
57 "Print Wanderlust version.
58 If ARG insert string at point."
61 (insert (message "%s" (wl-version t)))
62 (message "%s" (wl-version t))))
64 (defvar wl-version-status-alist
65 '(((eq (% (nth 1 (product-version (product-find 'wl-version))) 2) 0)
68 "An alist to define the version status.")
70 (defun wl-version-status ()
71 "Return version status (\"stable\" or \"beta\")."
72 (let ((salist wl-version-status-alist)
75 (when (eval (car (car salist)))
76 (setq status (cdr (car salist)))
78 (setq salist (cdr salist)))
83 (defvar nemacs-version)
84 (defvar emacs-beta-version)
85 (defvar xemacs-codename)
86 (defvar mime-edit-insert-user-agent-field)
87 (defvar mime-edit-user-agent-value)
88 (defvar mime-editor/version)
89 (defvar mime-editor/codename)
91 (defun wl-generate-user-agent-string ()
92 "A candidate of `wl-generate-mailer-string-func'.
93 Insert User-Agent field instead of X-Mailer field."
94 (concat "User-Agent: "
95 (wl-generate-user-agent-string-1
96 (or (and (boundp 'mime-edit-insert-user-agent-field)
97 mime-edit-insert-user-agent-field)
98 (and (boundp 'mime-editor/version)
99 mime-editor/version)))))
101 (defun wl-generate-user-agent-string-1 (&optional verbose)
102 "Return User-Agent field value.
103 If VERBOSE return with SEMI, FLIM and APEL version."
105 ;; Don't use product-string-verbose for short User-Agent field value.
106 (concat (product-string-1 'wl-version t) " "
107 (wl-extended-emacs-version3 "/" t))
111 ((and (boundp 'mime-edit-user-agent-value) mime-edit-user-agent-value)
112 (concat (product-string-verbose 'wl-version) " "
113 mime-edit-user-agent-value))
115 ((and (boundp 'mime-editor/version) mime-editor/version)
116 (concat (product-string-verbose 'wl-version) " "
117 "tm/" mime-editor/version
118 (if (and (boundp 'mime-editor/codename)
119 mime-editor/codename)
120 (concat " (" mime-editor/codename ")"))
121 (if (and (boundp 'mime-library-product)
122 mime-library-product)
123 (concat " " (aref mime-library-product 0)
125 (mapconcat 'int-to-string
126 (aref mime-library-product 1)
128 " (" (aref mime-library-product 2) ")"))
132 (concat " " (apel-version)))
134 " " (wl-extended-emacs-version3 "/" t)))
137 (product-string-1 'wl-version nil)))))
140 (defun wl-extended-emacs-version (&optional with-codename)
141 "Stringified Emacs version.
142 If WITH-CODENAME add XEmacs codename."
144 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
145 (concat "Emacs " (wl-match-string 1 emacs-version)
146 (and (boundp 'mule-version)(concat "/Mule " mule-version))))
147 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
149 (concat (wl-match-string 1 emacs-version)
150 (format " %d.%d" emacs-major-version emacs-minor-version)
151 (if (and (boundp 'emacs-beta-version)
153 (format "b%d" emacs-beta-version))
155 (if (boundp 'xemacs-codename)
156 (concat " - \"" xemacs-codename "\"")))))
159 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
160 "Stringified Emacs version.
161 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
163 ((and (boundp 'mule-version)
165 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
166 (format "Mule%s%s@%d.%d%s"
168 (wl-match-string 1 mule-version)
172 (wl-match-string 2 mule-version)
174 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
175 (if (boundp 'nemacs-version)
176 (concat "Nemacs" (or delimiter " ")
179 (substring emacs-version
182 (concat "Emacs" (or delimiter " ")
183 (wl-match-string 1 emacs-version))))
184 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
186 (concat (wl-match-string 1 emacs-version)
188 (format "%d.%d" emacs-major-version emacs-minor-version)
189 (if (and (boundp 'emacs-beta-version)
191 (format "b%d" emacs-beta-version))
192 (if (and with-codename
193 (boundp 'xemacs-codename)
195 (format " (%s)" xemacs-codename))))
198 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
199 "Stringified Emacs version.
200 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
202 ((and (boundp 'mule-version)
204 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
205 (format "Emacs%s%d.%d Mule%s%s%s"
210 (wl-match-string 1 mule-version)
212 (wl-match-string 2 mule-version)
214 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
215 (if (boundp 'nemacs-version)
216 (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
217 ("3.3.1" . " (HINAMATSURI)")
218 ("3.2.3" . " (YUMENO-AWAYUKI)"))))
219 (format "Emacs%s%s Nemacs%s%s%s"
221 (wl-match-string 1 emacs-version)
224 (or (and with-codename
225 (cdr (assoc nemacs-version
226 nemacs-codename-assoc)))
228 (concat "Emacs" (or delimiter " ")
229 (wl-match-string 1 emacs-version))))
230 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
232 (concat (wl-match-string 1 emacs-version)
234 (format "%d.%d" emacs-major-version emacs-minor-version)
235 (if (and (boundp 'emacs-beta-version)
237 (format "b%d" emacs-beta-version))
238 (if (and with-codename
239 (boundp 'xemacs-codename)
241 (format " (%s)" xemacs-codename))))
245 ;; for backward compatibility
246 (defconst wl-appname (product-name (product-find 'wl-version)))
247 (make-obsolete-variable
249 "use (product-name (product-find 'wl-version)) insteaed.")
251 (defconst wl-version (product-version-string (product-find 'wl-version)))
252 (make-obsolete-variable
254 "use (product-version-string (product-find 'wl-version)) instead.")
256 (defconst wl-codename (product-code-name (product-find 'wl-version)))
257 (make-obsolete-variable
259 "use (product-code-name (product-find 'wl-version)) instead.")
261 ;;; wl-version.el ends here