1 ;;; wl-version.el -- Version information for Wanderlust.
3 ;; Copyright 2000 Yuuichi Teranishi <teranisi@gohome.org>
5 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
6 ;; Keywords: mail, net news
8 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
10 ;; This program 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)
15 ;; This program 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.
32 (provide 'wl-version) ; have to declare in the top.
34 (product-provide 'wl-version
38 (require 'elmo-version)
39 (product-version (product-find 'elmo-version))) ; equals to ELMO version.
43 (if (fboundp 'product-version-as-string)
44 (product-version-as-string 'wl-version)
45 (product-string-1 'wl-version)) ; APEL 10.2 or earlier
47 ;; require wl-util after product-provide.
48 (eval-when-compile (require 'wl-util)) ; wl-match-string
52 (defvar nemacs-version)
53 (defvar emacs-beta-version)
54 (defvar xemacs-codename)
55 (defvar mime-edit-insert-user-agent-field)
56 (defvar mime-edit-user-agent-value)
57 (defvar mime-editor/version)
58 (defvar mime-editor/codename)
60 (defun wl-version (&optional with-codename)
61 "Return Wanderlust version.
62 If WITH-CODENAME add codename."
63 (product-string-1 'wl-version with-codename))
65 (defun wl-version-show (&optional arg)
66 "Print Wanderlust version.
67 If ARG insert string at point."
70 (insert (message "%s" (wl-version t)))
71 (message "%s" (wl-version t))))
73 (defun wl-generate-user-agent-string ()
74 "A candidate of `wl-generate-mailer-string-func'.
75 Insert User-Agent field instead of X-Mailer field."
76 (concat "User-Agent: " (wl-generate-user-agent-string-1 t)))
78 (defun wl-generate-user-agent-string-1 (&optional verbose)
79 "Return User-Agent field value."
80 (let ((mime-user-agent (and (boundp 'mime-edit-insert-user-agent-field)
81 mime-edit-insert-user-agent-field
82 mime-edit-user-agent-value)))
83 (if (and verbose mime-user-agent)
84 (concat (product-string-verbose 'wl-version) " "
87 (boundp 'mime-editor/version)
89 (concat (product-string-verbose 'wl-version) " "
90 "tm/" mime-editor/version
91 (if (and (boundp 'mime-editor/codename)
93 (concat " (" mime-editor/codename ")"))
94 (if (and (boundp 'mime-library-product)
96 (concat " " (aref mime-library-product 0)
98 (mapconcat 'int-to-string
99 (aref mime-library-product 1)
101 " (" (aref mime-library-product 2) ")"))
105 (concat " " (apel-version)))
107 " " (wl-extended-emacs-version3 "/" t))
108 ;; Don't use product-string-verbose for short User-Agent field.
109 (concat (product-string-1 'wl-version t) " "
110 (wl-extended-emacs-version3 "/" t))))))
113 (defun wl-extended-emacs-version (&optional with-codename)
114 "Stringified Emacs version.
115 If WITH-CODENAME add XEmacs codename."
117 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
118 (concat "Emacs " (wl-match-string 1 emacs-version)
119 (and (boundp 'mule-version)(concat "/Mule " mule-version))))
120 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
122 (concat (wl-match-string 1 emacs-version)
123 (format " %d.%d" emacs-major-version emacs-minor-version)
124 (if (and (boundp 'emacs-beta-version)
126 (format "b%d" emacs-beta-version))
128 (if (boundp 'xemacs-codename)
129 (concat " - \"" xemacs-codename "\"")))))
132 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
133 "Stringified Emacs version.
134 Separate DELIMITER (default it \" \"). If WITH-CODENAME add XEmacs codename."
136 ((and (boundp 'mule-version)
138 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
139 (format "Mule%s%s@%d.%d%s"
141 (wl-match-string 1 mule-version)
145 (wl-match-string 2 mule-version)
147 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
148 (if (boundp 'nemacs-version)
149 (concat "Nemacs" (or delimiter " ")
152 (substring emacs-version
155 (concat "Emacs" (or delimiter " ")
156 (wl-match-string 1 emacs-version))))
157 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
159 (concat (wl-match-string 1 emacs-version)
161 (format "%d.%d" emacs-major-version emacs-minor-version)
162 (if (and (boundp 'emacs-beta-version)
164 (format "b%d" emacs-beta-version))
165 (if (and with-codename
166 (boundp 'xemacs-codename)
168 (format " (%s)" xemacs-codename))))
171 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
172 "Stringified Emacs version.
173 Separate DELIMITER (default it \" \"). If WITH-CODENAME add XEmacs codename."
175 ((and (boundp 'mule-version)
177 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
178 (format "Emacs%s%d.%d Mule%s%s%s"
183 (wl-match-string 1 mule-version)
185 (wl-match-string 2 mule-version)
187 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
188 (if (boundp 'nemacs-version)
189 (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
190 ("3.3.1" . " (HINAMATSURI)")
191 ("3.2.3" . " (YUMENO-AWAYUKI)"))))
192 (format "Emacs%s%s Nemacs%s%s%s"
194 (wl-match-string 1 emacs-version)
197 (or (and with-codename
198 (cdr (assoc nemacs-version
199 nemacs-codename-assoc)))
201 (concat "Emacs" (or delimiter " ")
202 (wl-match-string 1 emacs-version))))
203 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
205 (concat (wl-match-string 1 emacs-version)
207 (format "%d.%d" emacs-major-version emacs-minor-version)
208 (if (and (boundp 'emacs-beta-version)
210 (format "b%d" emacs-beta-version))
211 (if (and with-codename
212 (boundp 'xemacs-codename)
214 (format " (%s)" xemacs-codename))))
218 ;; for backward compatibility
219 (defconst wl-appname (product-name (product-find 'wl-version)))
220 (make-obsolete-variable
222 "use (product-name (product-find 'wl-version)) insteaed.")
224 (defconst wl-version (product-version-string (product-find 'wl-version)))
225 (make-obsolete-variable
227 "use (product-version-string (product-find 'wl-version)) instead.")
229 (defconst wl-codename (product-code-name (product-find 'wl-version)))
230 (make-obsolete-variable
232 "use (product-code-name (product-find 'wl-version)) instead.")
234 ;;; wl-version.el ends here