GNU bug report logs -
#13041
24.2; diacritic-fold-search
Previous Next
Reported by: perin <at> acm.org
Date: Fri, 30 Nov 2012 18:31:02 UTC
Severity: wishlist
Found in version 24.2
Fixed in version 25.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
Message #92 received at 13041 <at> debbugs.gnu.org (full text, mbox):
This version of Martin's function (but respecting `case-fold-search') is maybe a
tiny bit simpler. It could also be a bit slower because of `substring'
returning a copy (vs just incrementing an offset). It should also be checked
for correctness - not really tested. FWIW/HTH.
(It does correct the two double `(< value 0)' typos I mentioned earlier.
That should be done in any case.)
(defun decomposed-string-lessp (string1 string2)
"Return non-nil if decomposed STRING1 is less than decomposed STRING2.
Comparison respects `case-fold-search'."
(let ((s1 string1)
(s2 string2)
prop1 prop2 type1 type2)
(catch 'found
(while (and (> (length s1) 0) (> (length s2) 0))
(setq prop1 (get-char-code-property (if case-fold-search
(downcase (elt s1 0))
(elt s1 0))
'decomposition)
prop2 (get-char-code-property (if case-fold-search
(downcase (elt s2 0))
(elt s2 0))
'decomposition)
type1 (car prop1)
type2 (car prop2))
(when (eq type1 'compat) (setq s1 (concat (cdr prop1))))
(when (eq type2 'compat) (setq s2 (concat (cdr prop2))))
(cond ((eq type1 'compat)
(let ((cs (compare-strings
s1 0 nil
s2 0 (and (not (eq type2 'compat))
(min (length s1) (length s2)))
case-fold-search)))
(unless (eq cs t) (throw 'found (< cs 0)))))
((eq type2 'compat)
(let ((cs (compare-strings
s1 0 (min (length s2) (length s1))
s2 0 nil
case-fold-search)))
(unless (eq cs t) (throw 'found (< cs 0)))))
((= type1 type2)
(setq s1 (substring s1 1)
s2 (substring s2 1)))
(t (throw 'found (< type1 type2)))))
(< (length string1) (length string2)))))
This bug report was last modified 8 years and 342 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.