all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Heime <heimeborgia@protonmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Regexp capturing unicode characters
Date: Thu, 01 Aug 2024 13:43:20 +0000	[thread overview]
Message-ID: <uLWDqkkLlZSrOa36xkHb88GyVQc7GLDYNOT1xuiXWNPSSe13R9Z-LsIH-htVRVl6jBulj12Nbb209Bh5BfuFQJODhlEppLEnBo1_bGHqVds=@protonmail.com> (raw)
In-Reply-To: <86le1gwii6.fsf@gnu.org>

On Friday, August 2nd, 2024 at 12:10 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Thu, 01 Aug 2024 11:26:40 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> > 
> > On Thursday, August 1st, 2024 at 5:15 PM, Eli Zaretskii eliz@gnu.org wrote:
> > 
> > > > Date: Wed, 31 Jul 2024 21:24:46 +0000
> > > > From: Heime heimeborgia@protonmail.com
> > > > 
> > > > I am using unicode characters in my elisp code (e.g. foreign language symbols in icelandic
> > > > and spanish).
> > > > 
> > > > Is the regexp [[:word:]] appropriate to capture them ?
> > > 
> > > No. [[:word:]] matches characters that have the word syntax, so which
> > > characters match depends on the major mode. My suggestion is to use
> > > either [[:alnum:]] or [[:alpha:]] instead, depending on whether you
> > > want or don't want to match digit characters.
> > > 
> > > The meaning of each character class is documented in the "Char
> > > Classes" node of the ELisp Reference manual, I suggest to read it and
> > > choose the most appropriate one for your needs.
> > 
> > It is difficult to determine from a character class, the actual character.
> 
> Why do you need that? Don't you know which characters you'd like to
> match?

No, because language insertion in emacs depends upon the user.  But I want 
to match foreign language characters mostly.
 
> > Is there a way to show the characters that are members of each class ?
> 
> No, but you can check each character whether it matches a class.

What is the function name for doing that ?  Can one scan the buffer
and list the matched character classes ?
 
> > Thought that [:multibyte:] captured the unicode characters. Bet even when
> > I applied (set-buffer-multibyte t) to the buffer, I did not get matches.
> 
> Don't use [:multibyte:], it is hardly ever the right thing nowadays.

Can we update the manual with useful information such as with [:multibyte:] please.
 
> > Does [:word:] mean word in the english language only ?
> 
> 
> No, it means characters that have the word syntax. IOW, which
> character match depends on the major mode's syntax table. If you are
> classifying characters from human-readable text, [:word:] is not the
> right thing to use.

Can one show the syntax table ?  For me it is just word syntax table does 
not give me enough information.  Perhaps give more explanation in the manual.



  reply	other threads:[~2024-08-01 13:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 21:24 Regexp capturing unicode characters Heime
2024-07-31 21:50 ` Heime
2024-08-01  5:15 ` Eli Zaretskii
2024-08-01 11:26   ` Heime
2024-08-01 12:10     ` Eli Zaretskii
2024-08-01 13:43       ` Heime [this message]
2024-08-01 14:30         ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-08-01 15:34         ` Eli Zaretskii
2024-08-01 17:06           ` Heime
2024-08-01 17:46             ` Eli Zaretskii
2024-08-01 19:44               ` Heime
2024-08-02  5:44                 ` Eli Zaretskii
2024-08-02  8:03                   ` uzibalqa

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='uLWDqkkLlZSrOa36xkHb88GyVQc7GLDYNOT1xuiXWNPSSe13R9Z-LsIH-htVRVl6jBulj12Nbb209Bh5BfuFQJODhlEppLEnBo1_bGHqVds=@protonmail.com' \
    --to=heimeborgia@protonmail.com \
    --cc=eliz@gnu.org \
    --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.