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

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

Re: How to set shortcut for uncomment-region?!?


From: Dave Sumsky
Subject: Re: How to set shortcut for uncomment-region?!?
Date: Mon, 13 Jan 2003 20:06:43 GMT
User-agent: Mozilla/5.0 (X11; U; Linux i686; cs-CZ; rv:1.2) Gecko/20021203

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 <iostream>
#include <fstream>
#include <string>

and I want to comment them all, so I set mark at the beginning of the first line with C-<SPC>, I get answer "Mark set", so it's O.K.

C-<SPC>#include <iostream>
              ^
#include <fstream>
#include <string>

I move to the end of the third line

C-<SPC>#include <iostream>
#include <fstream>
#include <string>
                           ^

And now I have a region, which I want to comment, so I try M-;, what's the result? This:

#include <iostream>
#include <fstream>
#include <string>                     //

But I would like to see this:

// #include <iostream>
// #include <fstream>
// #include <string>

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



reply via email to

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