[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
font-lock-keywords and lines containing comments / quotes
From: |
Erik Iverson |
Subject: |
font-lock-keywords and lines containing comments / quotes |
Date: |
Thu, 25 Feb 2010 19:57:45 -0600 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
Hello,
I am trying to learn things about font-lock-mode, and am needing help
understanding the following behavior. To see what I am confused about, create a
buffer in emacs-lisp mode (or just use *scratch*) and define the following:
;; syntax highlight lines that start with a "*" in the current buffer
(font-lock-add-keywords nil
'(("^\\*\\{1\\}.*" . font-lock-keyword-face)))
Now, with the above defined, paste (or type out to see the effect in action) the
following lines starting with * in the same buffer, which will demonstrate what
I would like to achieve, and what is going wrong...
* this is highlighted, great!
* so is this, until I type a ; comment
* similiar here, until I type a "quote"
As soon as I type the ; or " characters, the previous part of the line becomes
"normal" and the comment or quote appears as it should. I would like for the
initial part of the line to remain highlighted though.
Obviously I am missing something simple(?) here, but I am having a hard time
figuring out how the typical major-modes (e.g., emacs-lisp) handle this case.
Any hints?
Hopefully this was clear! I am using Emacs 23 under Linux.
Best Regards,
Erik Iverson
- font-lock-keywords and lines containing comments / quotes,
Erik Iverson <=