From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/17615 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.gnus.user Subject: Re: font-locked Gnus browse server Date: Fri, 15 May 2015 11:06:33 +0200 Message-ID: <87r3qitdk6.fsf@gnu.org> References: <878ucwhw7g.fsf@debian.uxu> <874mngfabn.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1431680819 13994 80.91.229.3 (15 May 2015 09:06:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 May 2015 09:06:59 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Fri May 15 11:06:51 2015 Return-path: Envelope-to: gegu-info-gnus-english@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 1YtBZx-0002Ok-Sv for gegu-info-gnus-english@m.gmane.org; Fri, 15 May 2015 11:06:50 +0200 Original-Received: from localhost ([::1]:58656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBZx-0006m1-31 for gegu-info-gnus-english@m.gmane.org; Fri, 15 May 2015 05:06:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBZu-0006lj-Fd for info-gnus-english@gnu.org; Fri, 15 May 2015 05:06:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtBZq-0004Mb-5X for info-gnus-english@gnu.org; Fri, 15 May 2015 05:06:46 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBZp-0004MQ-Us for info-gnus-english@gnu.org; Fri, 15 May 2015 05:06:42 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YtBZo-0002KT-Li for info-gnus-english@gnu.org; Fri, 15 May 2015 11:06:40 +0200 Original-Received: from 2.160.123.109 ([2.160.123.109]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 May 2015 11:06:40 +0200 Original-Received: from tsdh by 2.160.123.109 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 15 May 2015 11:06:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 51 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2.160.123.109 User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:aD5brUVXxcyjB49j5hXsJR2EzEc= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:17615 Archived-At: Emanuel Berg writes: >> Or you can put your current `font-lock-add-keywords' >> call into your ~/.gnus. Then it would be evaluated >> before gnus-browse-mode was activated. > > It is in an init file and it is evaluated before the > mode is set. For some reason it doesn't kick in > without the explicit call to > `font-lock-fontify-buffer'. That has never been needed > elsewhere in my experience. Ah, yeah, now I see it. I've thought you'd call `font-lock-add-keywords' in the hook but you actually only call `font-lock-fontify-buffer' there. I think the reason why you need to trigger font-locking explicitly using `font-lock-fontify-buffer' (or `font-lock-ensure') is that `gnus-browse-mode' doesn't set `font-lock-defaults' which would be used to initialize `font-lock-keywords'. And that says: ,----[ C-h v nil RET ] | font-lock-keywords is a variable defined in `font-lock.el'. | [...] | A user-level keywords list is what a major mode or the user would | set up. Normally the list would come from `font-lock-defaults'. | through selection of a fontification level and evaluation of any | contained expressions. You can also alter it by calling | `font-lock-add-keywords' or `font-lock-remove-keywords' with MODE = nil. | [...] `---- So calling `font-lock-add-keywords' with MODE = nil will also trigger font-lock, and indeed --8<---------------cut here---------------start------------->8--- (defun th/gnus-browse-mode-init () (font-lock-add-keywords nil '(("^\\(.\\)[[:space:]]+\\([[:digit:]]+\\):[[:space:]]\\(.*\\)" (1 font-lock-keyword-face) (2 font-lock-variable-name-face) (3 font-lock-function-name-face))))) (add-hook 'gnus-browse-mode-hook #'th/gnus-browse-mode-init) --8<---------------cut here---------------end--------------->8--- does work for me. Bye, Tassilo