* [PATCH] SXEmacs User-Agent string @ 2005-01-06 1:49 Steve Youngs 2005-01-06 13:41 ` Using versions instead of XEmacs codenames in User-Agent (was: [PATCH] SXEmacs User-Agent string) Reiner Steib 0 siblings, 1 reply; 13+ messages in thread From: Steve Youngs @ 2005-01-06 1:49 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 1794 bytes --] Does anybody have any objections to me committing this? I'll wait a couple of days before committing, just in case. Gnus patch: ChangeLog files diff command: cvs -q diff -U 0 Files affected: lisp/ChangeLog Source files diff command: cvs -q diff -uN Files affected: lisp/gnus-util.el Index: lisp/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v retrieving revision 7.587 diff -u -U0 -r7.587 ChangeLog --- lisp/ChangeLog 3 Jan 2005 16:05:14 -0000 7.587 +++ lisp/ChangeLog 6 Jan 2005 01:45:42 -0000 @@ -0,0 +1,4 @@ +2005-01-06 Steve Youngs <steve@youngs.au.com> + + * gnus-util.el (gnus-emacs-version): Add matching for SXEmacs. + Index: lisp/gnus-util.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-util.el,v retrieving revision 7.23 diff -u -u -r7.23 gnus-util.el --- lisp/gnus-util.el 17 Dec 2004 10:27:43 -0000 7.23 +++ lisp/gnus-util.el 6 Jan 2005 01:45:36 -0000 @@ -1498,6 +1498,16 @@ (if system-v (concat " (" system-v ")") ""))) + ((string-match "sxemacs--" emacs-version) + (concat "SXEmacs" + (format "/%d.%d" emacs-major-version emacs-minor-version) + (if (boundp 'sxemacs-codename) + (concat + " (" sxemacs-codename + (if system-v + (concat ", " system-v ")") + ")")) + ""))) ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?" emacs-version) -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| [-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Using versions instead of XEmacs codenames in User-Agent (was: [PATCH] SXEmacs User-Agent string) 2005-01-06 1:49 [PATCH] SXEmacs User-Agent string Steve Youngs @ 2005-01-06 13:41 ` Reiner Steib 2005-01-06 23:00 ` Using versions instead of XEmacs codenames in User-Agent Katsumi Yamaoka 2005-01-06 23:29 ` Steve Youngs 0 siblings, 2 replies; 13+ messages in thread From: Reiner Steib @ 2005-01-06 13:41 UTC (permalink / raw) On Thu, Jan 06 2005, Steve Youngs wrote: [ SXEmacs User-Agent string ] > Does anybody have any objections to me committing this? I'll wait a > couple of days before committing, just in case. [ No objection from my side, just a closely related suggestion. ] The XEmacs codenames (Rational FORTRAN, Corporate Culture, Security Through Obscurity, ...) lead to very long User-Agent headers, that even are folded by Gnus: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through Obscurity, berkeley-unix) User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Corporate Culture, berkeley-unix) User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Rational FORTRAN, windows-nt) I would propose to get rid of the codenames and use the full version, say 21.4.15 or 21.4.16 instead. Beside better readability, the full version is better for people who are not familiar with the codenames. I have a patch around for this around (but not here, being offline). The result would look like this: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4.aa (berkeley-unix) User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4.bb (berkeley-unix) User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4.cc (windows-nt) (I use the placeholders "aa", "bb", "cc" because I can't recall to which XEmacs versions the codenames correspond.) Unless there are objections against my suggestion, I'll install it in the stable branch and in the trunk. Steve, I'd like to ask you to wait for my patch and then also use full version numbers instead of codenames for SXEmacs. Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-06 13:41 ` Using versions instead of XEmacs codenames in User-Agent (was: [PATCH] SXEmacs User-Agent string) Reiner Steib @ 2005-01-06 23:00 ` Katsumi Yamaoka 2005-01-06 23:29 ` Steve Youngs 1 sibling, 0 replies; 13+ messages in thread From: Katsumi Yamaoka @ 2005-01-06 23:00 UTC (permalink / raw) >>>>> In <v9pt0iptcv.fsf@marauder.physik.uni-ulm.de> Reiner Steib wrote: > On Thu, Jan 06 2005, Steve Youngs wrote: > [ SXEmacs User-Agent string ] >> Does anybody have any objections to me committing this? I'll wait a >> couple of days before committing, just in case. > [ No objection from my side, just a closely related suggestion. ] So am I. > The XEmacs codenames (Rational FORTRAN, Corporate Culture, Security > Through Obscurity, ...) lead to very long User-Agent headers, that > even are folded by Gnus: > User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through > Obscurity, berkeley-unix) > User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Corporate Culture, > berkeley-unix) > User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Rational FORTRAN, > windows-nt) > I would propose to get rid of the codenames and use the full version, > say 21.4.15 or 21.4.16 instead. Beside better readability, the full > version is better for people who are not familiar with the codenames. I completely agree to specify the full version. I also agree to hide those codenames because I don't like the OXYMORON series personally. However, if they are cute, graceful, impartial, loving and peaceful, it is too good to be thrown away. There might not be such ones, though. Anyway, no one will oppose it if it can be customized, I think. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-06 13:41 ` Using versions instead of XEmacs codenames in User-Agent (was: [PATCH] SXEmacs User-Agent string) Reiner Steib 2005-01-06 23:00 ` Using versions instead of XEmacs codenames in User-Agent Katsumi Yamaoka @ 2005-01-06 23:29 ` Steve Youngs 2005-01-08 18:09 ` Reiner Steib 1 sibling, 1 reply; 13+ messages in thread From: Steve Youngs @ 2005-01-06 23:29 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 1011 bytes --] * Reiner Steib <reinersteib+gmane@imap.cc> writes: > On Thu, Jan 06 2005, Steve Youngs wrote: > [ SXEmacs User-Agent string ] >> Does anybody have any objections to me committing this? I'll wait a >> couple of days before committing, just in case. > [ No objection from my side, just a closely related suggestion. ] Cool. [ Dropping codenames, use full version numbers in User-Agent ] > Unless there are objections against my suggestion, I'll install it in > the stable branch and in the trunk. Steve, I'd like to ask you to > wait for my patch and then also use full version numbers instead of > codenames for SXEmacs. Will do. But, as Katsumi suggested, perhaps make inclusion of the codename customisable. -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| [-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-06 23:29 ` Steve Youngs @ 2005-01-08 18:09 ` Reiner Steib 2005-01-09 1:28 ` Steve Youngs 0 siblings, 1 reply; 13+ messages in thread From: Reiner Steib @ 2005-01-08 18:09 UTC (permalink / raw) On Fri, Jan 07 2005, Steve Youngs wrote: > * Reiner Steib <reinersteib+gmane@imap.cc> writes: > [ Dropping codenames, use full version numbers in User-Agent ] > > > Unless there are objections against my suggestion, I'll install it in > > the stable branch and in the trunk. Steve, I'd like to ask you to > > wait for my patch and then also use full version numbers instead of > > codenames for SXEmacs. > > Will do. But, as Katsumi suggested, perhaps make inclusion > of the codename customisable. I'm not sure how this options should be merged into the current choices of `gnus-user-agent'. Additionally, I don't have an XEmacs for testing before Monday. Here is a preliminary version of my patch in case someone want to work on it now: --8<---------------cut here---------------start------------->8--- --- gnus-util.el 17 Dec 2004 10:27:52 -0000 6.104.2.6 +++ gnus-util.el 6 Jan 2005 13:50:57 -0000 @@ -1530,17 +1530,22 @@ 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 ")") - ")")) - ""))) + (if (boundp 'emacs-program-version) + (concat (format "/%s" emacs-program-version) + (if system-v + (concat " (" system-v ")") + "")) + (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)))) --8<---------------cut here---------------end--------------->8--- Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-08 18:09 ` Reiner Steib @ 2005-01-09 1:28 ` Steve Youngs 2005-01-09 20:55 ` Reiner Steib 0 siblings, 1 reply; 13+ messages in thread From: Steve Youngs @ 2005-01-09 1:28 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 4342 bytes --] * Reiner Steib <reinersteib+gmane@imap.cc> writes: > On Fri, Jan 07 2005, Steve Youngs wrote: >> Will do. But, as Katsumi suggested, perhaps make inclusion >> of the codename customisable. > I'm not sure how this options should be merged into the current > choices of `gnus-user-agent'. Additionally, I don't have an XEmacs > for testing before Monday. Here is a preliminary version of my patch > in case someone want to work on it now: [ Reiner's patch ] And here is my version of the same. It: - Adds support for SXEmacs - Allows optional exclusion of (S)XEmacs codenames (defaults to including the codename to keep with old behaviour) - Uses full version numbers, ie major.minor.patch The default settings should give a User-Agent header similar to the one in this message's headers. Reiner, I'll wait to see if you (or anyone else) have any comments regarding this patch before I commit it. Index: lisp/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v retrieving revision 7.589 diff -u -U0 -r7.589 ChangeLog --- lisp/ChangeLog 7 Jan 2005 06:17:11 -0000 7.589 +++ lisp/ChangeLog 9 Jan 2005 01:09:15 -0000 @@ -0,0 +1,11 @@ +2005-01-09 Steve Youngs <steve@sxemacs.org> + + * gnus.el (gnus-user-agent-display-codename): New. When non-nil + and a (S)XEmacs codename exists, display it in the User-Agent + header. + + * gnus-util.el (gnus-emacs-version): Add matching for SXEmacs. + Display full version number, ie major.minor.patch for (S)XEmacs. + Optionally display (S)XEmacs codename. + + Index: lisp/gnus-util.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-util.el,v retrieving revision 7.23 diff -u -u -r7.23 gnus-util.el --- lisp/gnus-util.el 17 Dec 2004 10:27:43 -0000 7.23 +++ lisp/gnus-util.el 9 Jan 2005 01:09:08 -0000 @@ -1479,7 +1479,10 @@ (nconc (nreverse res) list1 list2)))) (eval-when-compile - (defvar xemacs-codename)) + (defvar xemacs-codename) + (defvar sxemacs-codename) + (defvar running-xemacs) + (defvar running-sxemacs)) (defun gnus-emacs-version () "Stringified Emacs version." @@ -1498,22 +1501,22 @@ (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 ")") - ")")) - ""))) + (running-sxemacs + (concat "SXEmacs/" + emacs-program-version + (when (and gnus-user-agent-display-codename + sxemacs-codename) + (concat " \"" sxemacs-codename "\"")) + (when system-v + (concat " (" system-v ")")))) + (running-xemacs + (concat "XEmacs/" + emacs-program-version + (when (and gnus-user-agent-display-codename + xemacs-codename) + (concat " \"" xemacs-codename "\"")) + (when system-v + (concat " (" system-v ")")))) (t emacs-version)))) (defun gnus-rename-file (old-path new-path &optional trim) Index: lisp/gnus.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus.el,v retrieving revision 7.31 diff -u -u -r7.31 gnus.el --- lisp/gnus.el 2 Nov 2004 02:54:23 -0000 7.31 +++ lisp/gnus.el 9 Jan 2005 01:09:09 -0000 @@ -2410,6 +2410,12 @@ (item :tag "Show only Gnus version" gnus) (string :tag "Other"))) +(defcustom gnus-user-agent-display-codename t + "If non-nil display the (S)XEmacs codename in the User-Agent header." + :version "21.4" + :group 'gnus-message + :type 'boolean) + \f ;;; Internal variables -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| [-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-09 1:28 ` Steve Youngs @ 2005-01-09 20:55 ` Reiner Steib 2005-01-09 23:09 ` Steve Youngs 0 siblings, 1 reply; 13+ messages in thread From: Reiner Steib @ 2005-01-09 20:55 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 2041 bytes --] On Sun, Jan 09 2005, Steve Youngs wrote: > The default settings should give a User-Agent header similar to the > one in this message's headers. | User-Agent: Gnus/5.110003 (No Gnus v0.3) SXEmacs/22.1.1 "Aston Martin" (linux) Is a quoted string like "Aston Martin" allowed in RFC 2616? Upto now, we had it inside the bracket: | [...] XEmacs/21.4 (Security Through Obscurity, berkeley-unix) [...] > + * gnus.el (gnus-user-agent-display-codename): New. When non-nil > + and a (S)XEmacs codename exists, display it in the User-Agent > + header. I'd prefer not to introduce another variable. We already have `gnus-user-agent' for this. It is confusing to have several variables for the same thing. How about making `gnus-user-agent' a list? ,----[ C-h v gnus-user-agent RET ] | gnus-user-agent's value is (gnus emacs type) | | Which information should be exposed in the User-Agent header. | | Can be a list of symbols or a string. Valid symbols are `gnus' | (show Gnus version) and `emacs' (show Emacs version). In | addition to the Emacs version, you can add `codename' (show | (S)XEmacs codename) 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. `---- With a customize buffer like for the list: ,---- | [X] gnus | [X] emacs | [X] system: Value Menu type | [ ] codename `---- Changes: * 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. See the attached patch for details. > (eval-when-compile > - (defvar xemacs-codename)) > + (defvar xemacs-codename) > + (defvar sxemacs-codename) > + (defvar running-xemacs) > + (defvar running-sxemacs)) Is there any benefit of using `running-[s]xemacs' instead of (featurep '[s]xemacs)? Bye, Reiner. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: gnus-user-agent: list --] [-- Type: text/x-patch, Size: 7162 bytes --] Index: gnus-msg.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v retrieving revision 7.28 diff -u -r7.28 gnus-msg.el --- gnus-msg.el 7 Nov 2004 23:56:10 -0000 7.28 +++ gnus-msg.el 9 Jan 2005 20:33:32 -0000 @@ -1,6 +1,6 @@ ;;; gnus-msg.el --- mail and post interface for Gnus -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -;; Free Software Foundation, Inc. +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +;; 2005 Free Software Foundation, Inc. ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> ;; Lars Magne Ingebrigtsen <larsi@gnus.org> @@ -1039,17 +1039,18 @@ "Stringified Gnus version and Emacs version. See the variable `gnus-user-agent'." (interactive) - (let* ((float-output-format nil) - (gnus-v - (concat "Gnus/" - (prin1-to-string (gnus-continuum-version gnus-version) t) - " (" gnus-version ")")) - (emacs-v (gnus-emacs-version))) - (if (stringp gnus-user-agent) - gnus-user-agent - (concat gnus-v - (when emacs-v - (concat " " emacs-v)))))) + (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/" + (prin1-to-string (gnus-continuum-version gnus-version) t) + " (" gnus-version ")"))) + (emacs-v (gnus-emacs-version))) + (concat gnus-v (when (and gnus-v emacs-v) " ") + emacs-v)))) \f ;;; Index: gnus-util.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-util.el,v retrieving revision 7.23 diff -u -r7.23 gnus-util.el --- gnus-util.el 17 Dec 2004 10:27:43 -0000 7.23 +++ gnus-util.el 9 Jan 2005 20:33:33 -0000 @@ -1,5 +1,5 @@ ;;; gnus-util.el --- utility functions for 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 <larsi@gnus.org> @@ -1479,41 +1479,48 @@ (nconc (nreverse res) list1 list2)))) (eval-when-compile - (defvar xemacs-codename)) + (defvar xemacs-codename) + (defvar sxemacs-codename) + (defvar emacs-program-version)) (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))) + 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 ")") + ((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) ")")) - ""))) (t emacs-version)))) (defun gnus-rename-file (old-path new-path &optional trim) Index: gnus.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus.el,v retrieving revision 7.31 diff -u -r7.31 gnus.el --- gnus.el 2 Nov 2004 02:54:23 -0000 7.31 +++ gnus.el 9 Jan 2005 20:33:33 -0000 @@ -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 <umerin@flab.flab.fujitsu.junet> ;; Lars Magne Ingebrigtsen <larsi@gnus.org> @@ -2391,24 +2391,44 @@ (symbol :tag "Parameter") (sexp :tag "Value"))))) -(defcustom gnus-user-agent 'emacs-gnus-type +(defcustom gnus-user-agent '(emacs gnus type) "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\) 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\) and `emacs' \(show Emacs version\). In +addition to the Emacs version, you can add `codename' \(show +\(S\)XEmacs codename\) 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 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 :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"))) + (string))) +;; Convert old (< 2005-01-09) symbol type values: +(when (symbolp gnus-user-agent) + (when (get 'gnus-user-agent 'saved-value) + ;; User has changed `gnus-user-agent' thru customize. + (gnus-message 1 "Please customize `gnus-user-agent' again.") + (sit-for 1)) + (setq gnus-user-agent + (cond ((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)))) + + \f ;;; Internal variables [-- Attachment #3: Type: text/plain, Size: 100 bytes --] -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-09 20:55 ` Reiner Steib @ 2005-01-09 23:09 ` Steve Youngs 2005-01-10 8:42 ` Bjørn Mork 2005-01-10 15:07 ` Reiner Steib 0 siblings, 2 replies; 13+ messages in thread From: Steve Youngs @ 2005-01-09 23:09 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 5356 bytes --] * Reiner Steib <reinersteib+gmane@imap.cc> writes: > On Sun, Jan 09 2005, Steve Youngs wrote: >> The default settings should give a User-Agent header similar to the >> one in this message's headers. > | User-Agent: Gnus/5.110003 (No Gnus v0.3) SXEmacs/22.1.1 "Aston Martin" (linux) > Is a quoted string like "Aston Martin" allowed in RFC 2616? ,----[ from RFC 2616 ] | 14.43 User-Agent | | The User-Agent request-header field contains information about the | user agent originating the request. This is for statistical purposes, | the tracing of protocol violations, and automated recognition of user | agents for the sake of tailoring responses to avoid particular user | agent limitations. User agents SHOULD include this field with | requests. The field can contain multiple product tokens (section 3.8) | and comments identifying the agent and any subproducts which form a | significant part of the user agent. By convention, the product tokens | are listed in order of their significance for identifying the | application. | | User-Agent = "User-Agent" ":" 1*( product | comment ) | | Example: | | User-Agent: CERN-LineMode/2.15 libwww/2.17b3 | | 3.8 Product Tokens | | Product tokens are used to allow communicating applications to | identify themselves by software name and version. Most fields using | product tokens also allow sub-products which form a significant part | of the application to be listed, separated by white space. By | convention, the products are listed in order of their significance | for identifying the application. | | product = token ["/" product-version] | product-version = token | | Examples: | | User-Agent: CERN-LineMode/2.15 libwww/2.17b3 | Server: Apache/0.8.4 | | Product tokens SHOULD be short and to the point. They MUST NOT be | used for advertising or other non-essential information. Although any | token character MAY appear in a product-version, this token SHOULD | only be used for a version identifier (i.e., successive versions of | the same product SHOULD only differ in the product-version portion of | the product value). `---- Going by that, using quoted text "like this" should be fine. > Upto now, we had it inside the bracket: > | [...] XEmacs/21.4 (Security Through Obscurity, berkeley-unix) Yep, however, IMHO, this... SXEmacs/22.1.1 (Aston Martin, berkeley-unix) doesn't look anywhere near as nice as... SXEmacs/22.1.1 "Aston Martin" (berkeley-unix) :-) > [...] >> + * gnus.el (gnus-user-agent-display-codename): New. When non-nil >> + and a (S)XEmacs codename exists, display it in the User-Agent >> + header. > I'd prefer not to introduce another variable. We already have > `gnus-user-agent' for this. It is confusing to have several variables > for the same thing. How about making `gnus-user-agent' a list? > ,----[ C-h v gnus-user-agent RET ] > | gnus-user-agent's value is (gnus emacs type) [...] > With a customize buffer like for the list: > ,---- > | [X] gnus > | [X] emacs > | [X] system: Value Menu type > | [ ] codename > `---- Cool. Can we make the default on (S)XEmacs to include the codename? Just to keep as close as possible to current settings. ,---- | (defcustom gnus-user-agent (if (featurep '(or sxemacs xemacs)) | '(emacs gnus type codename) | '(emacs gnus type)) | "Which information should be exposed in the User-Agent header. | | Can be a list of symbols or a string. Valid symbols are `gnus' | \(show Gnus version\) and `emacs' \(show Emacs version\). In | addition to the Emacs version, you can add `codename' \(show | \(S\)XEmacs codename\) 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 (list (set :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"))) | (string))) `---- > Is there any benefit of using `running-[s]xemacs' instead of (featurep > '[s]xemacs)? Not really. Four less keystrokes :-) > + ((or (featurep 'sxemacs) (featurep 'xemacs)) You could write this as: ((featurep '(or sxemacs xemacs)) But I'm not sure how GNU/Emacs would cope with that. In this instance it probably shouldn't matter because GNU/Emacs wouldn't get to this part of the code. > -(defcustom gnus-user-agent 'emacs-gnus-type > +(defcustom gnus-user-agent '(emacs gnus type) I'd prefer my suggestion above (defaulting to including codename for (S)XEmacs). Other than that, I think your patch is great! And works well. -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| [-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-09 23:09 ` Steve Youngs @ 2005-01-10 8:42 ` Bjørn Mork 2005-01-10 9:20 ` Steve Youngs 2005-01-10 15:07 ` Reiner Steib 1 sibling, 1 reply; 13+ messages in thread From: Bjørn Mork @ 2005-01-10 8:42 UTC (permalink / raw) Steve Youngs <steve@youngs.au.com> writes: > * Reiner Steib <reinersteib+gmane@imap.cc> writes: > > > On Sun, Jan 09 2005, Steve Youngs wrote: > >> The default settings should give a User-Agent header similar to the > >> one in this message's headers. > > > | User-Agent: Gnus/5.110003 (No Gnus v0.3) SXEmacs/22.1.1 "Aston Martin" (linux) > > > Is a quoted string like "Aston Martin" allowed in RFC 2616? > > ,----[ from RFC 2616 ] > | 14.43 User-Agent > | > | The User-Agent request-header field contains information about the > | user agent originating the request. This is for statistical purposes, > | the tracing of protocol violations, and automated recognition of user > | agents for the sake of tailoring responses to avoid particular user > | agent limitations. User agents SHOULD include this field with > | requests. The field can contain multiple product tokens (section 3.8) > | and comments identifying the agent and any subproducts which form a > | significant part of the user agent. By convention, the product tokens > | are listed in order of their significance for identifying the > | application. > | > | User-Agent = "User-Agent" ":" 1*( product | comment ) > | > | Example: > | > | User-Agent: CERN-LineMode/2.15 libwww/2.17b3 > | > | 3.8 Product Tokens > | > | Product tokens are used to allow communicating applications to > | identify themselves by software name and version. Most fields using > | product tokens also allow sub-products which form a significant part > | of the application to be listed, separated by white space. By > | convention, the products are listed in order of their significance > | for identifying the application. > | > | product = token ["/" product-version] > | product-version = token > | > | Examples: > | > | User-Agent: CERN-LineMode/2.15 libwww/2.17b3 > | Server: Apache/0.8.4 > | > | Product tokens SHOULD be short and to the point. They MUST NOT be > | used for advertising or other non-essential information. Although any > | token character MAY appear in a product-version, this token SHOULD > | only be used for a version identifier (i.e., successive versions of > | the same product SHOULD only differ in the product-version portion of > | the product value). > `---- > > Going by that, using quoted text "like this" should be fine. No, it isn't. quoting more from RFC 2616: token = 1*<any CHAR except CTLs or separators> separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT > > Upto now, we had it inside the bracket: > > | [...] XEmacs/21.4 (Security Through Obscurity, berkeley-unix) > > Yep, however, IMHO, this... > > SXEmacs/22.1.1 (Aston Martin, berkeley-unix) > > doesn't look anywhere near as nice as... > > SXEmacs/22.1.1 "Aston Martin" (berkeley-unix) Maybe. But it doesn't really matter since the first version uses a perfectly legal comment while the second is an invalid User-Agent field. Bjørn -- Save the Honeywell dps8s! ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-10 8:42 ` Bjørn Mork @ 2005-01-10 9:20 ` Steve Youngs 2005-01-10 10:39 ` Bjørn Mork 0 siblings, 1 reply; 13+ messages in thread From: Steve Youngs @ 2005-01-10 9:20 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 2089 bytes --] * Bjørn Mork <bmork@dod.no> writes: > Steve Youngs <steve@youngs.au.com> writes: >> * Reiner Steib <reinersteib+gmane@imap.cc> writes: >> >> > On Sun, Jan 09 2005, Steve Youngs wrote: >> >> The default settings should give a User-Agent header similar to the >> >> one in this message's headers. >> >> > | User-Agent: Gnus/5.110003 (No Gnus v0.3) SXEmacs/22.1.1 "Aston Martin" (linux) >> >> > Is a quoted string like "Aston Martin" allowed in RFC 2616? >> >> ,----[ from RFC 2616 ] [...] >> Going by that, using quoted text "like this" should be fine. > No, it isn't. quoting more from RFC 2616: > token = 1*<any CHAR except CTLs or separators> > separators = "(" | ")" | "<" | ">" | "@" > | "," | ";" | ":" | "\" | <"> > | "/" | "[" | "]" | "?" | "=" > | "{" | "}" | SP | HT >> > Upto now, we had it inside the bracket: >> > | [...] XEmacs/21.4 (Security Through Obscurity, berkeley-unix) >> >> Yep, however, IMHO, this... >> >> SXEmacs/22.1.1 (Aston Martin, berkeley-unix) >> >> doesn't look anywhere near as nice as... >> >> SXEmacs/22.1.1 "Aston Martin" (berkeley-unix) > Maybe. But it doesn't really matter since the first version uses a > perfectly legal comment while the second is an invalid User-Agent > field. OK, now I'm really confused. Because going by what you quoted about tokens and separators, aren't both of them invalid? And if not, why not? Also, what the hell does RFC 2616 - "Hypertext Transfer Protocol -- HTTP/1.1" have to do with email headers? I honestly don't understand that at all? BTW, I really don't mind whether we use `"codename" (platform)' or `(codename, platform)'. -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| [-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-10 9:20 ` Steve Youngs @ 2005-01-10 10:39 ` Bjørn Mork 0 siblings, 0 replies; 13+ messages in thread From: Bjørn Mork @ 2005-01-10 10:39 UTC (permalink / raw) Steve Youngs <steve@youngs.au.com> writes: > * Bjørn Mork <bmork@dod.no> writes: > > Steve Youngs <steve@youngs.au.com> writes: > >> > >> Yep, however, IMHO, this... > >> > >> SXEmacs/22.1.1 (Aston Martin, berkeley-unix) > >> > >> doesn't look anywhere near as nice as... > >> > >> SXEmacs/22.1.1 "Aston Martin" (berkeley-unix) > > > Maybe. But it doesn't really matter since the first version uses a > > perfectly legal comment while the second is an invalid User-Agent > > field. > > OK, now I'm really confused. Because going by what you quoted about > tokens and separators, aren't both of them invalid? And if not, why > not? Oh, I left that as an exercise :-) More from RFC 2616: <quote> 14.43 User-Agent The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests. The field can contain multiple product tokens (section 3.8) and comments identifying the agent and any subproducts which form a significant part of the user agent. By convention, the product tokens are listed in order of their significance for identifying the application. User-Agent = "User-Agent" ":" 1*( product | comment ) Example: User-Agent: CERN-LineMode/2.15 libwww/2.17b3 </quote> and <quote> Comments can be included in some HTTP header fields by surrounding the comment text with parentheses. Comments are only allowed in fields containing "comment" as part of their field value definition. In all other fields, parentheses are considered part of the field value. comment = "(" *( ctext | quoted-pair | comment ) ")" ctext = <any TEXT excluding "(" and ")"> </quote> > Also, what the hell does RFC 2616 - "Hypertext Transfer Protocol -- > HTTP/1.1" have to do with email headers? I honestly don't understand > that at all? No, that's not very clear. I assume it's because that's the RFC where the User-Agent field is currently specified. RFC 2822 gives these generic rules for optional header fields: <quote> 3.6.8. Optional fields Fields may appear in messages that are otherwise unspecified in this standard. They MUST conform to the syntax of an optional-field. This is a field name, made up of the printable US-ASCII characters except SP and colon, followed by a colon, followed by any text which conforms to unstructured. The field names of any optional-field MUST NOT be identical to any field name specified elsewhere in this standard. optional-field = field-name ":" unstructured CRLF field-name = 1*ftext ftext = %d33-57 / ; Any character except %d59-126 ; controls, SP, and ; ":". For the purposes of this standard, any optional field is uninterpreted. </quote> which allows any syntax. However, when it comes to mail and Usenet user agents the current USEFOR draft is probably a better reference than both RFC 2822 and RFC 2616: http://www.ietf.org/internet-drafts/draft-ietf-usefor-usefor-02.txt Luckily, it seems to mostly agree with RFC 2616: <quote> 3.2.12 User-Agent The User-Agent header contains information about the user agent (typically a newsreader) generating the article, for statistical purposes and tracing of standards violations to specific software needing correction. It is intended that this header be suitable for use in Email. user-agent = "User-Agent:" SP 1*product CRLF product = [CFWS] token [CFWS] [ "/" product-version ] product-version = [CFWS] token [CFWS] This header MAY contain multiple product-tokens identifying the agent and any subproducts which form a significant part of the posting agent, listed in order of their significance for identifying the application. NOTE: This header supersedes the role performed redundantly by experimental headers such as X-Newsreader, X-Mailer, X-Posting-Agent, X-Http-User-Agent, and other headers previously used on Usenet and in Email for this purpose. Use of these experimental headers SHOULD be discontinued in favor of the single, standard User-Agent header. NOTE: [RFC2616] describes a similar facility for the HTTP protocol. This specification differs in that "{" and "}" are allowed in tokens (<product> and <product-version>) and comments are permitted wherever whitespace is allowed. </quote> IMHO, it's best using a syntax that conforms to USEFOR, RFC 2616 and RFC 2822 unless there are good reasons not to do so. That means sticking with the RFC 2616 definition even for mail and news user agents. But that's only an opionion. Bjørn -- Ignoramus! ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-09 23:09 ` Steve Youngs 2005-01-10 8:42 ` Bjørn Mork @ 2005-01-10 15:07 ` Reiner Steib 2005-01-10 23:29 ` Steve Youngs 1 sibling, 1 reply; 13+ messages in thread From: Reiner Steib @ 2005-01-10 15:07 UTC (permalink / raw) On Mon, Jan 10 2005, Steve Youngs wrote: > > Is a quoted string like "Aston Martin" allowed in RFC 2616? [...] > Yep, however, IMHO, this... > > SXEmacs/22.1.1 (Aston Martin, berkeley-unix) > > doesn't look anywhere near as nice as... > > SXEmacs/22.1.1 "Aston Martin" (berkeley-unix) > > :-) I think we should use the former variant unless there are good reasons not to do so, as Bjørn already pointed out. [...] > Cool. Can we make the default on (S)XEmacs to include the codename? > Just to keep as close as possible to current settings. My intention was to _change_ the default settings. ;-) See the subject of this thread. Maybe that wasn't clear enough in my previous articles. The default User-Agent header line should be no more than 80 chars, IMO. I have committed the default w/o codename to the trunk. If you or anyone strongly wants to include the codename by default, feel free to change it. :-) > > + ((or (featurep 'sxemacs) (featurep 'xemacs)) > You could write this as: > ((featurep '(or sxemacs xemacs)) > > But I'm not sure how GNU/Emacs would cope with that. Emacs would signal an error. > In this instance it probably shouldn't matter because GNU/Emacs > wouldn't get to this part of the code. Yes. But at least for me my suggestion is more clear. > Other than that, I think your patch is great! And works well. I have improved the conversion code to automatically convert customized values: --8<---------------cut here---------------start------------->8--- (defcustom gnus-user-agent '(emacs gnus type) ...) ;; Convert old (< 2005-01-10) symbol type values: (when (symbolp gnus-user-agent) (setq gnus-user-agent (cond ((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))) --8<---------------cut here---------------end--------------->8--- But if the user loads first gnus.elc and then does (setq gnus-user-agent 'emacs-gnus) it will fail. Ideas? But I doubt that many people have done this. `gnus-user-agent' is quite new and most people use the default value, AFAICS. Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Using versions instead of XEmacs codenames in User-Agent 2005-01-10 15:07 ` Reiner Steib @ 2005-01-10 23:29 ` Steve Youngs 0 siblings, 0 replies; 13+ messages in thread From: Steve Youngs @ 2005-01-10 23:29 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 1090 bytes --] * Reiner Steib <reinersteib+gmane@imap.cc> writes: > I have committed the default w/o codename to the trunk. If you or > anyone strongly wants to include the codename by default, feel > free to change it. :-) I can live with your default. I'll think about changing it if I get sick of telling people how to customise it for themselves. :-) > I have improved the conversion code to automatically convert > customized values: [...] > But if the user loads first gnus.elc and then does > (setq gnus-user-agent 'emacs-gnus) > it will fail. Ideas? The only thing I can think of is to run this off a hook somewhere. Maybe with `add-one-shot-hook'? > But I doubt that many people have done this. `gnus-user-agent' is > quite new and most people use the default value, AFAICS. Agree. -- |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---| | Te audire no possum. | | Musa sapientum fixa est in aure. | |----------------------------------<steve@youngs.au.com>---| [-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2005-01-10 23:29 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-01-06 1:49 [PATCH] SXEmacs User-Agent string Steve Youngs 2005-01-06 13:41 ` Using versions instead of XEmacs codenames in User-Agent (was: [PATCH] SXEmacs User-Agent string) Reiner Steib 2005-01-06 23:00 ` Using versions instead of XEmacs codenames in User-Agent Katsumi Yamaoka 2005-01-06 23:29 ` Steve Youngs 2005-01-08 18:09 ` Reiner Steib 2005-01-09 1:28 ` Steve Youngs 2005-01-09 20:55 ` Reiner Steib 2005-01-09 23:09 ` Steve Youngs 2005-01-10 8:42 ` Bjørn Mork 2005-01-10 9:20 ` Steve Youngs 2005-01-10 10:39 ` Bjørn Mork 2005-01-10 15:07 ` Reiner Steib 2005-01-10 23:29 ` Steve Youngs
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).