Emanuel Berg <[email protected]> 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 _______________________________________________ info-gnus-english mailing list [email protected] https://lists.gnu.org/mailman/listinfo/info-gnus-english
