Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating font-lock keywords in emacs without major mode reload

I am doing small modification to SLIME, so that I can get all currently loaded symbols from Lisp, analyze them and make font-lock fontify them.

I managed to do all these steps, but I have a small problem - when keyword list changes in font-lock the buffer is not updated unless you restart the major lisp-mode. I don't want to restart lisp-mode every time I update keywords, because I have several hooks on lisp-mode that I want to run only when I load the file for the first time.

Is there an other way to update font-lock so it reads all then new keywords and fontifies the buffer accordingly? Switching off font-lock and using font-lock-fontify-buffer does not do the trick.

UPD: Added bounty - the question is still up. I need a way to reload font-lock keyword without reloading major mode.

like image 528
freiksenet Avatar asked Sep 16 '09 09:09

freiksenet


1 Answers

Ok, how about this instead:

(defun my-font-lock-restart ()
  (interactive)
  (setq font-lock-mode-major-mode nil)
  (font-lock-fontify-buffer))
like image 172
scottfrazer Avatar answered Oct 05 '22 08:10

scottfrazer