emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '


From: Eric Frederickson
Subject: Re: lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ?
Date: Tue, 08 Aug 2023 12:10:13 -0500

"Jason Vas Dias"<jason.vas.dias@ptt.ie> writes:

>  Good day -
>
>    How to get emacs LISP program editing modes to ignore
>    UTF-8 parentheses characters like '《' (\U300A) or :
>      10088    2768    (3 2)   ❨       'MEDIUM LEFT PARENTHESIS ORNAMENT'
>      10089    2769    (3 2)   ❩       'MEDIUM RIGHT PARENTHESIS ORNAMENT'
>      10090    276A    (3 2)   ❪       'MEDIUM FLATTENED LEFT PARENTHESIS 
> ORNAMENT'
>      10091    276B    (3 2)   ❫       'MEDIUM FLATTENED RIGHT PARENTHESIS 
> ORNAMENT'
>      10222    27EE    (5 1)   ⟮       'MATHEMATICAL LEFT FLATTENED 
> PARENTHESIS'
>      10223    27EF    (5 1)   ⟯       'MATHEMATICAL RIGHT FLATTENED 
> PARENTHESIS'
>      10629    2985    (3 2)   ⦅       'LEFT WHITE PARENTHESIS'
>      10630    2986    (3 2)   ⦆       'RIGHT WHITE PARENTHESIS'
>      11816    2E28    (5 1)   ⸨       'LEFT DOUBLE PARENTHESIS'
>      11817    2E29    (5 1)   ⸩       'RIGHT DOUBLE PARENTHESIS'
>      64830    FD3E    (1 1)   ﴾       'ORNATE LEFT PARENTHESIS'
>      64831    FD3F    (1 1)   ﴿       'ORNATE RIGHT PARENTHESIS'
>      12298    300A    (1 1)   《       'LEFT DOUBLE ANGLE BRACKET'
>      12299    300B    (1 1)   》       'RIGHT DOUBLE ANGLE BRACKET'
>      65113    FE59    (1 1)   ﹙       'SMALL LEFT PARENTHESIS'
>      65114    FE5A    (1 1)   ﹚       'SMALL RIGHT PARENTHESIS'
>      65288    FF08    (1 1)   (       'FULLWIDTH LEFT PARENTHESIS'
>      65289    FF09    (1 1)   )       'FULLWIDTH RIGHT PARENTHESIS'
>      65375    FF5F    (3 2)   ⦅       'FULLWIDTH LEFT WHITE PARENTHESIS'
>      65376    FF60    (3 2)   ⦆       'FULLWIDTH RIGHT WHITE PARENTHESIS'

Your problem (although I'm assuming this wouldn't be a problem for most users)
is that all the above characters are defined to be opening/closing delimiters 
in the
syntax table for elisp-mode. (You can view the syntax table for the current
major mode with "C-h s").

In order to disable their treatment as opening or closing delimiters, use the
modify-syntax-entry funtion as described above on this thread. For instance:

(modify-syntax-entry ?❨ "w")

to put MEDIUM-LEFT-PARENTHESIS-ORNAMENT in the word class instead of the
opening-delimeter class. Doing this for all the characters you specified will
give you your desired behavior. See this section of the Emacs wiki:

https://www.emacswiki.org/emacs/EmacsSyntaxTable#h5o-4

for information on how to put these types configurations in your init file so
that they will be in effect every time you enter elisp-mode.

Best,
Eric Frederickson

>    Please could some emacs guru let me know how the 'lisp-mode' based source
>    editing modes can be made to ignore / treat as normal characters such 
> not-ascii-'(' and
>    not-ascii-')' characters and to NOT attempt to balance them or to
>    consider them parenthesis syntax ? No LISP parser I am using
>    considers them to be syntax.
>
>    It is really annoying to have to turn all parenthesis balancing off
>    when my lisp source code files might contain such valid unicode characters.
>
>    I am running Emacs 28.2 I built as RPM with modified Fedora emacs
>    spec file under Fedora Linux v36 x86_64 .
>
> Thanks & Best Regards,
> Jason



reply via email to

[Prev in Thread] Current Thread [Next in Thread]