Path: utzoo!attcan!uunet!husc6!cs.utexas.edu!sm.unisys.com!ism780c!mikep From: mikep@ism780c.isc.com (Michael A. Petonic) Newsgroups: comp.editors Subject: Re: vi vs. emacs Message-ID: <12646@ism780c.isc.com> Date: 5 Aug 88 21:05:34 GMT References: <16697@brl-adm.ARPA> <12496@ism780c.isc.com> <1186@ficc.UUCP> <12604@ism780c.isc.com> <715@buengc.BU.EDU> Reply-To: mikep@ism780c.UUCP (Michael A. Petonic) Organization: Interactive Systems Corp., Santa Monica CA Lines: 35 In article <715@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: >In article <12604@ism780c.isc.com> mikep@ism780c.UUCP (Michael A. Petonic) writes: >>In article <1186@ficc.UUCP> peter@ficc.UUCP (Peter da Silva) writes: >> >That's why I generally yank to a pattern. For example, "ay/^}^[ is a favorite >> >of mine. Also, how do you do >>% in Emacs? >> >>Well, you could write a lisp function to do it... > >You gotta be kidding! > >Go into recursive hades for eternity just to do yank'n'stuff? > >Emacs is losing its edge... Come, come. Look at the following function to do exactly what is needed. And, it even prompts for the parameters (unlike VI). It isn't that hard. Plus, before using Emacs, it had been 3 years since I used lisp. I'm rusty, but it's easy writing useful code. Which just goes to show you that in Emacs, if you don't have the function, you can write one. Can you read News inside of Emacs? [ I could go on forever... ]. Anyway, this function doesn't use recursion... ;; Function to yank to a regular expression. (defun yank-to-re (reg re) "Yank into REG from the point until the point where RE is found." (interactive "cYank into register :\nsRegular expression :") (let ((ppoint (point))) (if (re-search-forward re) (set-register reg (buffer-substring (point) ppoint))))) -MikeP -- Michael A. Petonic mikep@ism780c.isc.com ``When was the last time you dug a ditch, baby?''