ELisp regexp: match group if followed by other regexp

I am writing a major Emacs mode for a basic language I am implementing. I am wanting to highlight syntax for method calls where the method name is checked by [a-z][^()]* but only when followed by ([^)]). How would I define a regular expression which would match the first part if followed by the second part, but not highlight the second part?


Try this:

(font-lock-add-keywords 'my-mode
  1 font-lock-function-name-face t)))

The 1 says to apply the highlight to the first subexpression.

Note: I added a \\b to make it match only when the [a-z] begins a word (otherwise Dude() would have the ude highlighted), and I added a * in the last set of parens b/c it seemed like it was missing.

I tested this in c++-mode.

Documentation for font-lock-add-keywords and other font lock things can be found here.

Need Your Help

Any news on how to pass a hash as value in a `hidden_field_tag`?

ruby-on-rails ruby ruby-on-rails-4 hash hidden-field

I am using RoR 4.1.1 and I am trying to pass a hash as value in a hidden_field_tag and then to parse that hash in controllers the right way.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.