help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case-insensitive string<


From: Ted Zlatanov
Subject: Re: case-insensitive string<
Date: Mon, 20 Apr 2009 13:37:37 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.92 (gnu/linux)

On Fri, 17 Apr 2009 23:13:54 +0200 Nikolaj Schumacher <me@nschum.de> wrote: 

NS> Ted Zlatanov <tzz@lifelogs.com> wrote:
>> Perhaps you can use `sort' with a predicate that uses `compare-strings'?
>> The latter function has a ignore-case parameter, and is implemented in C
>> so should be quite fast.

NS> Thanks.  `company-strings' is indeed fast.  Unfortunately the return

s/company/compare/

NS> value is odd.  It returns a positiv/negative number if different, but t
NS> (instead of 0) when they are equal.  That means some work to turn it
NS> into a compatible predicate...

NS> (byte-compile
NS>  (lambda (a b)
NS>    (let ((v (compare-strings a nil nil b nil nil t)))
NS>      (or (eq v t) (< v 0)))))

NS> All this fuss eventually makes it slower... :(

Modifying the C source code is pretty easy, but I would actually submit
this as a feature request on emacs-devel if you're interested.  The
right way to solve it may be to add a case-fold-compare global variable
similar to case-fold-search, with the same automatic buffer-local
behavior.

Ted


reply via email to

[Prev in Thread] Current Thread [Next in Thread]