From e73469f6f91827c3f44afb707bb250cf711aa9a3 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 11 Jan 2005 03:27:57 +0000 Subject: [PATCH] * gnus.el (gnus-user-agent): Default to `(emacs gnus mime config mule)'. * gnus-vers.el (gnus-extended-version): Include SEMI, FLIM and APEL versions. * gnus-util.el (gnus-emacs-version): Include Mule and Meadow versions. * gnus-msg.el (gnus-message-make-user-agent): Invalidate optional the 1st arg. Synch to No Gnus 200501101506. --- ChangeLog | 14 ++++++++++ lisp/ChangeLog | 12 +++++++++ lisp/gnus-msg.el | 54 ++++++------------------------------- lisp/gnus-util.el | 78 ++++++++++++++++++++++++++++++++++------------------- lisp/gnus-vers.el | 47 ++++++++++++++++++++++++++------ lisp/gnus.el | 60 ++++++++++++++++++++++++++++------------- 6 files changed, 165 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index f305cb0..8f5f67e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-01-11 Katsumi Yamaoka + + * lisp/gnus.el (gnus-user-agent): Default to + `(emacs gnus mime config mule)'. + + * lisp/gnus-vers.el (gnus-extended-version): Include SEMI, FLIM + and APEL versions. + + * lisp/gnus-util.el (gnus-emacs-version): Include Mule and Meadow + versions. + + * lisp/gnus-msg.el (gnus-message-make-user-agent): Invalidate + optional the 1st arg. + 2005-01-02 Romain Francoise * GNUS-NEWS: Generated. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 014032c..47e68ff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2005-01-10 Reiner Steib + + * gnus.el (gnus-user-agent): Use list of symbols instead of + symbols. Display full version number for (S)XEmacs. Optionally + display (S)XEmacs codename. + + * gnus-util.el (gnus-emacs-version): Update for new + `gnus-user-agent'. + + * gnus-msg.el (gnus-extended-version): Make it possible to omit + Gnus version. + 2005-01-05 Reiner Steib * spam.el (spam-face): New face. Don't use `gnus-splash-face' diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index 50c625c..7a5558e 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -1119,52 +1119,14 @@ If SILENT, don't prompt the user." (t gnus-select-method)))) -;; Dummies to avoid byte-compile warning. -(eval-when-compile - (defvar xemacs-codename)) - -(defun gnus-message-make-user-agent (&optional include-mime-info max-column - newline-product) - "Return a user-agent info. If INCLUDE-MIME-INFO is non-nil and the -variable `mime-edit-user-agent-value' is bound, the value will be -included in the return value, and `gnus-user-agent' is ignored. If -MAX-COLUMN is specified, the return value will be folded up as it were -filled. NEWLINE-PRODUCT specifies whether a newline should be -inserted in front of each product-token. If the value is t or `hard', -it works strictly. Otherwise, if it is non-nil (e.g. `soft'), it -works semi-strictly. - -Here is an odd example, which inserts a User-Agent: header when you -begin to compose a message: - -\(add-hook 'gnus-message-setup-hook - (lambda nil - (setq message-user-agent nil) - (save-excursion - (save-restriction - (message-narrow-to-headers) - (goto-char (point-max)) - (insert \"User-Agent: \" - (gnus-message-make-user-agent t 76 'soft) - \"\\n\"))))) -" - (let ((gnus-v (gnus-extended-version)) - user-agent) - (cond ((and include-mime-info - (boundp 'mime-edit-user-agent-value)) - (setq user-agent (concat gnus-v " " mime-edit-user-agent-value))) - ((eq gnus-user-agent 'gnus-mime-edit) - (setq user-agent - (if (boundp 'mime-edit-user-agent-value) - (concat gnus-v " " mime-edit-user-agent-value) - gnus-v))) - (t - (setq user-agent (if (stringp gnus-user-agent) - gnus-user-agent - (concat gnus-v - (let ((emacs-v (gnus-emacs-version))) - (when emacs-v - (concat " " emacs-v)))))))) +(defun gnus-message-make-user-agent (&optional dummy max-column + newline-product) + "Return a user-agent info. If MAX-COLUMN is specified, the return +value will be folded up as it were filled. NEWLINE-PRODUCT specifies +whether a newline should be inserted in front of each product-token; +if the value is t or `hard', it works strictly. Otherwise, if it is +non-nil (e.g. `soft'), it works semi-strictly." + (let ((user-agent (gnus-extended-version))) (when max-column (unless (natnump max-column) (setq max-column 76)) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index c58fa16..7bf5f1a 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -1,5 +1,5 @@ ;;; gnus-util.el --- utility functions for Semi-gnus -;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -1504,42 +1504,64 @@ predicate on the elements." (nconc (nreverse res) list1 list2)))) (eval-when-compile - (defvar xemacs-codename)) + (defvar xemacs-codename) + (defvar sxemacs-codename) + (defvar emacs-program-version) + (unless (featurep 'meadow) + (defalias 'Meadow-version 'ignore))) (defun gnus-emacs-version () "Stringified Emacs version." - (let ((system-v - (cond - ((eq gnus-user-agent 'emacs-gnus-config) - system-configuration) - ((eq gnus-user-agent 'emacs-gnus-type) - (symbol-name system-type)) - (t nil)))) + (let* ((lst (if (listp gnus-user-agent) + gnus-user-agent + '(gnus emacs type))) + (system-v (cond ((memq 'config lst) + system-configuration) + ((memq 'type lst) + (symbol-name system-type)) + (t nil))) + (mule-v (when (and (memq 'mule lst) + (featurep 'mule)) + (concat + " MULE" + (when (boundp 'mule-version) + (concat "/" (symbol-value 'mule-version))) + (when (featurep 'meadow) + (let ((mver (Meadow-version))) + (if (string-match "^Meadow-" mver) + (concat " Meadow/" + (substring mver (match-end 0))))))))) + codename emacsname) + (cond ((featurep 'sxemacs) + (setq emacsname "SXEmacs" + codename sxemacs-codename)) + ((featurep 'xemacs) + (setq emacsname "XEmacs" + codename xemacs-codename)) + (t + (setq emacsname "Emacs"))) (cond - ((eq gnus-user-agent 'gnus) + ((not (memq 'emacs lst)) nil) ((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version) + ;; Emacs: (concat "Emacs/" (match-string 1 emacs-version) (if system-v (concat " (" system-v ")") - ""))) - ((string-match - "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?" - emacs-version) - (concat - (match-string 1 emacs-version) - (format "/%d.%d" emacs-major-version emacs-minor-version) - (if (match-beginning 3) - (match-string 3 emacs-version) - "") - (if (boundp 'xemacs-codename) - (concat - " (" xemacs-codename - (if system-v - (concat ", " system-v ")") - ")")) - ""))) - (t emacs-version)))) + "") + mule-v)) + ((or (featurep 'sxemacs) (featurep 'xemacs)) + ;; XEmacs or SXEmacs: + (concat emacsname "/" emacs-program-version + " (" + (when (and (memq 'codename lst) + codename) + (concat codename + (when system-v ", "))) + (when system-v system-v) + ")" + mule-v)) + (t (concat emacs-version mule-v))))) (defun gnus-rename-file (old-path new-path &optional trim) "Rename OLD-PATH as NEW-PATH. If TRIM, recursively delete diff --git a/lisp/gnus-vers.el b/lisp/gnus-vers.el index fad71b7..fe63f5c 100644 --- a/lisp/gnus-vers.el +++ b/lisp/gnus-vers.el @@ -1,6 +1,7 @@ ;;; gnus-vers.el --- Declare gnus version -;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 +;; Free Software Foundation, Inc. ;; Author: Keiichi Suzuki ;; Katsumi Yamaoka @@ -74,13 +75,43 @@ If ARG, insert string at point." (insert (message "%s" gnus-version)) (message "%s" gnus-version))) +(eval-when-compile + (defvar mime-user-interface-product) + (require 'mime-def)) + (defun gnus-extended-version () - "Stringified gnus version." - (concat gnus-product-name "/" gnus-version-number - " (based on " - gnus-original-product-name " v" gnus-original-version-number ")" - (if (zerop (string-to-number gnus-revision-number)) - "" - (concat " (revision " gnus-revision-number ")")))) + "Stringified Gnus, Emacs, SEMI, FLIM and APEL versions. +See the variable `gnus-user-agent'." + (if (stringp gnus-user-agent) + gnus-user-agent + ;; `gnus-user-agent' is a list: + (let* ((float-output-format nil) + (gnus-v (when (memq 'gnus gnus-user-agent) + (concat + gnus-product-name "/" gnus-version-number " (" + (unless (zerop (string-to-number gnus-revision-number)) + (concat "r" gnus-revision-number ", ")) + "based on " gnus-original-product-name + " v" gnus-original-version-number ")"))) + (emacs-v (gnus-emacs-version)) + (mime-v (when (memq 'mime gnus-user-agent) + (concat + (mime-product-name mime-user-interface-product) "/" + (mapconcat + #'number-to-string + (mime-product-version mime-user-interface-product) + ".") + " (" + (mime-product-code-name mime-user-interface-product) + ") " + (mime-product-name mime-library-product) "/" + (mapconcat + #'number-to-string + (mime-product-version mime-library-product) + ".") + " (" + (mime-product-code-name mime-library-product) + ") " (apel-version))))) + (mapconcat 'identity (delq nil (list gnus-v mime-v emacs-v)) " ")))) ;; gnus-vers.el ends here diff --git a/lisp/gnus.el b/lisp/gnus.el index 2e84730..c9ce009 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -1,7 +1,7 @@ ;;; gnus.el --- a newsreader for GNU Emacs ;; Copyright (C) 1987, 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, -;; 1998, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +;; 1998, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. ;; Author: Masanobu UMEDA ;; Lars Magne Ingebrigtsen @@ -2429,27 +2429,51 @@ This should be an alist for Emacs, or a plist for XEmacs." (symbol :tag "Parameter") (sexp :tag "Value"))))) -(defcustom gnus-user-agent 'gnus-mime-edit +(defcustom gnus-user-agent '(emacs gnus mime config mule) "Which information should be exposed in the User-Agent header. -It can be one of the symbols `gnus' \(show only Gnus version\), `emacs-gnus' -\(show only Emacs and Gnus versions\), `emacs-gnus-config' \(same as -`emacs-gnus' plus system configuration\), `emacs-gnus-type' \(same as -`emacs-gnus' plus system type\), `gnus-mime-edit' \(show Gnus version and -MIME Edit User-Agent\) or a custom string. If you set it to a string, -be sure to use a valid format, see RFC 2616." +Can be a list of symbols or a string. Valid symbols are `gnus' (show +Gnus version), `emacs' (show Emacs version) and `mime' (show SEMI, +FLIM and APEL versions). In addition to the Emacs version, you can +add `codename' (show (S)XEmacs codename), `mule' (show Mule version +and also Meadow version if it exists) or either `config' (show system +configuration) or `type' (show system type). If you set it to a +string, be sure to use a valid format, see RFC 2616." + :version "21.4" :group 'gnus-message - :type '(choice - (item :tag "Show Gnus version and MIME Edit User-Agent" - gnus-mime-edit) - (item :tag "Show Gnus and Emacs versions and system type" - emacs-gnus-type) - (item :tag "Show Gnus and Emacs versions and system configuration" - emacs-gnus-config) - (item :tag "Show Gnus and Emacs versions" emacs-gnus) - (item :tag "Show only Gnus version" gnus) - (string :tag "Other"))) + :type '(choice (list (set :format "%v" :inline t + (const gnus :tag "Gnus version") + (const emacs :tag "Emacs version") + (choice :tag "system" + (const type :tag "system type") + (const config :tag "system configuration")) + (const codename :tag "Emacs codename") + (const mime :tag "SEMI and FLIM versions") + (const mule + :tag "Mule version (and Meadow version)"))) + (string :format "%t:\n%v"))) + +;; Convert old (< 2005-01-10) symbol type values: +(when (symbolp gnus-user-agent) + (setq gnus-user-agent + (cond ((eq gnus-user-agent 'gnus-mime-edit) + '(emacs gnus mime config mule)) + ((eq gnus-user-agent 'emacs-gnus-config) + '(emacs gnus config)) + ((eq gnus-user-agent 'emacs-gnus-type) + '(emacs gnus type)) + ((eq gnus-user-agent 'emacs-gnus) + '(emacs gnus)) + ((eq gnus-user-agent 'gnus) + '(gnus)) + (t gnus-user-agent))) + (gnus-message 1 "Converted `gnus-user-agent' to `%s'." gnus-user-agent) + (sit-for 1) + (if (get 'gnus-user-agent 'saved-value) + (customize-save-variable 'gnus-user-agent gnus-user-agent) + (gnus-message 1 "Edit your init file to make this change permanent.") + (sit-for 2))) ;;; Internal variables -- 1.7.10.4