From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: A simpler, gentler version of char-fold-to-regexp Date: Tue, 29 Aug 2017 12:38:00 -0700 Message-ID: <87lgm26u7b.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1504039233 3306 195.159.176.226 (29 Aug 2017 20:40:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 29 Aug 2017 20:40:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 29 22:40:29 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmnJ2-0008Sk-GU for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Aug 2017 22:40:16 +0200 Original-Received: from localhost ([::1]:46858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmnJ9-0007It-Bg for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Aug 2017 16:40:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmnIS-0007Hu-OU for help-gnu-emacs@gnu.org; Tue, 29 Aug 2017 16:39:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmnIP-0006eq-Ms for help-gnu-emacs@gnu.org; Tue, 29 Aug 2017 16:39:40 -0400 Original-Received: from [195.159.176.226] (port=54526 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmnIP-0006dz-G2 for help-gnu-emacs@gnu.org; Tue, 29 Aug 2017 16:39:37 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dmnIE-00061O-7P for help-gnu-emacs@gnu.org; Tue, 29 Aug 2017 22:39:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:aWSTl6KHjq8viPjJIIaDcwLPm4A= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114124 Archived-At: Hi, I'm using char-fold-to-regexp to good effect in a user-facing search routine: users can enter "Miriam", and match "Míriam". It's a bit overkill for my purposes, though, as `char-fold-to-regexp' effectively turns the whole search string into a perfect regexp, whereas I want users to be able to use regexp-special characters in their search strings. Ie, I'd like to leave the "^" in "^string" alone, and not turn it into "[^^]". Really all I want is to create character regexps for the range [a-zA-Z], and leave everything else alone. No multi-character matches, no spaces, no char ranges, etc. I figured it wouldn't be too hard to do a copy-paste number on the code in char-fold.el, but I'm bogging down a bit at the heart of it. I just can't wrap my head around what's happening in the `make-decomp-match-char' internal function, in part because it's simply doing way more than I need, in part because the unicode decomposition table returns bytecode, which is confusing. All I want in that inner function is to say: "If a character (for instance ?í) decomposes to a character within the range [a-zA-Z] (?i), then add ?í to the entry for ?i in my new char-table." Can anyone show me what that would look like? All the rest of it I can do. Thanks, Eric