I switched from the default theme to wombat and now the current line is highlighted and underlined.

With the default theme, it is only highlighted

My init.el file has:

(global-hl-line-mode 1)

How do I only highlight the current line and not underline it while changing themes ?


In this case wombat modifies the highlight face (which hl-line inherits from), but the theme does not modify hl-line itself. So you'll need to decide which face you actually want to adjust.

Edit the theme:

  • M-x custom-theme-visit-theme RET wombat RET
  • Expand the Highlight face.
  • Edit out the :underline t
  • Click on "Save Theme"

Or you could leave that face, and add theme support for the hl-line face:

  • M-x custom-theme-visit-theme RET wombat RET
  • Select "Insert Additional Face" and enter hl-line
  • Expand that and select "Show All Attributes"
  • Tick "Underline" and set its value to "Off" if necessary
  • Click on "Save Theme"

Alternatively, leave the theme and just customize the highlight (or hl-line) face to ensure underlining is off:

  • M-x customize-face RET highlight RET
    • or hl-line, if you only want to affect that
  • Select "Show All Attributes"
  • Tick "Underline", set its value to "Off" if necessary, and click "Apply and Save"
  • You may wish to un-tick other attributes of that face, should they conflict with your theme.
  • Thanks for the detailed explanation. The alternate option is better IMO – Saurabh Jul 6 '19 at 10:03
  • It does depend a bit on your usage. I found that customizing the hl-line face directly (using the alternative/latter method) worked well with this theme, but customizing highlight meant the colours clashed badly with the theme -- but removing that colour would affect other themes as well (e.g. no colour highlight at all in the default theme). There are pros and cons either way. – phils Jul 6 '19 at 10:13

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.