Path: utzoo!mnetor!uunet!husc6!rutgers!sri-spam!ames!pasteur!ucbvax!LF-SERVER-2.BBN.COM!jr From: jr@LF-SERVER-2.BBN.COM (John Robinson) Newsgroups: comp.emacs Subject: Re: Need mlisp for "prefix-region" Message-ID: <8801291446.AA18894@ucbvax.Berkeley.EDU> Date: 29 Jan 88 14:18:47 GMT References: <3910015@nucsrl.UUCP> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: jr@BBN.COM Organization: The Internet Lines: 16 Regular expression replacing in GNU emacs will handle this. Here's a sample function: (defun prefix-region () (save-excursion (save-restriction (narrow-to-region (point) (mark)) (goto-char (point-min)) (replace-regexp "^.*$" ">\\&")))) The doubled backslash becomes one in the stored string; the & has to be escaped. Look at the dociumentation for replace-regexp, and in Info under regular expressions. /jr jr@bbn.com or jr@bbn.uucp