[gnu.emacs] list and edit lines containing a string?

jiang@hbar.rice.edu (Jun Jiang) (03/01/90)

I posted one article several days ago asking for a macro which can
list and edit lines containing a certain string.  I got serveral
responses, which inspired me to write down the following code.  I
tested for some buffers and it seems to work fine.  I post it here
just in case someone might be interested. 

-------------------------------------------------------------------

(defun select-lines-begining-with (regexp)
  "Selects lines which contain a certain string and then edit these lines."
  (interactive "sSelect lines begining with: ")
  (outline-mode)
  (setq outline-regexp regexp)
  (hide-body)
  )

(defun select-lines-end ()
  "End the select-line editting, and return to the previous buffer."
  (interactive)
  (show-all)
  (normal-mode)
  )

(define-key global-map "\C-c\C-a\C-l" 'select-lines-begining-with)
(define-key global-map "\C-c\C-a\C-e" 'select-lines-end)