From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikos Apostolakis Newsgroups: gmane.emacs.help Subject: Re: Delete comments in region Date: Fri, 21 Apr 2006 22:53:24 -0400 Message-ID: <87y7xymicb.fsf@sdf.lonestar.org> References: <44497B6E.8090900@gmail.com> <87acaeo1wz.fsf@sdf.lonestar.org> <44498748.9000905@stygian.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1145674443 27330 80.91.229.2 (22 Apr 2006 02:54:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Apr 2006 02:54:03 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 22 04:53:57 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FX8Fq-0007lH-8A for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Apr 2006 04:53:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FX8Fp-0003QU-Qu for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Apr 2006 22:53:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FX8Fe-0003QE-KU for help-gnu-emacs@gnu.org; Fri, 21 Apr 2006 22:53:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FX8Fe-0003Q1-3v for help-gnu-emacs@gnu.org; Fri, 21 Apr 2006 22:53:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FX8Fd-0003Py-Ue for help-gnu-emacs@gnu.org; Fri, 21 Apr 2006 22:53:37 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FX8HK-0003GL-AG for help-gnu-emacs@gnu.org; Fri, 21 Apr 2006 22:55:22 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FX8FY-0007jw-45 for help-gnu-emacs@gnu.org; Sat, 22 Apr 2006 04:53:32 +0200 Original-Received: from user-0cdf430.cable.mindspring.com ([24.215.144.96]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 22 Apr 2006 04:53:32 +0200 Original-Received: from absent by user-0cdf430.cable.mindspring.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 22 Apr 2006 04:53:32 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 45 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: user-0cdf430.cable.mindspring.com User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:dAl+kbjYvxVEwu6S7WQvWxdk5Mo= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:34567 Archived-At: Denis Bueno 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