When I open the Linux Kernel code, my default indentation conflicts with the desired formatting of the Kernel. I use Emacs Prelude, so I added the settings from this link to my
c-mode-common-hook. I constrain the indentation only to the Kernel code base by checking the path of the opened file, as they did on the link.
However, one problem remained. Since the Kernel codebase uses tabs and my global
whitespace-style is set to
'(face tabs empty trailing lines-tail), a bunch of whitespaces in the Kernel code are highlighted. How can I disable tab highlighting within my
Note that I still want to keep highlighting in other buffers that are not the part of the Kernel codebase.
Update: It looks like setting buffer-local variable does not solve the problem. If I do:
(setq-local whitespace-style (remq 'tabs whitespace-style)
c-mode-common-hook, it does correctly set the buffer-local variable. I can check it by doing
M-: whitespace-style in a Kernel code buffer (it shows the new value I set). However, the buffer still highlights the tabs. It is only when I do
M-x whitespace-mode once to disable it, and once more to enable it again that the highlight actually disappears. Unluckily, if I add two
c-mode-common-hook after setting the buffer-local variable, it does not have the same effect as when I call it with
M-x once the buffer is fully initialized.