unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Strange results from sort-coding-systems
@ 2006-03-21 20:50 Reiner Steib
  2006-03-21 22:03 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2006-03-21 20:50 UTC (permalink / raw)


Hi,

the function `rs-sort-coding-systems-21-3-fix-p'[1,2], should return
t iff mule-utf-8 is not preferred over mule-utf-16-be and
mule-utf-16-le:

(defun rs-sort-coding-systems-21-3-fix-p ()
  "Return non-nil iff we need to use `rs-sort-coding-systems'."
  (let ((pref (car (sort-coding-systems
		    '(mule-utf-16-be mule-utf-16-le mule-utf-8)))))
    (message "pref=%s" pref)
    (not (eq 'mule-utf-8 pref))))

When I call it the first time, it returns nil with current CVS Emacs.
But the second time, I get `t'.  See the *ielm* buffer and the
*Messages* buffer below.  Am I doing something wrong?

Bye, Reiner.

--8<---------------cut here---------------start------------->8---
*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> emacs-version
"22.0.50.6"
ELISP> (emacs-version)
"GNU Emacs 22.0.50.6 (i686-pc-linux-gnu, GTK+ Version 2.4.9)\n of 2006-03-21 on shrubbery"
ELISP> (defun rs-sort-coding-systems-21-3-fix-p ()
	 "Return non-nil iff we need to use `rs-sort-coding-systems'."
	 (let ((pref (car (sort-coding-systems
			   '(mule-utf-16-be mule-utf-16-le mule-utf-8)))))
	   (message "pref=%s" pref)
	   (not (eq 'mule-utf-8 pref))))
rs-sort-coding-systems-21-3-fix-p
ELISP> (rs-sort-coding-systems-21-3-fix-p)
nil
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
ELISP> (car (sort-coding-systems
	     '(mule-utf-16-be mule-utf-16-le mule-utf-8)))
mule-utf-8
ELISP> (car (sort-coding-systems
	     '(mule-utf-16-be mule-utf-16-le mule-utf-8)))
mule-utf-8
ELISP> (rs-sort-coding-systems-21-3-fix-p)
t
--8<---------------cut here---------------end--------------->8---

>From the *Messages* buffer:

--8<---------------cut here---------------start------------->8---
pref=mule-utf-8
History item: 1
pref=mule-utf-16-be
History item: 1
pref=mule-utf-16-be
History item: 1
pref=mule-utf-16-be
History item: 1
pref=mule-utf-16-be
History item: 1
pref=mule-utf-16-be
History item: 1
pref=mule-utf-16-be
History item: 1
pref=mule-utf-16-be
Mark set [2 times]
History item: 1 [2 times]
History item: 2
History item: 3
pref=mule-utf-16-be
--8<---------------cut here---------------end--------------->8---

>From `M-x report-emacs-bug RET':

--8<---------------cut here---------------start------------->8---
In GNU Emacs 22.0.50.6 (i686-pc-linux-gnu, GTK+ Version 2.4.9)
 of 2006-03-21 on shrubbery
X server distributor `The X.Org Foundation', version 11.0.60801000
configured using `configure '--prefix=/import/xtra/emacs/HEAD' '--with-gtk' '--exec-prefix=/import/xtra/emacs/HEAD-i686''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: de_DE@euro
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-8859-15
  default-enable-multibyte-characters: t

Major mode: IELM

Minor modes in effect:
  tooltip-mode: t
  auto-compression-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  line-number-mode: t
  transient-mark-mode: identity
--8<---------------cut here---------------end--------------->8---

[1]
| Emacs 21.3 and Emacs 21.4 come with a slightly broken version of
| the function `sort-coding-systems'.  Therefore in some cases, Gnus
| uses utf-16-x rather than utf-8.  Additionally, it's not correct
| utf-16-be.  See http://thread.gmane.org/gmane.emacs.bugs/4663 or
| http://article.gmane.org/gmane.emacs.bugs/4673 for details.

[2]
| Based on a suggestion by Stefan Monnier in
| http://thread.gmane.org/gmane.emacs.devel/13662
| Message-ID: <200305031842.h43IgBDm025358@rum.cs.yale.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strange results from sort-coding-systems
  2006-03-21 20:50 Strange results from sort-coding-systems Reiner Steib
@ 2006-03-21 22:03 ` Stefan Monnier
  2006-03-22 16:58   ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2006-03-21 22:03 UTC (permalink / raw)


>   (let ((pref (car (sort-coding-systems
> 		    '(mule-utf-16-be mule-utf-16-le mule-utf-8)))))

sort-coding-systems is destructive, so you need to pass it a copy of
the list.


        Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strange results from sort-coding-systems
  2006-03-21 22:03 ` Stefan Monnier
@ 2006-03-22 16:58   ` Kevin Rodgers
  2006-03-23  1:21     ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2006-03-22 16:58 UTC (permalink / raw)


Stefan Monnier wrote:
>>  (let ((pref (car (sort-coding-systems
>>		    '(mule-utf-16-be mule-utf-16-le mule-utf-8)))))
> 
> 
> sort-coding-systems is destructive, so you need to pass it a copy of
> the list.

Its doc string should mention that "The CODINGS list is modified by side 
effects", just like sort's doc string.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strange results from sort-coding-systems
  2006-03-22 16:58   ` Kevin Rodgers
@ 2006-03-23  1:21     ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2006-03-23  1:21 UTC (permalink / raw)
  Cc: emacs-devel

In article <dvrvpb$40u$1@sea.gmane.org>, Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Stefan Monnier wrote:
>>> (let ((pref (car (sort-coding-systems
>>> '(mule-utf-16-be mule-utf-16-le mule-utf-8)))))
>> 
>> 
>> sort-coding-systems is destructive, so you need to pass it a copy of
>> the list.

> Its doc string should mention that "The CODINGS list is modified by side 
> effects", just like sort's doc string.

Right.  I've just committed such a change.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-03-23  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-21 20:50 Strange results from sort-coding-systems Reiner Steib
2006-03-21 22:03 ` Stefan Monnier
2006-03-22 16:58   ` Kevin Rodgers
2006-03-23  1:21     ` Kenichi Handa

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).