I'm trying to make a function to read a whole buffer and find lines that match with regexp, I think to read the whole buffer and save to list of strings but I read that it's very inefficient. Whats the better form of do this?

1 Answer 1


It is really unclear what you want to do, but if you are looking for an "end in itself" interactive use, then you are probably covered by one of occur et al: e.g., M-x occur RET TODO RET.

If this is a step in a long processing chain, you should start with the sources for the above commands and ask a separate, more specific question.

  • What I want to to it's to find lines in code files to contain the TODO: word.
    – rafaelleru
    Commented Dec 14, 2016 at 16:27
  • @rafaelleru: see edit.
    – sds
    Commented Dec 14, 2016 at 16:33

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.