2

Is there an existing EMACS command to select a block comment? That is, I have

/**
 * A Comment
 */

I want to set the mark ahead of the /** and set the point after */.

I realize there are several ways it can be done, but I don't want to write code if there already is code.

  • Yeah this would be the most useful thing in the world. – cheez Nov 27 '17 at 16:10
  • 1
    There is er/mark-comment in the library expand-region.el. – Tobias Nov 27 '17 at 16:11
  • I knew someone had to have done it. Make this an answer so I can checkmark it. – Charlie Martin Nov 27 '17 at 16:16
1

You can install the package expand-region via package-install. There you find er/mark-comment in er-basic-expansions.el.

It is suggested to bind just er/expand-region to some suitable key sequence.

If you hit this key sequence region is expanded to the current word at first. The region is expanded further and further if you press repeatedly return. If you start with point in a comment one of the expansions is the current comment.

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.