thx again Eric i still have an issue with this when one of the symbols used to start/end the highlight is used in a sentence, for example using your code: (font-lock-add-keywords 'org-mode '(("-1-\\([^-1-]+\\)-1-" (0 '(:weight ultra-bold :background "#DDFFDD" :foreground "#000000") t)))) if i write this: -1- this is a test of 1x1 to show higlight -1- it will kill the highlight, if i use the same text omitting the '1' it works well, anyway around this issue? i thought it would have matcehd -1- but it seems it matches also just 1 by itself best wishes and thx again Z On Sat, Oct 5, 2013 at 7:42 AM, Eric Abrahamsen wrote: > Xebar Saram writes: > > > Thank you so much Eric > > > > that works well apart from as you said it sometime "spills" over to > > other uneeded lines. any idea of how to limit the number of newlines > > that > > the regexp can match? > > > > really appreciate the help > > The easiest thing would be to add a newline to the list of non-matching > characters, like this: "\\(♩[^♩\n]+♩\\)". That won't match _anything_ > that goes longer than one line, though -- is that what you want? I'm > actually not sure how to make the regexp match a specific number of > newlines without things getting much more complicated... > > > On Fri, Oct 4, 2013 at 12:15 PM, Eric Abrahamsen < > > eric@ericabrahamsen.net> wrote: > > > > Xebar Saram writes: > > > > > Thank you again > > > > > > that works well but i think it dosent cover what i had in org. > > in org > > > i use the ♩ symbol to highlight all the text between the 2 ♩, > > IE > > > > > > ♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code > > the ♩ > > > is highlighted but not the text between, is it possible to do > > achive > > > that with font-lock? > > > > > > i really appreciate your help! > > > > > > z > > > > Yup, it's pretty much the exact same thing, just with a different > > regexp. > > > > (font-lock-add-keywords > > 'org-mode > > '(("\\(♩[^♩]+♩\\)" (0 '(:weight ultra-bold :background "# > > FFBF1E") t)))) > > > > You can use "♩\\([^♩]+\\)♩" instead, if you only want the text > > between > > the symbols to be highlighted. > > > > It might be a good idea to somehow limit the number of newlines > > that > > the regexp can match, I'm not sure. > > > > Yours, > > Eric > > > > > > >