* wl-version.el (wl-generate-user-agent-string): Commentary.
authorkaoru <kaoru>
Wed, 13 Dec 2000 18:34:20 +0000 (18:34 +0000)
committerkaoru <kaoru>
Wed, 13 Dec 2000 18:34:20 +0000 (18:34 +0000)
(wl-generate-user-agent-string-1): Use `when' for
one-branch conditional statement, instead of `and' and `if'.
(wl-extended-emacs-version, wl-extended-emacs-version2,
wl-extended-emacs-version3): Ditto.

wl/ChangeLog
wl/wl-version.el

index 42a7138..df563df 100644 (file)
@@ -1,3 +1,11 @@
+2000-12-13  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-version.el (wl-generate-user-agent-string): Commentary.
+       (wl-generate-user-agent-string-1): Use `when' for
+       one-branch conditional statement, instead of `and' and `if'.
+       (wl-extended-emacs-version, wl-extended-emacs-version2,
+       wl-extended-emacs-version3): Ditto.
+
 2000-12-12  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * wl-summary.el (wl-summary-sync-all-init): New inline function.
index fe6c961..edd6917 100644 (file)
@@ -93,10 +93,11 @@ If ARG insert string at point."
 Insert User-Agent field instead of X-Mailer field."
   (concat "User-Agent: "
          (wl-generate-user-agent-string-1
+          ;; for backward compatibility
           (or (and (boundp 'mime-edit-insert-user-agent-field)
-                   mime-edit-insert-user-agent-field)
+                   mime-edit-insert-user-agent-field) ; SEMI
               (and (boundp 'mime-editor/version)
-                   mime-editor/version)))))
+                   mime-editor/version))))) ; verbose User-Agent when tm
 
 (defun wl-generate-user-agent-string-1 (&optional verbose)
   "Return User-Agent field value.
@@ -115,17 +116,14 @@ If VERBOSE return with SEMI, FLIM and APEL version."
      ((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) ")"))
+             (when (and (boundp 'mime-editor/codename) mime-editor/codename)
+               (concat " (" mime-editor/codename ")"))
+             (when (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)
@@ -143,25 +141,23 @@ If WITH-CODENAME add XEmacs codename."
   (cond
    ((string-match "^\\([0-9]+\\.[0-9]+\\)\\.[.0-9]+$" emacs-version)
     (concat "Emacs " (wl-match-string 1 emacs-version)
-           (and (boundp 'mule-version)(concat "/Mule " mule-version))))
+           (when (boundp 'mule-version) (concat "/Mule " mule-version))))
    ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
                  emacs-version)
     (concat (wl-match-string 1 emacs-version)
            (format " %d.%d" emacs-major-version emacs-minor-version)
-           (if (and (boundp 'emacs-beta-version)
-                    emacs-beta-version)
-               (format "b%d" emacs-beta-version))
-           (if with-codename
-               (if (boundp 'xemacs-codename)
-                   (concat " - \"" xemacs-codename "\"")))))
+           (when (and (boundp 'emacs-beta-version) emacs-beta-version)
+             (format "b%d" emacs-beta-version))
+           (when (and with-codename
+                      (boundp 'xemacs-codename) xemacs-codename)
+             (concat " - \"" xemacs-codename "\""))))
    (t emacs-version)))
 
 (defun wl-extended-emacs-version2 (&optional delimiter with-codename)
   "Stringified Emacs version.
 Separate DELIMITER (default is \" \").  If WITH-CODENAME add XEmacs codename."
   (cond
-   ((and (boundp 'mule-version)
-        mule-version
+   ((and (boundp 'mule-version) mule-version
         (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
     (format "Mule%s%s@%d.%d%s"
            (or delimiter " ")
@@ -186,21 +182,18 @@ Separate DELIMITER (default is \" \").  If WITH-CODENAME add XEmacs codename."
     (concat (wl-match-string 1 emacs-version)
            (or delimiter " ")
            (format "%d.%d" emacs-major-version emacs-minor-version)
-           (if (and (boundp 'emacs-beta-version)
-                    emacs-beta-version)
-               (format "b%d" emacs-beta-version))
-           (if (and with-codename
-                    (boundp 'xemacs-codename)
-                    xemacs-codename)
-               (format " (%s)" xemacs-codename))))
+           (when (and (boundp 'emacs-beta-version) emacs-beta-version)
+             (format "b%d" emacs-beta-version))
+           (when (and with-codename
+                      (boundp 'xemacs-codename) xemacs-codename)
+             (format " (%s)" xemacs-codename))))
    (t emacs-version)))
 
 (defun wl-extended-emacs-version3 (&optional delimiter with-codename)
   "Stringified Emacs version.
 Separate DELIMITER (default is \" \").  If WITH-CODENAME add XEmacs codename."
   (cond
-   ((and (boundp 'mule-version)
-        mule-version
+   ((and (boundp 'mule-version) mule-version
         (string-match "\\([0-9]+\.[0-9]+\\)\\(.*$\\)" mule-version))
     (format "Emacs%s%d.%d Mule%s%s%s"
            (or delimiter " ")
@@ -232,13 +225,11 @@ Separate DELIMITER (default is \" \").  If WITH-CODENAME add XEmacs codename."
     (concat (wl-match-string 1 emacs-version)
            (or delimiter " ")
            (format "%d.%d" emacs-major-version emacs-minor-version)
-           (if (and (boundp 'emacs-beta-version)
-                    emacs-beta-version)
-               (format "b%d" emacs-beta-version))
-           (if (and with-codename
-                    (boundp 'xemacs-codename)
-                    xemacs-codename)
-               (format " (%s)" xemacs-codename))))
+           (when (and (boundp 'emacs-beta-version) emacs-beta-version)
+             (format "b%d" emacs-beta-version))
+           (when (and with-codename
+                      (boundp 'xemacs-codename) xemacs-codename)
+             (format " (%s)" xemacs-codename))))
    (t emacs-version)))