unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Lisp mode syntax table
@ 2014-02-17 10:43 Fabrice Popineau
  2014-02-17 20:19 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Popineau @ 2014-02-17 10:43 UTC (permalink / raw)
  To: emacs-devel

Hi,

Is there a good reason why:
(with-syntax-table lisp-mode-syntax-table
  (string (char-syntax ?\|)))
"\""


IE : the ?\| character has the syntax of string delimiter?
It is certainly not the case when it is used to prevent 
the Lisp reader to switch symbols to upper case characters.
I recently used buffers with lots of symbols of the form
|rdf|:|someClass| and smartparen can't behave well in this case,
unless ?\| be switched to symbol constituent.
Would that switch imply any drawbacks I can't think of?

Thanks,

Fabrice




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

* Re: Lisp mode syntax table
  2014-02-17 10:43 Lisp mode syntax table Fabrice Popineau
@ 2014-02-17 20:19 ` Stefan Monnier
  2014-02-17 22:10   ` Fabrice Popineau
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-02-17 20:19 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-devel

> Is there a good reason why:
> (with-syntax-table lisp-mode-syntax-table
>   (string (char-syntax ?\|)))
> "\""

IIRC some Lisps use that for symbols.

> |rdf|:|someClass| and smartparen can't behave well in this case,

If it hurts don't do that.  Really, it seems like a particularly bad idea.

> Would that switch imply any drawbacks I can't think of?

I'm not sure what lisp-mode-syntax-table should use, but so far
emacs-lisp-mode-syntax-table should use "_" for the syntax of ?|

OTOH, someone might want to make |...| into a new syntax for symbols, in
which case your |rdf|:|someClass| might break in the future.


        Stefan



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

* Re: Lisp mode syntax table
  2014-02-17 20:19 ` Stefan Monnier
@ 2014-02-17 22:10   ` Fabrice Popineau
  2014-02-18  0:19     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Popineau @ 2014-02-17 22:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

2014-02-17 21:19 GMT+01:00 Stefan Monnier <monnier@iro.umontreal.ca>:

> > Is there a good reason why:
> > (with-syntax-table lisp-mode-syntax-table
> >   (string (char-syntax ?\|)))
> > "\""
>
> IIRC some Lisps use that for symbols.
>
> > |rdf|:|someClass| and smartparen can't behave well in this case,
>
> If it hurts don't do that.  Really, it seems like a particularly bad idea.
>
>
Usually, I try not to hurt myself too much but you know what it is...
Care to explain  why it is such a bad idea?
Sometimes you need case-sensitive symbols
in Lisp, and semantic web (RDF, OWL and so on) is one.


> > Would that switch imply any drawbacks I can't think of?
>
> I'm not sure what lisp-mode-syntax-table should use, but so far
> emacs-lisp-mode-syntax-table should use "_" for the syntax of ?|
>
>
And this is what I advocated for.


> OTOH, someone might want to make |...| into a new syntax for symbols, in
> which case your |rdf|:|someClass| might break in the future.
>
> Sure but the same guy could also redefine ( and ) in the reader ...

Fabrice

[-- Attachment #2: Type: text/html, Size: 1939 bytes --]

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

* Re: Lisp mode syntax table
  2014-02-17 22:10   ` Fabrice Popineau
@ 2014-02-18  0:19     ` Stefan Monnier
  2014-02-18  5:53       ` Fabrice Popineau
  2014-02-18  6:02       ` Fabrice Popineau
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2014-02-18  0:19 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Emacs developers

>> > |rdf|:|someClass| and smartparen can't behave well in this case,
>> If it hurts don't do that.  Really, it seems like a particularly bad idea.
> Usually, I try not to hurt myself too much but you know what it is...
> Care to explain  why it is such a bad idea?
> Sometimes you need case-sensitive symbols
> in Lisp, and semantic web (RDF, OWL and so on) is one.

Wait, I think I completely misunderstood your problem.
You're not talking about Emacs Lisp code but about "other Lisp" code
(Common Lisp?), right?

In that case |rdf|:|someClass| might be fine, indeed, but in that case
also a syntax of "\"" for ?| sounds like the right thing to do (e.g. so
that forward-sexp will properly jump over the |)| symbol).

> I recently used buffers with lots of symbols of the form
> |rdf|:|someClass| and smartparen can't behave well in this case,

Might be a problem in smartparen.  What does it do that you dislike?


        Stefan



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

* Re: Lisp mode syntax table
  2014-02-18  0:19     ` Stefan Monnier
@ 2014-02-18  5:53       ` Fabrice Popineau
  2014-02-18 14:00         ` Stefan Monnier
  2014-02-18  6:02       ` Fabrice Popineau
  1 sibling, 1 reply; 8+ messages in thread
From: Fabrice Popineau @ 2014-02-18  5:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

>
>
> Might be a problem in smartparen.  What does it do that you dislike?
>
>
> The problem may not be the class of ?| per se, but the interaction with ?:
.
The whole thing |rdf|:|someClass| should be considered as a symbol.
At the moment, using smartparen to push a ?) through this symbol,
you start by putting it here :
|rdf|):|someClass|
then here
|rdf| :)|someParen|
(notice that a space has been added)
and last here
|rdf| : |someClass|)
Smartparen relies on syntax tables for motion and categorizing symbols.
Its author pointed me to the syntax class of ?|, and I actually wonder in CL
if ?| shouldn't be part of the symbol rather than a string delimiter.
In CL standard syntax, it is also used in multi lines comments
#| ... |#
There maybe other uses I don't remember.

Fabrice

[-- Attachment #2: Type: text/html, Size: 1277 bytes --]

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

* Re: Lisp mode syntax table
  2014-02-18  0:19     ` Stefan Monnier
  2014-02-18  5:53       ` Fabrice Popineau
@ 2014-02-18  6:02       ` Fabrice Popineau
  1 sibling, 0 replies; 8+ messages in thread
From: Fabrice Popineau @ 2014-02-18  6:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

>
>
> Might be a problem in smartparen.  What does it do that you dislike?
>
>
> The problem may not be the class of ?| per se, but the interaction with ?:
.
The whole thing |rdf|:|someClass| should be considered as a symbol.
At the moment, using smartparen to push a ?) through this symbol,
you start by putting it here :
|rdf|):|someClass|
then here
|rdf| :)|someParen|
(notice that a space has been added)
and last here
|rdf| : |someClass|)
Smartparen relies on syntax tables for motion and categorizing symbols.
Its author pointed me to the syntax class of ?|, and I actually wonder in CL
if ?| shouldn't be part of the symbol rather than a string delimiter.
In CL standard syntax, it is also used in multi lines comments
#| ... |#
There maybe other uses I don't remember.

Fabrice

[-- Attachment #2: Type: text/html, Size: 1277 bytes --]

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

* Re: Lisp mode syntax table
  2014-02-18  5:53       ` Fabrice Popineau
@ 2014-02-18 14:00         ` Stefan Monnier
  2014-02-18 19:34           ` Fabrice Popineau
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-02-18 14:00 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Emacs developers

> The problem may not be the class of ?| per se, but the interaction with ?:
> The whole thing |rdf|:|someClass| should be considered as a symbol.

Right, that is something Emacs syntax tables can't currently express.

> At the moment, using smartparen to push a ?) through this symbol,
> you start by putting it here :
> |rdf|):|someClass|

I think this step is largely unavoidable: your symbol is not
syntactically atomic, instead it has structure.  To avoid this step,
Emacs would need to understand that the ":" infix operator can't take
a parenthesized expression on its left hand side.

> then here
> |rdf| :)|someParen|

This step OTOH is definitely avoidable.  E.g. SMIE's forward-sexp would
know to skip ":|someClass|" rather than just ":".

> (notice that a space has been added)

Seems like a misfeature of smartparen.

> if ?| shouldn't be part of the symbol rather than a string delimiter.

As mentioned, it has string syntax for things like |)| and | |.

> In CL standard syntax, it is also used in multi lines comments
> #| ... |#

Yes, Emacs understands those, IIRC,


        Stefan



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

* Re: Lisp mode syntax table
  2014-02-18 14:00         ` Stefan Monnier
@ 2014-02-18 19:34           ` Fabrice Popineau
  0 siblings, 0 replies; 8+ messages in thread
From: Fabrice Popineau @ 2014-02-18 19:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

2014-02-18 15:00 GMT+01:00 Stefan Monnier <monnier@iro.umontreal.ca>:

> > The problem may not be the class of ?| per se, but the interaction with
> ?:
> > The whole thing |rdf|:|someClass| should be considered as a symbol.
>
> Right, that is something Emacs syntax tables can't currently express.
>
>
Ok, I think I got it.


> As mentioned, it has string syntax for things like |)| and | |.
>
>
Something like this would fix my case
  (modify-syntax-entry ?\| "_ 23bn" lisp-mode-syntax-table)
but fail on the ones you mention.
Right paren is weird in an atom name, but it may be easy to put spaces in
it.

Thanks,

Fabrice

[-- Attachment #2: Type: text/html, Size: 1434 bytes --]

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

end of thread, other threads:[~2014-02-18 19:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-17 10:43 Lisp mode syntax table Fabrice Popineau
2014-02-17 20:19 ` Stefan Monnier
2014-02-17 22:10   ` Fabrice Popineau
2014-02-18  0:19     ` Stefan Monnier
2014-02-18  5:53       ` Fabrice Popineau
2014-02-18 14:00         ` Stefan Monnier
2014-02-18 19:34           ` Fabrice Popineau
2014-02-18  6:02       ` Fabrice Popineau

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).