From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de> Newsgroups: gmane.emacs.devel Subject: sort-coding-systems in 21.3 and RC branch (was: New function `emacs-version>=') Date: Mon, 05 May 2003 15:47:26 +0200 Organization: Dept. of Theoretical Physics, University of Ulm Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <67B8CED503F3D511BB9F0008C75DAD66054855C9@dewdfx17> <20030502224227.C2FC.LEKTU@terra.es> <200305022114.h42LE8PH022578@rum.cs.yale.edu> <200305031842.h43IgBDm025358@rum.cs.yale.edu> Reply-To: reiner.steib@gmx.de NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1052144232 24107 80.91.224.249 (5 May 2003 14:17:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 5 May 2003 14:17:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 05 16:17:03 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Cgfk-0005oC-00 for ; Mon, 05 May 2003 16:10:28 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19Cgim-0001SZ-00 for ; Mon, 05 May 2003 16:13:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19CggT-0006ss-08 for emacs-devel@quimby.gnus.org; Mon, 05 May 2003 10:11:13 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19CggH-0006o9-00 for emacs-devel@gnu.org; Mon, 05 May 2003 10:11:01 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Cgfk-0006UR-00 for emacs-devel@gnu.org; Mon, 05 May 2003 10:10:29 -0400 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Cgdx-00059b-00 for emacs-devel@gnu.org; Mon, 05 May 2003 10:08:37 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19CgQN-0004l0-00 for ; Mon, 05 May 2003 15:54:35 +0200 Mail-Followup-To: emacs-devel@gnu.org X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19CgLZ-0004Nh-00 for ; Mon, 05 May 2003 15:49:37 +0200 Original-Lines: 88 Original-X-Complaints-To: usenet@main.gmane.org X-Face: :6KQZ[nyoS_edmB.%gw-=)BYth^|2+Y+^cu%I$FSx!&>-'om>3H7A|M&n(V7fIo3P.; yo.b yq4$p;ZaBtkv)\}biaiBQe"mD}iib1AA@99-fZ7i*bLhNRVC&0Wkxg9)SH?oWc@{ Mail-Copies-To: nobody User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:450EzFDtURxR+TNJhb3+j9njwyE= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13691 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13691 On Sat, May 03 2003, Stefan Monnier wrote: >> Another example (BTW: Is this fixed in the RC branch?): I've checked it now. It isn't fixed in RC. Could someone please install this patch (see below) in the RC branch? It's the output of "diff -u -r1.216 -r1.217 mule-cmds.el" in HEAD. >> Gnus 5.9 bundled with Emacs 21.3 comes with a slightly broken version >> of the function `sort-coding-systems'.[...] > > Have you tried to test something like > > (eq 'mule-utf-16-be (car (sort-coding-systems '(mule-utf-8 > mule-utf-16-be)))) No, I haven't. Thanks for the hint. But your test is not sufficient: ,----[ b0rked `sort-coding-systems' ] | ELISP> (sort-coding-systems '(mule-utf-8 mule-utf-16-be)) | (mule-utf-8 mule-utf-16-be) | ELISP> emacs-version | "21.3.1" `---- `find-coding-systems-region' returns, e.g. (mule-utf-16-be mule-utf-16-le mule-utf-8 compound-text ...). And the b0rked (21.3.1) version of `sort-coding-systems' doesn't sort the list correctly: ,----[ b0rked `sort-coding-systems' ] | ELISP> (sort-coding-systems '(mule-utf-16-be mule-utf-16-le mule-utf-8)) | (mule-utf-16-be mule-utf-16-le mule-utf-8) `---- The fixed version (e.g. in HEAD) gives: ,----[ Fixed `sort-coding-systems' ] | ELISP> (sort-coding-systems '(mule-utf-16-be mule-utf-16-le mule-utf-8)) | (mule-utf-8 mule-utf-16-be mule-utf-16-le) `---- So using '(mule-utf-16-be mule-utf-16-le mule-utf-8) in your suggestion does the trick: (eq 'mule-utf-8 (car (sort-coding-systems '(mule-utf-16-be mule-utf-16-le mule-utf-8)))) (I don't know if mule-utf-16-le is necessary, at least it doesn't hurt.) Thanks for suggestion! Bye, Reiner. --8<---------------cut here---------------start------------->8--- --- mule-cmds.el 26 Dec 2002 17:27:20 -0000 1.216 +++ mule-cmds.el 3 Jan 2003 20:16:11 -0000 1.217 @@ -425,9 +425,18 @@ (let ((base (coding-system-base x))) (+ (if (eq base most-preferred) 64 0) (let ((mime (coding-system-get base 'mime-charset))) + ;; Prefer coding systems corresponding to a + ;; MIME charset. (if mime - (if (string-match "^x-" (symbol-name mime)) - 16 32) + ;; Lower utf-16 priority so that we + ;; normally prefer utf-8 to it, and put + ;; x-ctext below that. + (cond ((or (eq base 'mule-utf-16-le) + (eq base 'mule-utf-16-be)) + 16) + ((string-match "^x-" (symbol-name mime)) + 8) + (t 32)) 0)) (if (memq base lang-preferred) 8 0) (if (string-match "-with-esc$" (symbol-name base)) --8<---------------cut here---------------end--------------->8--- -- ,,, (o o) ---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/