1

Suppose you have multiple files which has common lines of code or common matches of a regexp pattern. Is there an "emacs way" to comment/uncomment such specific common lines at once in all files?

I know how to do it with sed or awk, but maybe there is a clever way to do this type of job directly from emacs.

1
  • You may try helm-ag as described here
    – student
    Commented Sep 7, 2022 at 16:04

1 Answer 1

2

I think functionality that comes closest to what you ask for, is provided via the wgrep package, optionally combined with some other package like iedit or multiple-cursors.el. You can search the web for more info about how to use (the combination of) them, or otherwise the answer here might be clear enough already. Personally, I am using Spacemacs, for which I found this video by Jack of Some very useful.

Alternatively, the noccur package as mentioned in the answer here looks useful too.

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.