From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Why call font-lock-add-keywords in a mode hook? Date: Tue, 26 Jan 2016 08:04:16 -0500 Message-ID: References: <878u3ec6xk.fsf@mbork.pl> <87fuxkbu6f.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1453813486 21347 80.91.229.3 (26 Jan 2016 13:04:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jan 2016 13:04:46 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 26 14:04:38 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 1aO3IT-0002AI-GU for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jan 2016 14:04:37 +0100 Original-Received: from localhost ([::1]:43689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO3IS-0008AY-Ti for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jan 2016 08:04:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO3IG-0008AB-VF for help-gnu-emacs@gnu.org; Tue, 26 Jan 2016 08:04:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aO3IB-0003NX-Tu for help-gnu-emacs@gnu.org; Tue, 26 Jan 2016 08:04:24 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:26742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aO3IB-0003NJ-P0 for help-gnu-emacs@gnu.org; Tue, 26 Jan 2016 08:04:19 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AsEwA731xV/zh9oWxcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIxALDiYSFBgNJIg3CM8jAQEBBwEBAQEeizqFBQeELQWMMIwLmwSBRSOBZoIwIIJ4AQEB X-IPAS-Result: A0AsEwA731xV/zh9oWxcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIxALDiYSFBgNJIg3CM8jAQEBBwEBAQEeizqFBQeELQWMMIwLmwSBRSOBZoIwIIJ4AQEB X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="191408484" Original-Received: from 108-161-125-56.dsl.teksavvy.com (HELO ceviche.home) ([108.161.125.56]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Jan 2016 08:04:16 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 23F3C6621A; Tue, 26 Jan 2016 08:04:16 -0500 (EST) In-Reply-To: <87fuxkbu6f.fsf@mbork.pl> (Marcin Borkowski's message of "Tue, 26 Jan 2016 09:51:04 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:108866 Archived-At: >>> My question: why would I want to call this function in a hook if I can >>> specify the mode in its invocation? >> Because the other use is fundamentally unclean, requiring >> a re-implementation of major-mode's inheritance, whereas you get it for >> free if you use nil for `mode' and call it from the mode's hook instead. > Ah, so that means that if I use a non-nil value for the `mode' argument, > say x-mode, and launch a buffer in y-mode, which derives from x-mode, > then I won't have my keywords there? Yes (unless someone wrote the extra code to try and handle this case). Stefan