[comp.emacs] how can I cluster undos

mnl@idtsun.e-technik.th-darmstadt.de (Michael@mitvma.mit.edu N. Lipp) (01/10/91)

Hello,

I wrote this little function that comments out a region in a TeX Text:

(defun TeX-comment-out-region ()
  "Prepends a % to all lines in the region"
  (interactive)
  (save-excursion
    (save-restriction
      (narrow-to-region (region-beginning) (- (region-end) 1))
      (goto-char (point-min))
      (replace-regexp "^" "% "))))

After calling this, I would like to make one (1) undo to undo the
effect of the command. Just like supercite allows you to throw away
the complete citation that it inserted. However, inserting
undo-boundary has no effect. I suppose replace-regexp does an
undo-boundary before each replacement. Can this be changed? Any
suggestions?

(Please reply by mail; I'm not too sure about my link to this list.)

Thanks

    Michael

-----------------,------------------------------,------------------------------
Michael N. Lipp  !  Institut fuer Datentechnik  !  Phone: 49-6151-163776
                 !  Merckstr. 25     ,----------'  Fax:   49-6151-164976
                 !  D-6100 Darmstadt ! E-Mail:        xdatmnlx@ddathd21.bitnet
                 !  (Germany)        !    mnl@idtsun.e-technik.th-darmstadt.de
-----------------'-------------------'-----------------------------------------