From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/66353 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: assoc-string Date: Mon, 25 Feb 2008 18:27:30 +0900 Organization: Emacsen advocacy group Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1203931687 27590 80.91.229.12 (25 Feb 2008 09:28:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Feb 2008 09:28:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: ding@gnus.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 25 10:28:32 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JTZdP-0005Cc-Cm for ged-emacs-devel@m.gmane.org; Mon, 25 Feb 2008 10:28:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTZct-0003ty-I1 for ged-emacs-devel@m.gmane.org; Mon, 25 Feb 2008 04:27:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JTZcm-0003tY-AH for emacs-devel@gnu.org; Mon, 25 Feb 2008 04:27:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JTZcl-0003tM-Jn for emacs-devel@gnu.org; Mon, 25 Feb 2008 04:27:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTZcl-0003tJ-Dh for emacs-devel@gnu.org; Mon, 25 Feb 2008 04:27:51 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JTZcl-0001Cr-26 for emacs-devel@gnu.org; Mon, 25 Feb 2008 04:27:51 -0500 Original-Received: from [66.225.201.151] (port=41260 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.68) (envelope-from ) id 1JTZcX-0001eD-Rl; Mon, 25 Feb 2008 03:27:38 -0600 X-Hashcash: 1:20:080225:ding@gnus.org::n9dRB7Iw/ESNItwf:000029Md X-Hashcash: 1:20:080225:emacs-devel@gnu.org::C1x3duGKJs+5ACIu:0000000000000000000000000000000000000000008sSO X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:ioZFX5jlMq+zItKTGWut0YUR+d4= X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:90371 gmane.emacs.gnus.general:66353 Archived-At: --=-=-= Hi, The new function `format-seconds' that time-date.el in the Gnus CVS trunk provides now uses the `assoc-string' function, which is not available in Emacs 21 and XEmacs. While compiling the end of the data in file gnus/lisp/time-date.el: ** The function `assoc-string' is not known to be defined. Wrote /tmp/.yamaoka/gnus/lisp/time-date.elc It is not really a problem because Gnus currently does not use `format-seconds', however someone might use it in the future somewhere in Gnus. What do you think we should do now? 1. Provide `time-date-assoc-string' in time-date.el in both the Emacs trunk and the Gnus trunk, and make `format-seconds' use it. The function definition of `time-date-assoc-string' is attached below. 2. Similar to 1. but do it in only the Gnus trunk. 3. Replace `assoc-string' with `gnus-assoc-string' in time-date.el when compiling Gnus. It does not need to modify time-date.el and I verified it can be done. However it seems to be risky. (It is to make dgnushack.el provide the `assoc-string' macro which uses `gnus-assoc-string' provided in gnus-util.el .) 4. Do nothing, but don't use `format-seconds' in Gnus from now on. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable Content-Description: time-date-assoc-string (eval-and-compile (cond ((fboundp 'assoc-string) ;; Emacs 22 or greater (defalias 'time-date-assoc-string 'assoc-string)) ((fboundp 'compare-strings) ;; Emacs 21 and XEmacs 21.5 (defun time-date-assoc-string (key list &optional case-fold) "Like `assoc' but specifically for strings (and symbols). Symbols are converted to strings, and unibyte strings are converted to multibyte for comparison. Case is ignored if optional arg case-fold is non-nil. As opposed to `assoc', it will also match an entry consisting of a single string rather than a cons cell whose car is a string." (when (symbolp key) (setq key (symbol-name key))) (let (elt thiscar) (while list (setq elt (pop list) thiscar (if (consp elt) (car elt) elt)) (when (symbolp thiscar) (setq thiscar (symbol-name thiscar))) (if (eq (compare-strings thiscar 0 nil key 0 nil case-fold) t) (setq list nil) (setq elt nil))) elt))) (t ;; XEmacs 21.4 (defun time-date-assoc-string (key list &optional case-fold) "Like `assoc' but specifically for strings (and symbols). Symbols are converted to strings for comparison. Case is ignored if optional arg case-fold is non-nil. As opposed to `assoc', it will also match an entry consisting of a single string rather than a cons cell whose car is a string." (if case-fold (setq key (downcase (if (symbolp key) (symbol-name key) key))) (when (symbolp key) (setq key (symbol-name key)))) (let (elt thiscar) (while list (setq elt (pop list) thiscar (if (consp elt) (car elt) elt)) (if case-fold (setq thiscar (downcase (if (symbolp thiscar) (symbol-name thiscar) thiscar))) (when (symbolp thiscar) (setq thiscar (symbol-name thiscar)))) (if (string-equal thiscar key) (setq list nil) (setq elt nil))) elt))))) --=-=-=--