From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: please help with font-lock-add-keywords Date: Thu, 31 Dec 2009 14:08:46 +0100 Message-ID: <87pr5vcmu9.fsf@thinkpad.tsdh.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262265002 16401 80.91.229.12 (31 Dec 2009 13:10:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2009 13:10:02 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 31 14:09:55 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NQKmn-0005zP-St for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 14:09:54 +0100 Original-Received: from localhost ([127.0.0.1]:58026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQKmo-0004xb-55 for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2009 08:09:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQKmN-0004wv-PJ for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:09:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQKmI-0004uR-3X for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:09:27 -0500 Original-Received: from [199.232.76.173] (port=47487 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQKmH-0004uG-OQ for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:09:21 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:60614) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NQKmG-0004Ze-W7 for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 08:09:21 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1NQKmD-0005pS-3z for help-gnu-emacs@gnu.org; Thu, 31 Dec 2009 14:09:17 +0100 Original-Received: from p54af21f8.dip0.t-ipconnect.de ([84.175.33.248]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Dec 2009 14:09:17 +0100 Original-Received: from tassilo by p54af21f8.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Dec 2009 14:09:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 47 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p54af21f8.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) Cancel-Lock: sha1:Vh5XGKNb6yrjhKG34kuLQMM5xN0= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:70974 Archived-At: bufie writes: Hi! > I'd like to fontify a whole bunch of function names for a project I'm > working on (which uses lisp mode, not emacs-lisp-mode -- for > reference, I'm using GNU emacs 23.1.1). This works for me and highlights any symbol starting with qbb- in the keyword face. --8<---------------cut here---------------start------------->8--- (font-lock-add-keywords 'lisp-mode '(("\\" . font-lock-keyword-face))) --8<---------------cut here---------------end--------------->8--- > (font-lock-add-keywords > 'lisp-mode > '(("\\<\\(qbb-create-image\\|qbb-destroy-image\\)\\>" . > font-lock-keyword-face))) Looks ok to me. > (font-lock-add-keywords > 'lisp-mode > '(("\\<\\qbb-create-image\\)" 2 font-lock-keyword-face t))) ^ I think a paren is missing there. And if there was one, you would like to highlight the first group, so the 2 has to be replaced with 1. > (add-hook 'lisp-mode-hook > (lambda () > (font-lock-add-keywords > nil > '(("\\<\\(qbb-create-image\\|qbb-destroy-image\\)\\>" . > font-lock-keyword-face))))) Looks correct. But when using the ("regexp" . face) form, you can use shy groups for performance reasons, because here you refer to the whole match anyway and not to a group by number. Hm, if your first and last solutions don't work, I'd guess you are not in lisp-mode... Bye, Tassilo