When I the first time enter an org-mode buffer, I get no font lock at all unless I revert-buffer or reopen the file. Even I turn on the debug mode, no error is emit.

How should I debug and fix this?

  • font-lock-mode is globally available in all buffers with the default installation of Emacs. If it is not working in an org-mode buffer, then your init.el / .emacs has something in it that breaks the default behavior. Try to comment out sections of your user configuration, save, and keep restarting Emacs until you find the portion of code that breaks the font-lock in org-mode. – lawlist May 30 '18 at 7:01
  • @lawlist Thank you very much. Following your step, I find that this line (setq orhc-bibtex-cache-file (expand-file-name ".orhc-bibtex-cache" savefile-directory)) killed the font-lock. Strange but I delete the file and everything runs fine. – stackunderflow May 30 '18 at 7:26
  • 1
    I am not familiar with the org-ref library, but a quick Google of orhc-bibtex-cache-file led me there. So, your problem may be traceable to that library and it may be helpful to do some debugging to find out which function, etc. might be the culprit. By preventing the file/variable from being defined, certain functions that rely on testing for the existence of that file cannot do their thing -- i.e., whatever it is that they would do otherwise. – lawlist May 30 '18 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.