Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!amdcad!cae780!leadsv!esl!lrs From: lrs@esl.UUCP (Lynn Slater) Newsgroups: comp.emacs Subject: Re: Need mlisp for "prefix-region" Message-ID: <572@esl.UUCP> Date: 25 Feb 88 01:44:54 GMT References: <8802232111.AA14048@icst-cmr.arpa.ARPA> Lines: 52 In-reply-to: rbj@ICST-CMR.ARPA's message of 23 Feb 88 21:11:08 GMT Posting-Front-End: GNU Emacs 18.44.12 of Mon Nov 16 1987 on esl (berkeley-unix) > Mg has a nice function > called "prefix-region" to do that but surprisingly I could not > find an equivalent in GnuEmacs 18.48. I am not sure if this is what you are asking for, but here is my own fix. (defun insert-box (start end text) "Insert a text prefix at a column in all the lines in the region. Called from a program, takes three arguments, START, END, and TEXT. The column is taken from that of START." (interactive "r\nsText To Insert: ") (save-excursion (let (cc) ;; the point-marker stuff is needed to keep the edits from changing ;; where end is (goto-char end) (setq end (point-marker)) (goto-char start) (setq cc (current-column)) (while (< (point) end) ;; modified 2/2/88 ;; I should here check for tab chars (insert text) (forward-line 1) (move-to-column cc)) (move-marker end nil)))) (defun insert-end (start end text) "Insert a text prefix at the end in all the lines in the region. Called from a program, takes three arguments, START, END, and TEXT." (interactive "r\nsText To Insert: ") (save-excursion (let (cc) ;; the point-marker stuff is needed to keep the edits from changing ;; where end is (goto-char end) (setq end (point-marker)) (goto-char start) (end-of-line) (while (< (point) end);; modified 2/2/88 ;; I should here check for tab chars (insert text) (forward-line 1) (end-of-line) ) (move-marker end nil)))) =============================================================== Lynn Slater ESL/TRW (408) 738-2888 x 4482 lrs@esl.COM ===============================================================