Is their a way to hide comment whatever the language used?

Like if I'm in cpp mode all /* ... */ should be hide and if I'm on LaTeX mode, all % ... will be hide.

1 Answer 1


The package hide-comnt available from Melpa (now marmalade) can do it:

M-x hide/show-comments-toggle

  • it's a very handy package. thanks for that. Aug 11, 2015 at 8:28
  • Exactly what I wanted. Thank you :) Aug 11, 2015 at 8:29
  • 1
    hide-comnt doesn't seem to be there anymore.
    – nroose
    Apr 29, 2019 at 17:08
  • @nroose see the edit.
    – Name
    Apr 30, 2019 at 5:27
  • There are a few packages out there that attempt this, but hide-comnt is the only one I see that actually makes comments appear to be removed rather than just blanking out the lines and leaving a bunch of unwanted whitespace. Jan 29, 2020 at 20:10

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.