unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Exclamation mark in a syntax table
@ 2019-07-22 17:58 Óscar Fuentes
  2019-07-22 20:20 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Óscar Fuentes @ 2019-07-22 17:58 UTC (permalink / raw)
  To: help-gnu-emacs

On a mode for an internal programming language that considers a leading
`!' as *not* part of the symbol, I put this:

      (modify-syntax-entry ?! "'   " table)

but symbol-at-point for !foo still returns !foo. Furthermore, I see no
way of specifying that a leading ! is an expression prefix but in any
other place it is a symbol constituent.




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

* Re: Exclamation mark in a syntax table
  2019-07-22 17:58 Exclamation mark in a syntax table Óscar Fuentes
@ 2019-07-22 20:20 ` Stefan Monnier
  2019-07-23  1:13   ` Óscar Fuentes
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2019-07-22 20:20 UTC (permalink / raw)
  To: help-gnu-emacs

> but symbol-at-point for !foo still returns !foo. Furthermore, I see no
> way of specifying that a leading ! is an expression prefix but in any
> other place it is a symbol constituent.

You can try a syntax like "_ p".  But it all depends on the details of
what you really want/need.  There's a good chance you'll need to use
syntax-propertize-function to give different syntaxes to those
different cases.


        Stefan




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

* Re: Exclamation mark in a syntax table
  2019-07-22 20:20 ` Stefan Monnier
@ 2019-07-23  1:13   ` Óscar Fuentes
  0 siblings, 0 replies; 3+ messages in thread
From: Óscar Fuentes @ 2019-07-23  1:13 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> but symbol-at-point for !foo still returns !foo. Furthermore, I see no
>> way of specifying that a leading ! is an expression prefix but in any
>> other place it is a symbol constituent.
>
> You can try a syntax like "_ p".  But it all depends on the details of
> what you really want/need.  There's a good chance you'll need to use
> syntax-propertize-function to give different syntaxes to those
> different cases.

syntax-propertize-function looks scary.

As for

(modify-syntax-entry ?! "'   " table)

it works as expected after reverting the buffer. IIRC when I inserted

(modify-syntax-entry ?\? "_   " table)

into the mode's syntax table it didn't require a buffer revert.

Thanks.




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

end of thread, other threads:[~2019-07-23  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-22 17:58 Exclamation mark in a syntax table Óscar Fuentes
2019-07-22 20:20 ` Stefan Monnier
2019-07-23  1:13   ` Óscar Fuentes

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