31

In emacs, especially when ssh'ed into a remote machine, there's a delay between when I type a closing quotation mark and when emacs updates the syntax-highlighting to reflect that change. For a few seconds, all of the text after my quotation is highlighted as if it were part of the quotation. Usually this is fine, but sometimes I'd rather not wait. Is there a way to tell emacs to "re-highlight everything right now"?

davidreedernst
  • 485
  • 6
  • 11

1 Answers1

34

Yes. The emacs command is M-x font-lock-fontify-buffer if I recall it right. You can bind it to a key sequence if it's not already bound in your mode.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
Antti Huima
  • 25,136
  • 3
  • 52
  • 71
  • That's it!! Thanks! I feel a bit foolish that for all the searching I did on "syntax-highlighting" and things like that that I never searched for the native emacs "font-lock". Thanks for the help! – davidreedernst Apr 12 '11 at 12:34
  • 1
    Useful! I had been doing `C-u 2 M-x font-lock-mode` to accomplish the same thing. – jdd Apr 12 '11 at 13:40
  • You may also look at [this post](http://stackoverflow.com/questions/7982971/howto-force-emacs-recolor/12935005#12935005). – Andreas Spindler Oct 17 '12 at 13:07
  • For whatever reason, I have a .pl script that refuses to open with perl syntax highlighting. Others open just fine. I can't find any edit I made that would suggest the reason this is happening. This solution resolves the problem on a per open basis. Is there any way to force the syntax highlighting automatically so I don't have to do anything every time I open this file? – hepcat72 Dec 07 '15 at 15:57