1 ;;; wl-version.el -- Version information for Wanderlust.
3 ;; Copyright (C) 2000-2001 Yuuichi Teranishi <teranisi@gohome.org>
4 ;; Copyright (C) 2000-2001 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.
30 ;; Put the following lines to each file of Wanderlust package.
33 ;; (product-provide (provide FEATURE) (require 'wl-version))
38 (require 'elmo-version) ; product-version-as-string
40 (require 'elmo-util)) ; elmo-match-string
41 (provide 'wl-version) ; before product-provide
43 ;; product-define in the first place
44 (product-provide 'wl-version
48 (product-version (product-find 'elmo-version))) ; equals to ELMO version.
52 (product-version-as-string 'wl-version)
54 ;; Don't support insert string at-point (C-u M-x wl-version).
55 ;; For bug report, use `wl-generate-user-agent-string-1' instead.
56 ;; When non-interactive, use `product-string-1' instead.
58 "Print Wanderlust version."
60 (let ((product-info (product-string-1 'wl-version t)))
62 (message "%s" product-info)
65 (defvar wl-version-status-alist
66 '(((zerop (% (nth 1 (product-version (product-find 'wl-version))) 2))
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)))
82 ;; avoid compile warnings
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-function'.
94 Insert User-Agent field instead of X-Mailer field."
95 (concat "User-Agent: "
96 (wl-generate-user-agent-string-1
97 ;; for backward compatibility
98 (or (and (boundp 'mime-edit-insert-user-agent-field)
99 mime-edit-insert-user-agent-field) ; SEMI
100 (and (boundp 'mime-editor/version)
101 mime-editor/version))))) ; verbose User-Agent when tm
103 (defun wl-generate-user-agent-string-1 (&optional verbose)
104 "Return User-Agent field value.
105 If VERBOSE return with SEMI, FLIM and APEL version."
107 ;; Don't use `product-string-verbose' for short User-Agent field value.
109 (concat (product-string-1 'wl-version t) " "
110 (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 (when (and (boundp 'mime-editor/codename) mime-editor/codename)
120 (concat " (" mime-editor/codename ")"))
121 (when (and (boundp 'mime-library-product) mime-library-product)
122 (concat " " (aref mime-library-product 0)
123 "/" (mapconcat 'int-to-string
124 (aref mime-library-product 1)
126 " (" (aref mime-library-product 2) ")"))
130 (concat " " (apel-version)))
132 " " (wl-extended-emacs-version3 "/" t)))
135 (product-string-1 'wl-version nil))))
138 (defun wl-extended-emacs-version (&optional with-codename)
139 "Stringified Emacs version.
140 If WITH-CODENAME add XEmacs codename."
142 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
143 (concat "Emacs " (elmo-match-string 1 emacs-version)
144 (when (boundp 'mule-version) (concat "/Mule " mule-version))))
145 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
147 (concat (elmo-match-string 1 emacs-version)
148 (format " %d.%d" emacs-major-version emacs-minor-version)
149 (when (and (boundp 'emacs-beta-version) emacs-beta-version)
150 (format "b%d" emacs-beta-version))
151 (when (and with-codename
152 (boundp 'xemacs-codename) xemacs-codename)
153 (concat " - \"" xemacs-codename "\""))))
156 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
157 "Stringified Emacs version.
158 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
160 ((and (boundp 'mule-version) mule-version
161 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
162 (format "Mule%s%s@%d.%d%s"
164 (elmo-match-string 1 mule-version)
168 (elmo-match-string 2 mule-version)
170 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
171 (if (boundp 'nemacs-version)
172 (concat "Nemacs" (or delimiter " ")
175 (substring emacs-version
178 (concat "Emacs" (or delimiter " ")
179 (elmo-match-string 1 emacs-version))))
180 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
182 (concat (elmo-match-string 1 emacs-version)
184 (format "%d.%d" emacs-major-version emacs-minor-version)
185 (when (and (boundp 'emacs-beta-version) emacs-beta-version)
186 (format "b%d" emacs-beta-version))
187 (when (and with-codename
188 (boundp 'xemacs-codename) xemacs-codename)
189 (format " (%s)" xemacs-codename))))
192 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
193 "Stringified Emacs version.
194 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
196 ((and (boundp 'mule-version) mule-version
197 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
198 (format "Emacs%s%d.%d Mule%s%s%s"
203 (elmo-match-string 1 mule-version)
205 (elmo-match-string 2 mule-version)
207 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
208 (if (boundp 'nemacs-version)
209 (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
210 ("3.3.1" . " (HINAMATSURI)")
211 ("3.2.3" . " (YUMENO-AWAYUKI)"))))
212 (format "Emacs%s%s Nemacs%s%s%s"
214 (elmo-match-string 1 emacs-version)
217 (or (and with-codename
218 (cdr (assoc nemacs-version
219 nemacs-codename-assoc)))
221 (concat "Emacs" (or delimiter " ")
222 (elmo-match-string 1 emacs-version))))
223 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
225 (concat (elmo-match-string 1 emacs-version)
227 (format "%d.%d" emacs-major-version emacs-minor-version)
228 (when (and (boundp 'emacs-beta-version) emacs-beta-version)
229 (format "b%d" emacs-beta-version))
230 (when (and with-codename
231 (boundp 'xemacs-codename) xemacs-codename)
232 (format " (%s)" xemacs-codename))))
236 ;; for backward compatibility
237 (defconst wl-appname (product-name (product-find 'wl-version)))
238 (make-obsolete-variable
240 "use (product-name (product-find 'wl-version)) insteaed.")
242 (defconst wl-version (product-version-string (product-find 'wl-version)))
243 (make-obsolete-variable
245 "use (product-version-string (product-find 'wl-version)) instead.")
247 (defconst wl-codename (product-code-name (product-find 'wl-version)))
248 (make-obsolete-variable
250 "use (product-code-name (product-find 'wl-version)) instead.")
252 ;;; wl-version.el ends here