Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!nmsu.CSNET!jthomas From: jthomas@nmsu.CSNET Newsgroups: comp.emacs Subject: A regexp for blank lines Message-ID: <8803091028.AA17077@ucbvax.Berkeley.EDU> Date: 8 Mar 88 21:27:02 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 17 (I'm using gnu emacs 18.44.22.) I am trying to write elisp code to remove lines from a buffer. My intent was to remove any lines containing a match for a regular expression, as in: (let ((zap-pattern (read-string "Pattern for lines to remove: "))) (goto-char (point-min)) (while (re-search-forward zap-pattern nil t) (forward-line 0) (kill-line 1))) . I thought I might try to let this eliminate blank lines by trying "^$" for the pattern. But that infinite looped at the end of the buffer (I guess that's reasonable?). "\C-j$" has the same problem. "^\C-j" doesn't loop, but it kills the wrong line given the above code. Is there a way? Jim Thomas jthomas@nmsu.csnet