INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to implement comments that always start at the beginning of a line

How to implement comments that always start at the beginning of a line

How to implement comments that always start at the beginning of a line

(OP)
Hi,

I'm writing my own Emacs major mode for a language in with all comments start with an starisk \i]at the beginning of a line[/i]. Unfortunately, I haven't found a way to implement this in the syntax table. Can anybody help me?

Thanks,
Philipp

RE: How to implement comments that always start at the beginning of a line

Well, what do you have so far?

--
http://www.bitmuse.com/

RE: How to implement comments that always start at the beginning of a line

(OP)
Well, I did try to use a two-symbol comment sequence, with the first character starting the coment being a newline, and the 2nd one an asterisk. A newline also ends a comment, so I figured I needed something like this:

(modify-syntax-entry ?\n "> 1" table)
(modify-syntax-entry ?* ". 1" table)

That didn't work, though.

What I'd need would be a character that indicates the beginning of a line, like '^' in regular expressions.

RE: How to implement comments that always start at the beginning of a line

CODE

(modify-syntax-entry ?\n ">1" table)
(modify-syntax-entry ?* ".2" table)

This looks like it should work.  I haven't tried it, though.

--
http://www.bitmuse.com/

RE: How to implement comments that always start at the beginning of a line

(OP)
Sorry, that was actually what I had tried (the ". 1" should actually have been a ". 2" in my last post, my bad).

Somehow that just doesn't do it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close