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.
51 (defconst wl-version-status nil
52 "Wanderlust verstion status. For override default rule.
53 If nil, use default rule.")
57 (product-version-as-string 'wl-version)
59 ;; Don't support insert string at-point (C-u M-x wl-version).
60 ;; For bug report, use `wl-generate-user-agent-string-1' instead.
61 ;; When non-interactive, use `product-string-1' instead.
63 "Print Wanderlust version."
65 (let ((product-info (product-string-1 'wl-version t)))
67 (message "%s" product-info)
70 (defun wl-version-status ()
71 "Return version status string."
73 (if (zerop (% (nth 1 (product-version (product-find 'wl-version))) 2))
77 ;; avoid compile warnings
79 (defvar nemacs-version)
80 (defvar emacs-beta-version)
81 (defvar xemacs-codename)
82 (defvar mime-edit-insert-user-agent-field)
83 (defvar mime-edit-user-agent-value)
84 (defvar mime-editor/version)
85 (defvar mime-editor/codename)
87 (defun wl-generate-user-agent-string ()
88 "A candidate of `wl-generate-mailer-string-function'.
89 Insert User-Agent field instead of X-Mailer field."
90 (concat "User-Agent: "
91 (wl-generate-user-agent-string-1
92 ;; for backward compatibility
93 (or (and (boundp 'mime-edit-insert-user-agent-field)
94 mime-edit-insert-user-agent-field) ; SEMI
95 (and (boundp 'mime-editor/version)
96 mime-editor/version))))) ; verbose User-Agent when tm
98 (defun wl-generate-user-agent-string-1 (&optional verbose)
99 "Return User-Agent field value.
100 If VERBOSE return with SEMI, FLIM and APEL version."
102 ;; Don't use `product-string-verbose' for short User-Agent field value.
104 (concat (product-string-1 'wl-version t) " "
105 (wl-extended-emacs-version3 "/" t)))
107 ((and (boundp 'mime-edit-user-agent-value) mime-edit-user-agent-value)
108 (concat (product-string-verbose 'wl-version) " "
109 mime-edit-user-agent-value))
111 ((and (boundp 'mime-editor/version) mime-editor/version)
112 (concat (product-string-verbose 'wl-version) " "
113 "tm/" mime-editor/version
114 (when (and (boundp 'mime-editor/codename) mime-editor/codename)
115 (concat " (" mime-editor/codename ")"))
116 (when (and (boundp 'mime-library-product) mime-library-product)
117 (concat " " (aref mime-library-product 0)
118 "/" (mapconcat 'int-to-string
119 (aref mime-library-product 1)
121 " (" (aref mime-library-product 2) ")"))
125 (concat " " (apel-version)))
127 " " (wl-extended-emacs-version3 "/" t)))
130 (product-string-1 'wl-version nil))))
133 (defun wl-extended-emacs-version (&optional with-codename)
134 "Stringified Emacs version.
135 If WITH-CODENAME add XEmacs codename."
137 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
138 (concat "Emacs " (elmo-match-string 1 emacs-version)
139 (when (boundp 'mule-version) (concat "/Mule " mule-version))))
140 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
142 (concat (elmo-match-string 1 emacs-version)
143 (format " %d.%d" emacs-major-version emacs-minor-version)
144 (when (and (boundp 'emacs-beta-version) emacs-beta-version)
145 (format "b%d" emacs-beta-version))
146 (when (and with-codename
147 (boundp 'xemacs-codename) xemacs-codename)
148 (concat " - \"" xemacs-codename "\""))))
151 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
152 "Stringified Emacs version.
153 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
155 ((and (boundp 'mule-version) mule-version
156 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
157 (format "Mule%s%s@%d.%d%s"
159 (elmo-match-string 1 mule-version)
163 (elmo-match-string 2 mule-version)
165 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
166 (if (boundp 'nemacs-version)
167 (concat "Nemacs" (or delimiter " ")
170 (substring emacs-version
173 (concat "Emacs" (or delimiter " ")
174 (elmo-match-string 1 emacs-version))))
175 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
177 (concat (elmo-match-string 1 emacs-version)
179 (format "%d.%d" emacs-major-version emacs-minor-version)
180 (when (and (boundp 'emacs-beta-version) emacs-beta-version)
181 (format "b%d" emacs-beta-version))
182 (when (and with-codename
183 (boundp 'xemacs-codename) xemacs-codename)
184 (format " (%s)" xemacs-codename))))
187 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
188 "Stringified Emacs version.
189 Separate DELIMITER (default is \" \"). If WITH-CODENAME add XEmacs codename."
191 ((and (boundp 'mule-version) mule-version
192 (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
193 (format "Emacs%s%d.%d Mule%s%s%s"
198 (elmo-match-string 1 mule-version)
200 (elmo-match-string 2 mule-version)
202 ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
203 (if (boundp 'nemacs-version)
204 (let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
205 ("3.3.1" . " (HINAMATSURI)")
206 ("3.2.3" . " (YUMENO-AWAYUKI)"))))
207 (format "Emacs%s%s Nemacs%s%s%s"
209 (elmo-match-string 1 emacs-version)
212 (or (and with-codename
213 (cdr (assoc nemacs-version
214 nemacs-codename-assoc)))
216 (concat "Emacs" (or delimiter " ")
217 (elmo-match-string 1 emacs-version))))
218 ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
220 (concat (elmo-match-string 1 emacs-version)
222 (format "%d.%d" emacs-major-version emacs-minor-version)
223 (when (and (boundp 'emacs-beta-version) emacs-beta-version)
224 (format "b%d" emacs-beta-version))
225 (when (and with-codename
226 (boundp 'xemacs-codename) xemacs-codename)
227 (format " (%s)" xemacs-codename))))
231 ;; for backward compatibility
232 (defconst wl-appname (product-name (product-find 'wl-version)))
233 (make-obsolete-variable
235 "use (product-name (product-find 'wl-version)) insteaed.")
237 (defconst wl-version (product-version-string (product-find 'wl-version)))
238 (make-obsolete-variable
240 "use (product-version-string (product-find 'wl-version)) instead.")
242 (defconst wl-codename (product-code-name (product-find 'wl-version)))
243 (make-obsolete-variable
245 "use (product-code-name (product-find 'wl-version)) instead.")
247 ;;; wl-version.el ends here