From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: suvayu ali Newsgroups: gmane.emacs.help Subject: Defining and using custom faces and keywords Date: Mon, 19 Mar 2012 13:38:02 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1332160742 3926 80.91.229.3 (19 Mar 2012 12:39:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 19 Mar 2012 12:39:02 +0000 (UTC) To: Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 19 13:38:59 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S9brV-0003Vn-0M for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Mar 2012 13:38:57 +0100 Original-Received: from localhost ([::1]:46025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9brU-00021h-BA for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Mar 2012 08:38:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9brK-00021O-Ru for help-gnu-emacs@gnu.org; Mon, 19 Mar 2012 08:38:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9bqz-0002it-KO for help-gnu-emacs@gnu.org; Mon, 19 Mar 2012 08:38:46 -0400 Original-Received: from mail-yw0-f41.google.com ([209.85.213.41]:63006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9bqz-0002iQ-DF for help-gnu-emacs@gnu.org; Mon, 19 Mar 2012 08:38:25 -0400 Original-Received: by yhr47 with SMTP id 47so6397321yhr.0 for ; Mon, 19 Mar 2012 05:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=ej2yIn5vIzIgj3/Lg6XcMSn5Zezd272jxgbw0ZkQGBw=; b=rDVrtTqvfF9nWNaWX6lUjOBhuTCPQpNHXi9tf2kLRGaA2r1iyjPN9JgFj8hL2MRFCz ri6SxZSYHyMEPspoK18ATSpXXt7NCTyg7AkaencX8nRw1sEYkrdVwQmU/lcoqvFd52KS 6MMf2hPcCeUqNe9HjXHE4i45AlMlPkoEp47N2dsBaEsgqLcXpNLbhcop4w5jTRhz+Yu5 EcJZ/O4wLqhOQ1wFdi6lZBfdADVJ5aNTH+N9JE/FZxec88Vl30tyKdZxR6+cIR8sTdQg tel0/N1vhIpnDSg33ztzhHOKANMTxPawdAELsy3nr8/Wo24h1UopfUYTNtDTtXqPDPyd tbQw== Original-Received: by 10.60.7.200 with SMTP id l8mr13431915oea.52.1332160702754; Mon, 19 Mar 2012 05:38:22 -0700 (PDT) Original-Received: by 10.60.20.104 with HTTP; Mon, 19 Mar 2012 05:38:02 -0700 (PDT) X-Google-Sender-Auth: sdo1gKK-KLp3PlUqOGZ82uO3stY X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84051 Archived-At: Hi, I wanted to add custom keywords and highlight them with my custom face on all buffers. So I tried something like this. ;; font-lock customisations (defface font-lock-global-todo-face '((t (:background "royalblue4" :foreground "thistle" :weight bold))) "Face for the TODO keyword globally." :group 'font-lock-faces) (add-hook 'find-file-hook (lambda () (font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend))) (font-lock-add-keywords nil '(("\\<\\(TODO\\):" 1 font-lock-global-todo-face prepend)))) (font-lock-add-keywords nil '(("\\<\\(NB\\):" 1 font-lock-global-todo-face prepend)))) I was expecting FIXME: to be displayed with font-lock-warning-face in all buffers and TODO: and NB: to be displayed with font-lock-global-todo-face. However only FIXME: is displayed as expected. When I check the value of font-lock-global-todo-face with customize-face, I see the correct value with the sample text displayed as I expect. What could be going wrong here? Am I missing any steps in defining my custom face? Thanks in advance. -- Suvayu Open source is the future. It sets us free.