From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tyler Smith Newsgroups: gmane.emacs.help Subject: Re: Problem with removing comments Date: 18 Dec 2007 15:20:36 GMT Organization: Sedgeboy Inc. Message-ID: References: <47678e4c$0$13119$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1197992520 4792 80.91.229.12 (18 Dec 2007 15:42:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Dec 2007 15:42:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 18 16:42:11 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J4ea6-00083P-Ni for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Dec 2007 16:42:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J4eZn-0005Zb-8y for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Dec 2007 10:41:47 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!nx02.iad01.newshosting.com!newshosting.com!post02.iad01!post01.iad01!news.aliant.net!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: slrn/0.9.8.1pl1 (Debian) Original-Lines: 34 Original-NNTP-Posting-Host: 142.177.90.102 Original-X-Complaints-To: abuse@aliant.net Original-Xref: shelby.stanford.edu gnu.emacs.help:154752 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:50179 Archived-At: On 2007-12-18, Markus Grunwald wrote: > > What helped a bit was the documentation for comment-region: Now I can > uncomment a region with C-u M-x comment-region. But I don't know how to > "simulate" the "C-u" part in the "chb-uncomment-region-or-line" function. > If that worked, I think everything should be ok... I think you really do want comment-dwim, you just don't know it yet ;) You can access comment-dwim with M-; so you can uncomment a line with a few key strokes: "C-a C-spc C-e M-;" If that's too many key strokes, it should be easy to wrap this in a function similar to what you've tried, using either comment-dwim for a general case, or uncomment-region for a function that only uncomments. >From the help: comment-dwim is an interactive compiled Lisp function in `newcomment.el'. It is bound to M-;. (comment-dwim arg) Call the comment command you want (Do What I Mean). If the region is active and `transient-mark-mode' is on, call `comment-region' (unless it only consists of comments, in which case it calls `uncomment-region'). Else, if the current line is empty, insert a comment and indent it. Else if a prefix arg is specified, call `comment-kill'. Else, call `comment-indent'. You can configure `comment-style' to change the way regions are commented. HTH, Tyler *Written from Emacs22, but I don't think this changed from Emacs21?