On Mon, Feb 22, 2016 at 11:29 AM, Clément Pit--Claudel < clement.pit@gmail.com> wrote: > In any case where font-lock-fontified is nil font-lock-fontify-buffer will > properly refontify the whole buffer, but font-lock-flush and font-lock > ensure will not do anything. I don't know what causes that variable to be > nil in the first place, though. I am not sure if this is related. But in order for hi-lock-file-patterns to work in a text-mode buffer, I need to do the below because font-lock-fontified is nil for text-mode (as technically there are no comments or keywords to highlight in that major mode). ;; Enable `hi-lock-mode' in `text-mode' too ;; The hi-lock fontification will not be visible (the `font-lock-keywords' ;; variable will not be updated unless `font-lock-fontified' is already `t'. ;; This was derived by studying the definition of `hi-lock-font-lock-hook' ;; function. (defun modi/hi-lock-enable-in-text-mode () (setq-local font-lock-fontified t)) (add-hook 'text-mode-hook #'modi/hi-lock-enable-in-text-mode) -- Kaushal Modi