How can I chance an Emacs config setting (let's say "highlighting of current line") that I set in .emacs as (global-hl-line-mode +1), to work for all modes except one.

For example, I want highlighting of current line to be on for all modes except org-mode.

A great solution would be one that would also be applicable to customizing theme to be different by major mode (though file type could work fine for this too).

  • 1
    I answered the first part but of the question but the second one probably has a very different one. Probably you should split this question in two,
    – matteol
    Jun 1, 2018 at 5:53
  • @matteol think you're right, I'll edit to remove that and add a separate question
    – NeuronQ
    Jun 1, 2018 at 6:07

1 Answer 1


Usually you customize a mode adding functions to the mode hook. To disable the hl-line-mode use the following code

(add-hook 'org-mode-hook
          (lambda ()
            (set (make-local-variable 'global-hl-line-mode) nil)))

For more complex cases it's better to define a new function and add it to the hook.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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