[comp.emacs] Block Comment Macros.

bjaspan@ATHENA.MIT.EDU ("Barr3y Jaspan") (01/28/91)

   Date: 21 Jan 91 22:56:09 GMT
   From: usc!samsung!cg-atla!kincaid@elroy.jpl.nasa.gov  (Tom Kincaid )

   Does anybody have a good block comment macro for gnu emacs.

I'm not entirely sure what you are asking about, but I just wrote this
function a few days ago (after two years of saying "gee, I really
ought to write a function that does this...").  Note that if the
region ends on the beginning of a line, only lines up to the PREVIOUS
line are indented.  This is usually what I meant; of course, you can
take that part out.

Barr3y Jaspan, bjaspan@mit.edu


(defun highlight-region (string)
  "Inserts STRING at the beginning of every line in the region."
  (interactive "sString to insert: ")
  (save-excursion
    (if (bolp)
	(forward-line -1))
    (save-restriction 
      (narrow-to-region (point) (mark))
      (goto-char (point-min))
      (replace-regexp "^" string))))