unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de>
Subject: sort-coding-systems in 21.3 and RC branch (was: New function `emacs-version>=')
Date: Mon, 05 May 2003 15:47:26 +0200	[thread overview]
Message-ID: <v9issp8pzl.fsf_-_@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: 200305031842.h43IgBDm025358@rum.cs.yale.edu

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/

  reply	other threads:[~2003-05-05 13:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02 19:55 [Suggestion] New function `emacs-version>=' Wedler, Christoph
2003-05-02 21:00 ` Juanma Barranquero
2003-05-02 21:14   ` Stefan Monnier
2003-05-02 21:35     ` Juanma Barranquero
2003-05-03 11:12       ` Ehud Karni
2003-05-03 13:54         ` Juanma Barranquero
2003-05-03 16:08           ` Stephen J. Turnbull
2003-05-04 19:15             ` Juanma Barranquero
2003-05-06 11:05               ` Stephen J. Turnbull
2003-05-04 13:04           ` Richard Stallman
2003-05-03 17:48     ` Reiner Steib
2003-05-03 18:42       ` Stefan Monnier
2003-05-05 13:47         ` Reiner Steib [this message]
2003-05-06  7:08           ` sort-coding-systems in 21.3 and RC branch (was: New function `emacs-version>=') Kenichi Handa
2003-05-02 21:16 ` [Suggestion] New function `emacs-version>=' Thien-Thi Nguyen
2003-05-04 13:03 ` Richard Stallman
2003-05-05 12:52   ` Wedler, Christoph
2003-05-05 13:20     ` Juanma Barranquero
2003-05-05 19:11     ` Richard Stallman
2003-05-05 21:59     ` Luc Teirlinck
2003-05-06 23:42 ` Istvan Marko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9issp8pzl.fsf_-_@marauder.physik.uni-ulm.de \
    --to=4.uce.03.r.s@nurfuerspam.de \
    --cc=reiner.steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).