Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!bronze!copper!templon From: templon@copper.ucs.indiana.edu (jeffrey templon) Newsgroups: comp.text.tex Subject: prefix function (was Re: emacs tex-mode.el) Message-ID: <1991May24.060503.10057@bronze.ucs.indiana.edu> Date: 24 May 91 06:05:03 GMT References: <1991May16.152416.17303@unibi.uni-bielefeld.de> Sender: news@bronze.ucs.indiana.edu (USENET News System) Organization: Indiana University, Bloomington Lines: 22 In article <16491@helios.TAMU.EDU> jdm5548@tamsun.tamu.edu (James Darrell McCauley) writes: >Perhaps some of you lispers and TeXies could add a function to >tex-mode.el: TeX-comment-region (and possibly TeX-uncomment-region) >so that it would insert %'s. > Try the following, 'prefix-region'. It is very general, so you can comment out C code, TeX, Fortran, mail excerpts, etc. etc. Just specify '%' for the prefix-string. JT (defun prefix-region (point mark string) "Prefix the region between POINT and MARK with STRING." (interactive "*r\nsPrefix: ") (save-excursion (save-restriction (narrow-to-region point mark) (goto-char point) (replace-regexp "^" string))))