all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: A simpler, gentler version of char-fold-to-regexp
Date: Tue, 29 Aug 2017 12:38:00 -0700	[thread overview]
Message-ID: <87lgm26u7b.fsf@ericabrahamsen.net> (raw)

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




                 reply	other threads:[~2017-08-29 19:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgm26u7b.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.