[Top][All Lists]

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

Re: How does one set up a syntax table for (* and //?

From: Clément Pit--Claudel
Subject: Re: How does one set up a syntax table for (* and //?
Date: Wed, 11 Jan 2017 20:31:44 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 2017-01-11 20:19, Noam Postavsky wrote:
> On Wed, Jan 11, 2017 at 10:44 AM, Clément Pit--Claudel
> <address@hidden> wrote:
>> As far as I can tell from the docs, the following syntax table should 
>> recognize // … line comments and nestable (* … *) comments properly:
>>     (defvar example-syntax-table
>>       (let ((table (make-syntax-table)))
>>         (modify-syntax-entry ?*  ". 23" table)
>>         (modify-syntax-entry ?/  ". 12c" table)
>>         (modify-syntax-entry ?\n  "> c" table)
>>         (modify-syntax-entry ?\( "()1n" table)
>>         (modify-syntax-entry ?\) ")(4n" table)
>>         table))
> [...]
>> In this example, the last line (“which incorrectly extends past the 
>> newline?”), is considered to be a comment, because the sequence "(/" is 
>> treated as a multiline comment opener.
> You don't want "a" style comment chars combining with "c" style
> comment chars. Unfortunately, Emacs doesn't implement that. I think
> you'll have to implement these kind of comments with a
> syntax-propertize-function.

Yeah, that's what I was afraid of.

Is there code that depends on this (a mixing with c)? If not, could we consider 
changing the semantics of "c" instead? This mixing isn't clear from the 
documentation, AFAICT.

I guess such a change would break the hypothetical situation in which one would 
need to be able to say that a character is an opener for both "a" and "c", but 
a closer for only "c", though.


Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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