antonj / Highlight-Indentation-for-Emacs

Minor modes to highlight indentation guides in emacs.
467 stars 56 forks source link

not responding to file local variables #28

Closed hotpxl closed 9 years ago

hotpxl commented 9 years ago

As an example, by default my c-basic-offset is 4, but in a source file I changed my local variable value to 2 (as a first line comment). But as it turns out, highlight-indentation-mode is invoked before local variables are evaluated, and it will set offset to 4. Could you make it respond to local variable changes or suggest a workaround?

hotpxl commented 9 years ago

never mind, i added the following to .emacs

(add-hook 'prog-mode-hook 'deferred-highlight-indentation-mode)
(defun deferred-highlight-indentation-mode ()
  "Run highlight-indentation-mode after reading local variables."
  (add-hook 'hack-local-variables-hook
            (lambda () (highlight-indentation-mode))))