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

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

Re: Delete comments in region


From: Nikos Apostolakis
Subject: Re: Delete comments in region
Date: Fri, 21 Apr 2006 22:53:24 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Denis Bueno <dbueno@gmail.com> writes:

> Nikos Apostolakis wrote:
>
> I want to *zap* the comment entirely. Delete the comment syntax and
> the text of the comment itself. Not just remove the comment syntax
> around the comment text.
>

Ah! I see.


> ;; the following keys should all be entered in succession, but
> ;; they are commented for ease of viewing
> C-x ( ; start macro
> M-x kill-comment RET C-x )
>
> ;; Then, on the code whose comments need to be zapped:
> C-x e e e e e e ;;; as many e's as necessary

How about

(defun nea-kill-all-comments-in-buffer ()
       "Kill all comments in buffer."
       (interactive)
       (save-excursion
         (beginning-of-buffer)
         (kill-comment 
        (count-lines (point-min) (point-max)))))    

Or slightly more general:

(defun nea-kill-all-comments-in-region (begin end)
       "Kill all comments in region."
       (interactive "r")
       (save-excursion
         (goto-char begin)
       (kill-comment (count-lines begin end))))

Note that this is not really tested.
HTH,
Nikos

>
> -Denis





reply via email to

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