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 (let ((mime-user-agent (and (boundp 'mime-edit-insert-user-agent-field)
77 mime-edit-insert-user-agent-field
78 mime-edit-user-agent-value)))
80 (concat "User-Agent: "
81 (product-string-verbose 'wl-version) " "
83 (if (and (boundp 'mime-editor/version)
85 (concat "User-Agent: "
86 (product-string-verbose 'wl-version) " "
87 "tm/" mime-editor/version
88 (if (and (boundp 'mime-editor/codename)
90 (concat " (" mime-editor/codename ")"))
91 (if (and (boundp 'mime-library-product)
93 (concat " " (aref mime-library-product 0)
95 (mapconcat 'int-to-string
96 (aref mime-library-product 1)
98 " (" (aref mime-library-product 2) ")"))
102 (concat " " (apel-version)))
104 " " (wl-extended-emacs-version3 "/" t))
105 ;; Don't use product-string-verbose for short User-Agent field.
106 (concat "User-Agent: " (product-string-1 'wl-version t) " "
107 (wl-extended-emacs-version3 "/" t))))))
110 (defun wl-extended-emacs-version (&optional with-codename)
111 "Stringified Emacs version.
112 If WITH-CODENAME add XEmacs codename."
114 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
115 (concat "Emacs " (wl-match-string 1 emacs-version)
116 (and (boundp 'mule-version)(concat "/Mule " mule-version))))
117 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
119 (concat (wl-match-string 1 emacs-version)
120 (format " %d.%d" emacs-major-version emacs-minor-version)
121 (if (and (boundp 'emacs-beta-version)
123 (format "b%d" emacs-beta-version))
125 (if (boundp 'xemacs-codename)
126 (concat " - \"" xemacs-codename "\"")))))
129 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
130 "Stringified Emacs version.
131 Separate DELIMITER (default it \" \"). If WITH-CODENAME add XEmacs codename."
133 ((and (boundp 'mule-version)
135 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
136 (format "Mule%s%s@%d.%d%s"
138 (wl-match-string 1 mule-version)
142 (wl-match-string 2 mule-version)
144 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
145 (if (boundp 'nemacs-version)
146 (concat "Nemacs" (or delimiter " ")
149 (substring emacs-version
152 (concat "Emacs" (or delimiter " ")
153 (wl-match-string 1 emacs-version))))
154 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
156 (concat (wl-match-string 1 emacs-version)
158 (format "%d.%d" emacs-major-version emacs-minor-version)
159 (if (and (boundp 'emacs-beta-version)
161 (format "b%d" emacs-beta-version))
162 (if (and with-codename
163 (boundp 'xemacs-codename)
165 (format " (%s)" xemacs-codename))))
168 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
169 "Stringified Emacs version.
170 Separate DELIMITER (default it \" \"). If WITH-CODENAME add XEmacs codename."
172 ((and (boundp 'mule-version)
174 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
175 (format "Emacs%s%d.%d Mule%s%s%s"
180 (wl-match-string 1 mule-version)
182 (wl-match-string 2 mule-version)
184 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
185 (if (boundp 'nemacs-version)
186 (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
187 ("3.3.1" . " (HINAMATSURI)")
188 ("3.2.3" . " (YUMENO-AWAYUKI)"))))
189 (format "Emacs%s%s Nemacs%s%s%s"
191 (wl-match-string 1 emacs-version)
194 (or (and with-codename
195 (cdr (assoc nemacs-version
196 nemacs-codename-assoc)))
198 (concat "Emacs" (or delimiter " ")
199 (wl-match-string 1 emacs-version))))
200 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
202 (concat (wl-match-string 1 emacs-version)
204 (format "%d.%d" emacs-major-version emacs-minor-version)
205 (if (and (boundp 'emacs-beta-version)
207 (format "b%d" emacs-beta-version))
208 (if (and with-codename
209 (boundp 'xemacs-codename)
211 (format " (%s)" xemacs-codename))))
215 ;; for backward compatibility
216 (defconst wl-appname (product-name (product-find 'wl-version)))
217 (make-obsolete-variable
219 "use (product-name (product-find 'wl-version)) insteaed.")
221 (defconst wl-version (product-version-string (product-find 'wl-version)))
222 (make-obsolete-variable
224 "use (product-version-string (product-find 'wl-version)) instead.")
226 (defconst wl-codename (product-code-name (product-find 'wl-version)))
227 (make-obsolete-variable
229 "use (product-code-name (product-find 'wl-version)) instead.")
231 ;;; wl-version.el ends here