From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jan Newsgroups: gmane.emacs.help Subject: Re: How do I get emacs to highlight subroutine calls in c-mode. Date: 12 Oct 2003 14:26:13 -0700 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1065932268 22739 80.91.224.253 (12 Oct 2003 04:17:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 12 Oct 2003 04:17:48 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 12 06:17:47 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A8Xfv-0003ib-00 for ; Sun, 12 Oct 2003 06:17:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A8Xeu-0004tj-Bu for geh-help-gnu-emacs@m.gmane.org; Sun, 12 Oct 2003 00:16:44 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1A8Xeh-0004tb-6k for help-gnu-emacs@gnu.org; Sun, 12 Oct 2003 00:16:31 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1A8XeB-0004P6-15 for help-gnu-emacs@gnu.org; Sun, 12 Oct 2003 00:16:30 -0400 Original-Received: from [210.50.76.52] (helo=smtp02.syd.iprimus.net.au) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A8Xe9-0004Lm-Pb for help-gnu-emacs@gnu.org; Sun, 12 Oct 2003 00:15:58 -0400 Original-Received: from ABE (210.50.172.39) by smtp02.syd.iprimus.net.au (7.0.018) id 3F6F6FF00078034F for help-gnu-emacs@gnu.org; Sun, 12 Oct 2003 14:15:56 +1000 Original-To: help-gnu-emacs@gnu.org In-Reply-To: Original-Lines: 37 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13145 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13145 lawrence mitchell writes: > > (bind-hook c-mode-hook > ^^^^^^^^^^^^^^^^^^^^^ > You probably meant: > > (add-hook 'c-mode-hook > > > (font-lock-add-keywords nil > > '(("\\<\\(\\sw+\\) ?(" 1 font-lock-function-call-face))) t)) Yes, sorry, I didn't test the code I posted, I just extracted the relevant looking parts from my init files and accidentally included my bind-hook macro. Here is a tested version ;; turn on font lock with maximum decoration (global-font-lock-mode t) (setq font-lock-maximum-decoration t) (require 'font-lock) ;; create a face for function calls (defface font-lock-function-call-face '((t (:foreground "DarkBlue"))) "Font Lock mode face used to highlight function calls." :group 'font-lock-highlighting-faces) (defvar font-lock-function-call-face 'font-lock-function-call-face) ;; add it to the font lock tables (add-hook 'c-mode-hook (lambda () (font-lock-add-keywords nil '(("\\<\\(\\sw+\\) ?(" 1 font-lock-function-call-face)) t))) -- jan