From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Why call font-lock-add-keywords in a mode hook? Date: Mon, 25 Jan 2016 11:03:19 +0100 Message-ID: <878u3ec6xk.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1453716388 21020 80.91.229.3 (25 Jan 2016 10:06:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2016 10:06:28 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 25 11:06:21 2016 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 1aNe2O-0003YG-MU for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Jan 2016 11:06:20 +0100 Original-Received: from localhost ([::1]:36864 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNe2O-0007xp-4x for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Jan 2016 05:06:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNdzf-000475-6p for help-gnu-emacs@gnu.org; Mon, 25 Jan 2016 05:03:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNdzc-0005Dn-1T for help-gnu-emacs@gnu.org; Mon, 25 Jan 2016 05:03:31 -0500 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:50527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNdzb-0005Dh-Qb for help-gnu-emacs@gnu.org; Mon, 25 Jan 2016 05:03:27 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 18BF48F201A for ; Mon, 25 Jan 2016 11:03:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P-dSTROKftwt for ; Mon, 25 Jan 2016 11:03:23 +0100 (CET) Original-Received: from localhost (unknown [109.232.24.28]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 4BA688F2017 for ; Mon, 25 Jan 2016 11:03:23 +0100 (CET) User-agent: mu4e 0.9.13; emacs 25.1.50.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2a01:5e00:2:52::8 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:108842 Archived-At: Hi list, this I found in the manual: --8<---------------cut here---------------start------------->8--- -- Function: font-lock-add-keywords mode keywords &optional how This function adds highlighting KEYWORDS, for the current buffer or for major mode MODE. The argument KEYWORDS should be a list with the same format as the variable =E2=80=98font-lock-keywords=E2=80=99= . If MODE is a symbol which is a major mode command name, such as =E2=80=98c-mode=E2=80=99, the effect is that enabling Font Lock mode= in MODE will add KEYWORDS to =E2=80=98font-lock-keywords=E2=80=99. Calling with = a non-=E2=80=98nil=E2=80=99 value of MODE is correct only in your =E2=80=98~/.emacs=E2=80=99 fil= e. If MODE is =E2=80=98nil=E2=80=99, this function adds KEYWORDS to =E2=80=98font-lock-keywords=E2=80=99 in the current buffer. This wa= y of calling =E2=80=98font-lock-add-keywords=E2=80=99 is usually used in mode hoo= k functions. --8<---------------cut here---------------end--------------->8--- My question: why would I want to call this function in a hook if I can specify the mode in its invocation? (Assuming that I use it in my init.el, of course.) TIA, --=20 Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University