help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] Comment-Copy


From: Wojciech Komornicki
Subject: [h-e-w] Comment-Copy
Date: Fri, 16 Nov 2001 11:33:53 -0600

>>>>> "David" == David Gallucci <address@hidden> writes:

  David> Does anyone have a function to copy a region and insert a commented 
copy of
  David> it just above ( or below ) it? I am modifying a bunch of existing 
code, so
  David> this would be most useful.

Here is something that should do what you want.  I have only tested it
on C/C++ code.  You may get strange behaviour if the beginning and
ending of your region are not at the beginning of lines.

        (defun comment-copy (beg end)
          (interactive "r")
          (goto-char beg)
          (insert (buffer-substring beg end))
          (comment-region beg end))

--
Wojciech Komornicki                                      Dept of Mathematics
address@hidden                                     Hamline University
http://www.hamline.edu/~wnk/                               St Paul, MN 55104
                                                                         USA

The skill of writing is to create a context in which other people can think.
                                                           Edwin Schlossberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]