3

In pretty much every mode, whenever the word 'fix' occurs, whether its in a comment or not, it gets highlighted in a very visible way. I'm not sure what's causing this, and would like to turn it off. How do I do that?

  • Can you try M-x unhighlight-regexp and choose one from the possibilities ? – Ehvince Nov 7 '14 at 9:44
3

What you are seeing is probably a font lock customization that one can add to their init.el.

I have the following that highlights the occurrences of FIXME, TODO and BUG in font-lock-warning-face face. But I have bound this to happen only in a particular major mode hook (i.e. only when a particular major mode is active).

 
(font-lock-add-keywords nil '(("\\b\\(FIXME\\|TODO\\|BUG\\)\\b" 1 font-lock-warning-face t)))

My gut feeling is that you have a similar (font-lock-add-keywords nil '(("\\b\\(FIX\\|... statement somewhere in your init.el.

I would do a recursive grep of FIX\\\\ in the emacs setup folder ( which usually is ~/.emacs.d ) to find the location of that statement.

  • And if you do not want such highlighting everywhere, then don't make it global. Just put the font-lock-add-keywords sexp on mode hooks for modes where you really want it. Font lock is designed to be mode-specific, in general. – Drew Nov 7 '14 at 22:49
6

Put point (the cursor) on the word fix and do C-u C-x = (what-cursor-position). In the buffer that comes up, look for a section that looks like this:

There are text properties here:
  face                 font-lock-comment-face
  fontified            t

Move point to whatever it says instead of font-lock-comment-face (you can use TAB to navigate there), and hit RET. You can also click the name of the face with the mouse.

This will bring up a *Help* buffer showing you properties of the face in question. The first line will look something like this:

Face: font-lock-comment-face (sample) (customize this face)

To modify the face, click customize this face. You will probably want to change the "Foreground" and "Background" properties. When you are done, click "Apply and Save" to make the changes permanent.


Here is another way to find out what's going on:

  1. Quit Emacs and start it again via emacs -Q. The -Q flag tells Emacs to refrain from loading any customizations. If fix is not being highlighted any more, this means that the problem is coming from your personal customizations (or from a third-party package you are using).

  2. Recursively bisect your init-file: Start by commenting out half of it, restart Emacs, and see if fix gets highlighted. If it does, you know that the code that's causing the highlighting is in the portion of the code that is currently not commented out (and vice versa). Repeat the process for the portion of the code you know contains the offending code: Comment out half of it, and see if the problem persists. Keep going until you have narrowed the problem down to a small chunk of code. Add the offending code to your question if you need more assistance with it.

    To comment out a chunk of code, put it in a region and hit M-; (bound to comment-dwim by default). If a region is already commented out, you can use the same command to uncomment it.

  • I tried that - it's coming from something called idle-highlight, and the only thing that's set is Inherit: region. I've tried unsetting that, but it seems to have absolutely no effect. – Koz Ross Nov 7 '14 at 8:41
  • @KozRoss Oh -- this idle-highlight? – itsjeyd Nov 7 '14 at 8:45
  • The very same - it's part of the starter-kit which I based my Emacs setup off of. I'd do its stuff by hand, but I've never had issues with it before now. – Koz Ross Nov 7 '14 at 8:47
  • OK, that's a minor mode. So the immediate fix would be to turn it off via M-x idle-highlight-mode RET. – itsjeyd Nov 7 '14 at 8:48
  • I tried that - still the same annoying highlighting. – Koz Ross Nov 7 '14 at 8:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.