* Comment syntax
@ 2019-06-28 2:35 Alex Branham
2019-06-28 12:37 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Alex Branham @ 2019-06-28 2:35 UTC (permalink / raw)
To: help-gnu-emacs
Hello -
I am trying to write Emacs support for a major mode where * (an
asterisk) starts a comment, but only if * is at the beginning of the
line (comments started this way end at the end of the line). I've read
through (info "(elisp) Syntax Flags") about how to support this but
nothing there seems to help (unless I missed something, which is very
possible.) Is there a way to get bol-* recognized as starting a comment?
Any pointers appreciated,
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Comment syntax
2019-06-28 2:35 Comment syntax Alex Branham
@ 2019-06-28 12:37 ` Stefan Monnier
2019-06-28 13:20 ` Alex Branham
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2019-06-28 12:37 UTC (permalink / raw)
To: help-gnu-emacs
> I am trying to write Emacs support for a major mode where * (an
> asterisk) starts a comment, but only if * is at the beginning of the
> line (comments started this way end at the end of the line). I've read
> through (info "(elisp) Syntax Flags") about how to support this but
> nothing there seems to help (unless I missed something, which is very
> possible.) Is there a way to get bol-* recognized as starting a comment?
You need to setup a syntax-propertize-function for that.
E.g.
(setq-local syntax-propertize-function
(syntax-propertize-rules ("^\\*" (0 "<"))))
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Comment syntax
2019-06-28 12:37 ` Stefan Monnier
@ 2019-06-28 13:20 ` Alex Branham
0 siblings, 0 replies; 3+ messages in thread
From: Alex Branham @ 2019-06-28 13:20 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
On Fri 28 Jun 2019 at 08:37, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> I am trying to write Emacs support for a major mode where * (an
>> asterisk) starts a comment, but only if * is at the beginning of the
>> line (comments started this way end at the end of the line). I've read
>> through (info "(elisp) Syntax Flags") about how to support this but
>> nothing there seems to help (unless I missed something, which is very
>> possible.) Is there a way to get bol-* recognized as starting a comment?
>
> You need to setup a syntax-propertize-function for that.
>
> (setq-local syntax-propertize-function
> (syntax-propertize-rules ("^\\*" (0 "<"))))
Thanks, I didn't know about syntax-propertize-rules. This seems make
everything after the asterisk a comment, though, so with this buffer:
* this is a comment
but so is this :-(
I thought that modifying it to:
(setq-local syntax-propertize-function
(syntax-propertize-rules ("^\\*.*$" (0 "<"))))
might work, but that doesn't seem to do the trick either.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-28 13:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28 2:35 Comment syntax Alex Branham
2019-06-28 12:37 ` Stefan Monnier
2019-06-28 13:20 ` Alex Branham
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).