From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/17617 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.gnus.user Subject: Re: font-locked Gnus browse server Date: Sat, 16 May 2015 09:33:11 +0200 Message-ID: <87siaxht8o.fsf@gnu.org> References: <878ucwhw7g.fsf@debian.uxu> <874mngfabn.fsf@debian.uxu> <878ucqgchs.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 1431761625 21632 80.91.229.3 (16 May 2015 07:33:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 May 2015 07:33:45 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sat May 16 09:33:37 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 1YtWbJ-0006Hq-7q for gegu-info-gnus-english@m.gmane.org; Sat, 16 May 2015 09:33:37 +0200 Original-Received: from localhost ([::1]:33854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtWbI-0000Nu-65 for gegu-info-gnus-english@m.gmane.org; Sat, 16 May 2015 03:33:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtWbF-0000Nc-KT for info-gnus-english@gnu.org; Sat, 16 May 2015 03:33:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtWbC-0007Ou-Ds for info-gnus-english@gnu.org; Sat, 16 May 2015 03:33:33 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:54758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtWbC-0007Og-70 for info-gnus-english@gnu.org; Sat, 16 May 2015 03:33:30 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YtWb5-0006AE-1p for info-gnus-english@gnu.org; Sat, 16 May 2015 09:33:23 +0200 Original-Received: from 2.161.114.28 ([2.161.114.28]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 16 May 2015 09:33:23 +0200 Original-Received: from tsdh by 2.161.114.28 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 16 May 2015 09:33:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2.161.114.28 User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:+2ULMBn9SPGNf9t58URkmtUBvfE= 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:17617 Archived-At: Emanuel Berg writes: >> 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'. > > You mean like this? > > (defvar gnus-browse-font-lock-keywords > '(("^K" . font-lock-builtin-face) > ("\\([[:digit:]].*\\):" (1 font-lock-function-name-face)) > ("\\(gmane\\.\\)\\(.*\\)" (1 font-lock-comment-face) > (2 font-lock-variable-name-face) ) > ("\\(gwene\\.\\)\\(.*\\)" (1 font-lock-constant-face) > (2 font-lock-type-face)) )) > > (defun gnus-browse-mode-hook-f () > (set (make-local-variable 'font-lock-defaults) > '(gnus-browse-font-lock-keywords t)) ) > (add-hook 'gnus-browse-mode-hook 'gnus-browse-mode-hook-f) Yes, this could also work. BTW, `font-lock-defaults' is automatically buffer-local, no need to make it so. >> So calling `font-lock-add-keywords' with MODE = nil >> will also trigger font-lock, and indeed ... >> >> th/gnus-browse-mode-init () (font-lock-add-keywords >> nil ... ) >> >> (add-hook 'gnus-browse-mode-hook >> #'th/gnus-browse-mode-init) >> >> does work for me. > > With MODE as nil the font lock is done one the basis > of the current buffer. It is not related to the mode > itself apart from the invocation being placed in the > mode entry hook. This means the keywords have to be > added every time the mode is entered. Yes, but that doesn't make a difference, no? Bye, Tassilo