From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dave Sumsky Newsgroups: gmane.emacs.help Subject: Re: How to set shortcut for uncomment-region?!? Date: Mon, 13 Jan 2003 20:06:43 GMT Organization: unknown Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1042489073 17801 80.91.224.249 (13 Jan 2003 20:17:53 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 13 Jan 2003 20:17:53 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18YB1r-0004cw-00 for ; Mon, 13 Jan 2003 21:17:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18YAzO-0001ja-06 for gnu-help-gnu-emacs@m.gmane.org; Mon, 13 Jan 2003 15:15:18 -0500 Original-Newsgroups: gnu.emacs.help Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!news-FFM2.ecrc.net!news.cesnet.cz!crax.cesnet.cz!news.vutbr.cz!news.muni.cz!news User-Agent: Mozilla/5.0 (X11; U; Linux i686; cs-CZ; rv:1.2) Gecko/20021203 In-Reply-To: X-Nntp-Posting-Host: wireless-181.fi.muni.cz X-Accept-Language: cs, en-us, en Original-Lines: 77 Original-Xref: shelby.stanford.edu gnu.emacs.help:108922 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5450 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5450 Dave Sumsky wrote: > Hi, > I'm using GNU Emacs version 21.2.1 and I have a problem with shortcut > for uncomment-region function in c++-mode, in my .emacs file I have: > > ;; shorcut for comment region > (global-unset-key "\C-c\C-c") > (global-set-key "\C-c\C-c" 'comment-region) > > ;; shortcut for uncomment region > (global-unset-key "\C-c\C-u") > (global-set-key "\C-c\C-u" 'uncomment-region) > > > Now, what is going wrong. Shortcut for comment region is working fine, > but for uncomment region isn't. When I edit a C/C++ source file, I'm in > c++-mode, and then when I try to uncomment a commented region with > shortcut \C-c\C-u, > I receive this message in echo area: No containing preprocessor conditional > > So, could you help me with it? Does anybody know how to do correctly > what I want? > Thanks for any suggestions, Dave > > Hi, so I would like to begin using M-; for (un)commenting, BUT something is still wrong. Transient-mark-mode is active and my .emacs doesn't contain anything special. Now, what's the problem: I have e.g. these lines of source code (c++-mode): #include #include #include and I want to comment them all, so I set mark at the beginning of the first line with C-, I get answer "Mark set", so it's O.K. C-#include ^ #include #include I move to the end of the third line C-#include #include #include ^ And now I have a region, which I want to comment, so I try M-;, what's the result? This: #include #include #include // But I would like to see this: // #include // #include // #include PLEASE, help me with it, I don't really understand how it is working ... I have defined these functions as c++-mode hooks: imenu-add-menubar-index hs-minor-mode hl-line-mode doxymacs-mode auto-fill-mode my-c-mode-hook // my c/c++-mode variables customization Do you think that there could be something intersting with these functions featuring default behaviour of M-; ?!? Thanks, Dave