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?

ph0t0nix
  • 1,119
  • 14
  • 28
Koz Ross
  • 425
  • 3
  • 13

2 Answers2

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.

itsjeyd
  • 14,666
  • 3
  • 59
  • 87
  • 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 07 '14 at 08:41
  • @KozRoss Oh -- this idle-highlight? – itsjeyd Nov 07 '14 at 08: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 07 '14 at 08: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 07 '14 at 08:48
  • I tried that - still the same annoying highlighting. – Koz Ross Nov 07 '14 at 08:49
  • Just to be sure: Did it say "Idle-Highlight mode disabled" in the echo area when you did that? Also, if you are sure that idle-highlight-mode is off, do C-u C-x = again with point on fix. Does it show a different face? – itsjeyd Nov 07 '14 at 08:53
  • Yes, it did say that. It has a thing called font-lock-warning-face. I tried turning all of its stuff off (which includes an inherit and a background), but the text is still highlighted. – Koz Ross Nov 07 '14 at 09:05
  • Not sure if turning everything off is the right way to go. Try to set a custom color for foreground and background. Also, I'm starting to suspect that the highlighting of that specific word might be caused by some other customizations... If setting "Foreground" and "Background" to custom values does not have any effect, quit Emacs and restart it via emacs -Q. Does fix still get highlighted? – itsjeyd Nov 07 '14 at 09:11
  • With emacs -Q, fix no longer gets highlighted. – Koz Ross Nov 07 '14 at 09:40
  • @KozRoss OK, that's good news. The next step is to recursively bisect your init-file: Start by commenting out one half of it, restart Emacs, 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. This process allows you to quickly zero in on the code that is causing the problem. Report back with your findings. – itsjeyd Nov 07 '14 at 09:48
  • @KozRoss 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. – itsjeyd Nov 07 '14 at 09:49
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.

Kaushal Modi
  • 25,651
  • 4
  • 80
  • 183
  • 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 07 '14 at 22:49