From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#13041: 24.2; diacritic-fold-search Date: Tue, 04 Dec 2012 18:54:59 +0100 Message-ID: <50BE38F3.3030907@gmx.at> References: <20121130182205.C722F14B8D@panix1.panix.com> <87hao69b5r.fsf@mail.jurta.org> <20665.8224.844876.619203@panix5.panix.com> <87hao6zko4.fsf@mail.jurta.org> <83fw3qtboc.fsf@gnu.org> <87hao5jqu3.fsf@mail.jurta.org> <50BB93C2.1050007@gmx.at> <83y5hgs564.fsf@gnu.org> <50BC7BF5.2020400@gmx.at> <83hao3rskd.fsf@gnu.org> <50BCE49D.6010001@gmx.at> <837gozrp8f.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354643750 966 80.91.229.3 (4 Dec 2012 17:55:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Dec 2012 17:55:50 +0000 (UTC) Cc: perin@panix.com, 13041@debbugs.gnu.org, perin@acm.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 04 18:56:01 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tfwit-0001UJ-1C for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Dec 2012 18:55:59 +0100 Original-Received: from localhost ([::1]:41909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tfwih-0005h2-Ar for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Dec 2012 12:55:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfwiZ-0005Tz-8c for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 12:55:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfwiT-0006H2-Bf for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 12:55:39 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfwiT-0006Gx-8D for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 12:55:33 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Tfwkr-0007fi-IX for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 12:58:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Dec 2012 17:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13041 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13041-submit@debbugs.gnu.org id=B13041.135464385629458 (code B ref 13041); Tue, 04 Dec 2012 17:58:01 +0000 Original-Received: (at 13041) by debbugs.gnu.org; 4 Dec 2012 17:57:36 +0000 Original-Received: from localhost ([127.0.0.1]:53514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfwkR-0007f5-RC for submit@debbugs.gnu.org; Tue, 04 Dec 2012 12:57:36 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:39643) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1TfwkP-0007ex-9P for 13041@debbugs.gnu.org; Tue, 04 Dec 2012 12:57:34 -0500 Original-Received: (qmail invoked by alias); 04 Dec 2012 17:55:02 -0000 Original-Received: from 62-47-48-231.adsl.highway.telekom.at (EHLO [62.47.48.231]) [62.47.48.231] by mail.gmx.net (mp029) with SMTP; 04 Dec 2012 18:55:02 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX191R98pzRV1Pw5iW9/HSl4nQZVrvSor7BIGFDdUlF Dmp31KSkJeueer In-Reply-To: <837gozrp8f.fsf@gnu.org> X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67906 Archived-At: > Yes, you can modify the table set up by uni-decomposition.el. I > think. Seems to work well. The function I came up with goes as below. Thanks for the hints, martin (defun decomposed-string-lessp (string1 string2) "Return t if STRING1 is decomposition-less than STRING2." (let* ((length1 (length string1)) (length2 (length string2)) (min-length (min length1 length2)) (index1 0) (index2 0) prop1 prop2 type1 type2 compat1 compat2) (catch 'found (while (and (< index1 length1) (< index2 length2)) (setq prop1 (get-char-code-property (downcase (elt string1 index1)) 'decomposition)) (setq type1 (car prop1)) (setq prop2 (get-char-code-property (downcase (elt string2 index2)) 'decomposition)) (setq type2 (car prop2)) (cond ((and (eq type1 'compat) (eq type2 'compat)) (setq compat1 (concat (cdr prop1))) (setq compat2 (concat (cdr prop2))) (let ((value (compare-strings compat1 0 nil compat2 0 nil t))) (cond ((eq value t) (setq index1 (1+ index1)) (setq index2 (1+ index2))) ((< value 0) (throw 'found t)) ((< value 0) (throw 'found nil))))) ((eq type1 'compat) (setq compat1 (concat (cdr prop1))) (let ((value (compare-strings compat1 0 nil string2 index2 (min (+ index2 (length compat1)) length2) t))) (cond ((eq value t) (setq index1 (1+ index1)) (setq index2 (+ index2 (length compat1)))) ((< value 0) (throw 'found t)) ((< value 0) (throw 'found nil))))) ((eq type2 'compat) (setq compat2 (concat (cdr prop2))) (let ((value (compare-strings string1 index1 (min (+ index1 (length compat2)) length1) compat2 0 nil t))) (cond ((eq value t) (setq index1 (+ index1 (length compat2))) (setq index2 (1+ index2))) ((< value 0) (throw 'found t)) ((< value 0) (throw 'found nil))))) ((< type1 type2) (throw 'found t)) ((> type1 type2) (throw 'found nil)) (t (setq index1 (1+ index1)) (setq index2 (1+ index2))))) ;; Shorter is less. (< length1 length2))))