all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Björn Lindqvist" <bjourne@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Font-lock of comments using comment tokens, does it work?
Date: Wed, 3 Jun 2015 18:46:55 +0200	[thread overview]
Message-ID: <CALG+76caZgLOKGTfH98XOOtL3GHRw7=xcRwZQdKo2181kvz9xg@mail.gmail.com> (raw)

Hello emacs,

I have a really complicated font-locking problem I'm trying to solve
for a major mode. It's like I've tried everything but nothing
works. Here is the question I asked on Stack Overflow and got some
help with but it didn't go all the way:

http://stackoverflow.com/questions/29973458/avoid-font-locking-interfering-inside-of-comments

I want to font-lock to understand that two short strings, e.g FOO and
BAR are the comment tokens. The tokens themselves should be
font-locked as comments and everything following them until the end of
line should also be comments.

The problem is that the strings only start comments if they are
free-standing tokens. So on these four lines there are comments:

    random code FOO random comment
    stuff BAR comment "with stuff"
    BAR FOO BAR
    FOO

On these four lines there are NO comments:

    FOObar random come
    BARFOO random code
    random code xyFOOzw
    random code "with string FOO " etc ...

Because the comment tokens are not separate. I'm suspecting that I've
found a limitation in emacs font-locking and that this is impossible
to get completely right. I'd love to be proven wrong though. :)


-- 
mvh/best regards Björn Lindqvist



             reply	other threads:[~2015-06-03 16:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 16:46 Björn Lindqvist [this message]
     [not found] <mailman.4238.1433357678.904.help-gnu-emacs@gnu.org>
2015-06-03 19:11 ` Font-lock of comments using comment tokens, does it work? Stefan Monnier
2015-06-03 23:37   ` Björn Lindqvist
     [not found]   ` <mailman.4244.1433374628.904.help-gnu-emacs@gnu.org>
2015-06-04  3:42     ` Stefan Monnier
2015-06-04 11:10       ` Björn Lindqvist
     [not found]       ` <mailman.4276.1433416248.904.help-gnu-emacs@gnu.org>
2015-06-04 22:11         ` Stefan Monnier
2015-06-05  3:29           ` Björn Lindqvist
2015-06-05  6:53             ` tomas
2015-06-05 19:37               ` Björn Lindqvist
2015-06-07  3:58                 ` Björn Lindqvist
2015-06-07 11:34                   ` tomas

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

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

  git send-email \
    --in-reply-to='CALG+76caZgLOKGTfH98XOOtL3GHRw7=xcRwZQdKo2181kvz9xg@mail.gmail.com' \
    --to=bjourne@gmail.com \
    --cc=help-gnu-emacs@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.