help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Comment syntax


From: Alex Branham
Subject: Re: Comment syntax
Date: Fri, 28 Jun 2019 08:20:05 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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



reply via email to

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