unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ?
@ 2023-08-08  7:37 Jason Vas Dias
  2023-08-08  9:19 ` Eric S Fraga
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jason Vas Dias @ 2023-08-08  7:37 UTC (permalink / raw)
  To: emacs-devel; +Cc: jason.vas.dias


 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'
 

   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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ?
  2023-08-08  7:37 lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ? Jason Vas Dias
@ 2023-08-08  9:19 ` Eric S Fraga
  2023-08-08 17:23   ` Jason Vas Dias
  2023-08-08 12:10 ` Eli Zaretskii
  2023-08-08 17:10 ` Eric Frederickson
  2 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2023-08-08  9:19 UTC (permalink / raw)
  To: emacs-devel

On Tuesday,  8 Aug 2023 at 08:37, Jason Vas Dias wrote:
>    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.

You could try

    (modify-syntax-entry ?< ".")

where you replace < with each individual character you do not wish to be
treated as a paren.

-- 
Eric S Fraga via gnus (Emacs 30.0.50 2023-08-07) on Debian 12.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ?
  2023-08-08  7:37 lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ? Jason Vas Dias
  2023-08-08  9:19 ` Eric S Fraga
@ 2023-08-08 12:10 ` Eli Zaretskii
  2023-08-08 17:10 ` Eric Frederickson
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-08-08 12:10 UTC (permalink / raw)
  To: Jason Vas Dias; +Cc: emacs-devel, jason.vas.dias

> From: "Jason Vas Dias"<jason.vas.dias@ptt.ie>
> cc: jason.vas.dias@gmail.com
> Date: Tue, 08 Aug 2023 08:37:25 +0100
> 
> 
>    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.

Please elaborate on the meaning of "attempt to balance them or to
consider them parenthesis syntax".  Which aspects of what Emacs does
by default annoy you and you would like to turn them off?

The answer to your question might depend on what exactly would you
like to "turn off".



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ?
  2023-08-08  7:37 lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ? Jason Vas Dias
  2023-08-08  9:19 ` Eric S Fraga
  2023-08-08 12:10 ` Eli Zaretskii
@ 2023-08-08 17:10 ` Eric Frederickson
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Frederickson @ 2023-08-08 17:10 UTC (permalink / raw)
  To: Jason Vas Dias, jason.vas.dias; +Cc: emacs-devel

"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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ?
  2023-08-08  9:19 ` Eric S Fraga
@ 2023-08-08 17:23   ` Jason Vas Dias
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Vas Dias @ 2023-08-08 17:23 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-devel

That worked, thank you!

 (mapcar (lambda (c)
	 (eval (list 'modify-syntax-entry c "."))
	)
 '( ?\❨ ?\❩ ?\❪ ?\❫ ?\⟮ ?\⟯ ?\⦅ ?\⦆ ?\⸨ ?\⸩ ?\﴾ ?\﴿ ?\《 ?\》 ?\﹙ ?\﹚
?\(  ?\) ?\⦅ ?\⦆)
)

Strange, I am not able to get that to work without the 'eval' .


On 08/08/2023, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Tuesday,  8 Aug 2023 at 08:37, Jason Vas Dias wrote:
>>    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.
>
> You could try
>
>     (modify-syntax-entry ?< ".")
>
> where you replace < with each individual character you do not wish to be
> treated as a paren.
>
> --
> Eric S Fraga via gnus (Emacs 30.0.50 2023-08-07) on Debian 12.1
>
>
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-08 17:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08  7:37 lisp-mode: how to disable parentheses matching on non-ASCII '[({]' '[})]' UTF-8 parenthesis chars ? Jason Vas Dias
2023-08-08  9:19 ` Eric S Fraga
2023-08-08 17:23   ` Jason Vas Dias
2023-08-08 12:10 ` Eli Zaretskii
2023-08-08 17:10 ` Eric Frederickson

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).