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: Wed, 05 Dec 2012 10:42:26 +0100 Message-ID: <50BF1702.4020100@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> <50BE38F3.3030907@gmx.at> <3E2D742BA0FC44B7A61665D85AAC3712@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354700594 24562 80.91.229.3 (5 Dec 2012 09:43:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Dec 2012 09:43:14 +0000 (UTC) Cc: perin@panix.com, perin@acm.org, 13041@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 05 10:43:25 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 1TgBVe-0008De-RX for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Dec 2012 10:43:19 +0100 Original-Received: from localhost ([::1]:58188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgBVT-0000PY-1T for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Dec 2012 04:43:07 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgBVM-0000PI-9p for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2012 04:43:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgBVI-0000bX-2G for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2012 04:43:00 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgBVH-0000bS-UK for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2012 04:42:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TgBVO-0008Qu-0s for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2012 04:43:02 -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: Wed, 05 Dec 2012 09:43: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.135470056032377 (code B ref 13041); Wed, 05 Dec 2012 09:43:01 +0000 Original-Received: (at 13041) by debbugs.gnu.org; 5 Dec 2012 09:42:40 +0000 Original-Received: from localhost ([127.0.0.1]:54296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TgBV2-0008QA-43 for submit@debbugs.gnu.org; Wed, 05 Dec 2012 04:42:40 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:60410) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1TgBUz-0008Q2-89 for 13041@debbugs.gnu.org; Wed, 05 Dec 2012 04:42:38 -0500 Original-Received: (qmail invoked by alias); 05 Dec 2012 09:42:29 -0000 Original-Received: from 62-47-60-75.adsl.highway.telekom.at (EHLO [62.47.60.75]) [62.47.60.75] by mail.gmx.net (mp024) with SMTP; 05 Dec 2012 10:42:29 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX194/ORTaBp40CwiZBEJhPEPHD4uBN+QN1ilHcP9Ge ULVRPZY5Xcf+Hz In-Reply-To: <3E2D742BA0FC44B7A61665D85AAC3712@us.oracle.com> 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:67963 Archived-At: > 1. Assuming this or similar is added to Emacs (please do). Please consider > modifying it to respect `case-fold-search'. These modified lines do that. > > (setq prop1 (get-char-code-property > (if case-fold-search > (downcase (elt string1 index1)) > (elt string1 index1)) > 'decomposition)) > > [Same thing for prop2 with string2 and index2.] This would have to be done, yes. > (let ((value (compare-strings compat1 0 nil > compat2 0 nil case-fold-search))) > > > 2. In addition, consider updating `string-lessp' to be sensitive to a variable > such as this: > > (defvar ignore-diacritics nil > "Non-nil means ignore diacritics for string comparisons.") > > With that, an alternative to hard-coding a call to `decomposed-string-lessp' is > to bind `ignore-diacritics' and use `string-lessp'. `ignore-diacritics' is misleading. The variable would have to be called `observe-decompositions' or something the like. > A similar change could be made for `compare-strings': reflect the value of > `ignore-diacritics'. Or since that function has made the choice to pass > case-sensitivity as a parameter instead of respecting `case-fold-search', pass > another parameter for diacritic sensitivity. Indeed, `string-lessp' is too weak - we'd need a function to tell whether two strings are equal disregarding "certain" decomposition properties. > 3. More general than #2 would be a function like this, which is sensitive to > both `ignore-diacritics' and `case-fold-search' (this assumes the change > suggested above in #1 for `decomposed-string-lessp'). > > (defun my-string-lessp (s1 s2) > "..." > (if ignore-diacritics > (decomposed-string-lessp s1 s2) > (when case-fold-search (setq s1 (upcase s1) > s2 (upcase s2))) > (string-lessp s1 s2))) > > Dunno a good name for this. It's too late to let `string-lessp' itself act like > this - that would break stuff. `string-lessp' is in C. I wouldn't touch it anyway. > 4. Even better than hard-coding `case-fold-search' in `my-string-less-p' and > `decomposed-string-lessp' would be to have those functions be sensitive to a > variable such as this: > > (defvar string-case-variable 'case-fold-search > "Value is a case-sensitivity variable such as `case-fold-search'. > The values of that variable must be like those for `case-fold-search': > nil means case-sensitive, non-nil means case-insensitive.") > > Code could then bind `string-case-variable' to, say, `(not > completion-ignore-case)' or to any other case-sensitivity controlling sexp, when > appropriate. > > This would have the advantages offered by passing an explicit case-sensitivity > parameter, as in `compare-strings', but also the advantages of dynamic scope: > binding `string-case-var' to affect all comparisons within scope. > > Comparers such as `(my-)string-lessp' are often used as arguments to > higher-order functions that treat them as (only) binary predicates, i.e., > predicates where any additional parameters specifying case or diacritic > sensitivity are ignored. I first have to solve the problems with the values returned by `get-char-code-property'. Then I will look into this. martin