info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-locked Gnus browse server


From: Emanuel Berg
Subject: Re: font-locked Gnus browse server
Date: Fri, 15 May 2015 16:07:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Tassilo Horn <tsdh@gnu.org> 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)

> 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.

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]