fix
[elisp/wanderlust.git] / wl / wl-version.el
index 1a6d6c5..4c83a1c 100644 (file)
@@ -1,8 +1,10 @@
 ;;; wl-version.el -- Version information for Wanderlust.
 
-;; Copyright 2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 2000 TAKAHASHI Kaoru <kaoru@kaisei.org>
 
 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
+;;     TAKAHASHI Kaoru <kaoru@kaisei.org>
 ;; Keywords: mail, net news
 
 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
 ;;; Code:
 ;;
 (require 'product)
-(provide 'wl-version)                  ; have to declare in the top.
+(require 'elmo-version)                        ; product-version-as-string
+(provide 'wl-version)                  ; before product-provide
 
+;; product-define in the first place
 (product-provide 'wl-version
   (product-define
    "Wanderlust" nil
    (eval-when-compile
-     (require 'elmo-version)
      (product-version (product-find 'elmo-version))) ; equals to ELMO version.
-   "Roam"))
+   "Smooth"))
 
 ;; set version-string
-(if (fboundp 'product-version-as-string)
-    (product-version-as-string 'wl-version)
-  (product-string-1 'wl-version))      ; APEL 10.2 or earlier
+(product-version-as-string 'wl-version)
 
 ;; require wl-util after product-provide.
 (eval-when-compile (require 'wl-util)) ; wl-match-string
@@ -90,42 +91,50 @@ If ARG insert string at point."
 (defun wl-generate-user-agent-string ()
   "A candidate of `wl-generate-mailer-string-func'.
 Insert User-Agent field instead of X-Mailer field."
-  (concat "User-Agent: " (wl-generate-user-agent-string-1 t)))
+  (concat "User-Agent: "
+         (wl-generate-user-agent-string-1
+          (or (and (boundp 'mime-edit-insert-user-agent-field)
+                   mime-edit-insert-user-agent-field)
+              (and (boundp 'mime-editor/version)
+                   mime-editor/version)))))
 
 (defun wl-generate-user-agent-string-1 (&optional verbose)
   "Return User-Agent field value.
-If VERBOSE return with SEMI, FLIM and APEL version"
-  (let ((mime-user-agent (and (boundp 'mime-edit-insert-user-agent-field)
-                             mime-edit-insert-user-agent-field
-                             mime-edit-user-agent-value)))
-    (if (and verbose mime-user-agent)
-       (concat (product-string-verbose 'wl-version) " "
-               mime-user-agent)
-      (if (and verbose
-              (boundp 'mime-editor/version)
-              mime-editor/version)
-         (concat (product-string-verbose 'wl-version) " "
-                 "tm/" mime-editor/version
-                 (if (and (boundp 'mime-editor/codename)
-                          mime-editor/codename)
-                     (concat " (" mime-editor/codename ")"))
-                 (if (and (boundp 'mime-library-product)
-                          mime-library-product)
-                     (concat " " (aref mime-library-product 0)
-                             "/"
-                             (mapconcat 'int-to-string
-                                        (aref mime-library-product 1)
-                                        ".")
-                             " (" (aref mime-library-product 2) ")"))
-                 (condition-case nil
-                     (progn
-                       (require 'apel-ver)
-                       (concat " " (apel-version)))
-                   (file-error nil))
-                 " " (wl-extended-emacs-version3 "/" t))
-       ;; Don't use product-string-verbose for short User-Agent field.
-       (concat (product-string-1 'wl-version t) " "
-               (wl-extended-emacs-version3 "/" t))))))
+If VERBOSE return with SEMI, FLIM and APEL version."
+  (if (not verbose)
+      ;; Don't use product-string-verbose for short User-Agent field value.
+      (concat (product-string-1 'wl-version t) " "
+             (wl-extended-emacs-version3 "/" t))
+    ;; verbose
+    (cond
+     ;; SEMI
+     ((and (boundp 'mime-edit-user-agent-value) mime-edit-user-agent-value)
+      (concat (product-string-verbose 'wl-version) " "
+             mime-edit-user-agent-value))
+     ;; tm
+     ((and (boundp 'mime-editor/version) mime-editor/version)
+      (concat (product-string-verbose 'wl-version) " "
+             "tm/" mime-editor/version
+             (if (and (boundp 'mime-editor/codename)
+                      mime-editor/codename)
+                 (concat " (" mime-editor/codename ")"))
+             (if (and (boundp 'mime-library-product)
+                      mime-library-product)
+                 (concat " " (aref mime-library-product 0)
+                         "/"
+                         (mapconcat 'int-to-string
+                                    (aref mime-library-product 1)
+                                    ".")
+                         " (" (aref mime-library-product 2) ")"))
+             (condition-case nil
+                 (progn
+                   (require 'apel-ver)
+                   (concat " " (apel-version)))
+               (file-error nil))
+             " " (wl-extended-emacs-version3 "/" t)))
+     ;; error case
+     (t
+      (product-string-1 'wl-version nil)))))
 
 ;; from gnus
 (defun wl-extended-emacs-version (&optional with-codename)
@@ -149,7 +158,7 @@ If WITH-CODENAME add XEmacs codename."
 
 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
   "Stringified Emacs version.
-Separate DELIMITER (default it \" \").  If WITH-CODENAME add XEmacs codename."
+Separate DELIMITER (default is \" \").  If WITH-CODENAME add XEmacs codename."
   (cond
    ((and (boundp 'mule-version)
         mule-version
@@ -188,7 +197,7 @@ Separate DELIMITER (default it \" \").  If WITH-CODENAME add XEmacs codename."
 
 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
   "Stringified Emacs version.
-Separate DELIMITER (default it \" \").  If WITH-CODENAME add XEmacs codename."
+Separate DELIMITER (default is \" \").  If WITH-CODENAME add XEmacs codename."
   (cond
    ((and (boundp 'mule-version)
         mule-version