From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard G Riley Newsgroups: gmane.emacs.help Subject: Re: Add functions to C-mode? Date: Mon, 21 Apr 2008 13:49:57 +0200 Organization: http://www.gnu.org/software/emacs/ Message-ID: References: <4809d165$0$90270$14726298@news.sunsite.dk> <480c43d0$0$90272$14726298@news.sunsite.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208778886 32164 80.91.229.12 (21 Apr 2008 11:54:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Apr 2008 11:54:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 21 13:55:20 2008 connect(): Connection refused 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 1Jnubm-00015F-4l for geh-help-gnu-emacs@m.gmane.org; Mon, 21 Apr 2008 13:55:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jnub5-0006HP-C5 for geh-help-gnu-emacs@m.gmane.org; Mon, 21 Apr 2008 07:54:11 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!feeder.erje.net!news.motzarella.org!motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 61 Original-X-Trace: feeder.motzarella.org U2FsdGVkX19FDsUyU1frLqMEZg9TliHL5y4UMDHNMPEe9ZIKlS/VqCdpzXCUwJDjdDaLptEdzxmuIBhTsM5ksyjhjk2O05msCV2Wv6ghoSiaUkLOdNoEm8HiFOQU5duV4XPT08Zl0yJhSBSqGvwudw== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Mon, 21 Apr 2008 11:50:10 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/16j8TSpHSqY9A2w/MwzqoWwjYQ901UnCnSHhLj2tQ9w== Cancel-Lock: sha1:HjM70vwK4pA/EGufI4PKCGy++9M= User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.2 (gnu/linux) Original-Xref: shelby.stanford.edu gnu.emacs.help:158084 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:53447 Archived-At: Alan Mackenzie writes: > Morning, Saneman > > On Mon, Apr 21, 2008 at 09:36:55AM +0200, saneman wrote: >> Alan Mackenzie wrote: > >> >On Sat, Apr 19, 2008 at 01:04:06PM +0200, saneman wrote: >> >>I would like to add/change the comment/uncomment function in the >> >>C-mode for emacs. > >> >>Currently it only works when a piece of text is selected and then /* */ >> >>is inserted. > > [ .... ] > >> But I still have to select the lines that I want to comment out. If the >> cursor is on a line the I would like to comment out and I press C-d the >> // get inserted and the end of the line. > >> Only when I select the line and then press C-d it works. > >> Is there some way to insert // at the start of the line without first >> selecting it? > > I'm not quite sure exactly what you mean, but I don't think so (other > than typing the two "/"s yourself, but that's boring). > > What exactly do you mean by "selecting" and why do you want to avoid I would assume he means selecting the text. As one does for cut and paste. Standard region manipulation. > this? Somehow or other, you've got to indicate to Emacs _which_ lines(s) > you want commented out (even if it's only one line). > > "Selecting" isn't really Emacs jargon. When you drag the mouse over a Neither is "dragging a mouse" :-; > buffer, the "mark" is left where you started, and point is put where you > finish. The "region" is the bit between point and mark, and many > commands operate on the region. There are lots of ways of setting the > mark, too. C- is the most basic. I think it would be fair to say that "selecting the text" is perfectly clear in this instance. > > So, if you want to comment out lines (like all good programming standards > forbid, yet everybody does ;-), make the region the pertinent lines. I must admit to never having heard of this - commenting out is a very common thing to do during development. > Then do C-c C-c (`comment-region'). If you later want to undo this, put > the region round these lines again, then do C-u C-c C-c. In my set up the command is comment-dwim accessed from "M-;". I guess this is part of emacs-22?