unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: "Clément Pit--Claudel" <clement.pit@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: How does one set up a syntax table for (* and //?
Date: Wed, 11 Jan 2017 20:19:52 -0500	[thread overview]
Message-ID: <CAM-tV-8Mw1s5nTjFn4s1JyQXRxVUuZJB4FOApDP+C1YsPJGMgA@mail.gmail.com> (raw)
In-Reply-To: <d54d1cbb-8809-8c83-215e-43971d8f6107@gmail.com>

On Wed, Jan 11, 2017 at 10:44 AM, Clément Pit--Claudel
<clement.pit@gmail.com> 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.



  reply	other threads:[~2017-01-12  1:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 15:44 How does one set up a syntax table for (* and //? Clément Pit--Claudel
2017-01-12  1:19 ` Noam Postavsky [this message]
2017-01-12  1:31   ` Clément Pit--Claudel
2017-01-12 13:55     ` Stefan Monnier
2017-01-13  1:33       ` Clément Pit--Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM-tV-8Mw1s5nTjFn4s1JyQXRxVUuZJB4FOApDP+C1YsPJGMgA@mail.gmail.com \
    --to=npostavs@users.sourceforge.net \
    --cc=clement.pit@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).