all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to set shortcut for uncomment-region?!?
@ 2003-01-08 15:08 Dave Sumsky
  2003-01-08 15:18 ` Galen Boyer
  2003-01-13 20:06 ` Dave Sumsky
  0 siblings, 2 replies; 10+ messages in thread
From: Dave Sumsky @ 2003-01-08 15:08 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-08 15:08 How to set shortcut for uncomment-region?!? Dave Sumsky
@ 2003-01-08 15:18 ` Galen Boyer
  2003-01-08 17:11   ` Dave Sumsky
  2003-01-13 20:06 ` Dave Sumsky
  1 sibling, 1 reply; 10+ messages in thread
From: Galen Boyer @ 2003-01-08 15:18 UTC (permalink / raw)


Doesn't M-; do this for you, both commenting and uncommenting? 
-- 
Galen Boyer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-08 15:18 ` Galen Boyer
@ 2003-01-08 17:11   ` Dave Sumsky
  2003-01-08 17:34     ` Galen Boyer
  0 siblings, 1 reply; 10+ messages in thread
From: Dave Sumsky @ 2003-01-08 17:11 UTC (permalink / raw)


Galen Boyer wrote:
> Doesn't M-; do this for you, both commenting and uncommenting? 
No, I need to comment, uncomment region

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-08 17:11   ` Dave Sumsky
@ 2003-01-08 17:34     ` Galen Boyer
  2003-01-08 18:49       ` Henrik Enberg
  0 siblings, 1 reply; 10+ messages in thread
From: Galen Boyer @ 2003-01-08 17:34 UTC (permalink / raw)


On Wed, 8 Jan 2003, xsumsky@fi.muni.cz wrote:
> Galen Boyer wrote:
> 
>> Doesn't M-; do this for you, both commenting and uncommenting?
> No, I need to comment, uncomment region

Did you try it on a region?
-- 
Galen Boyer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: How to set shortcut for uncomment-region?!?
@ 2003-01-08 17:57 Moore, Mathew L
  0 siblings, 0 replies; 10+ messages in thread
From: Moore, Mathew L @ 2003-01-08 17:57 UTC (permalink / raw)


I thought M-; will comment-region/uncomment-region, as long as there is an
active region?  It does on mine, anyway, and I don't have anything special
set up for this in my .emacs.

Please let me know if this isn't the standard behavior.

--Matt

> -----Original Message-----
> From: Dave Sumsky [mailto:xsumsky@fi.muni.cz] 
> Sent: Wednesday, January 08, 2003 12:11
> To: help-gnu-emacs@gnu.org
> Subject: Re: How to set shortcut for uncomment-region?!?
> Importance: High
> 
> 
> Galen Boyer wrote:
> > Doesn't M-; do this for you, both commenting and uncommenting?
> No, I need to comment, uncomment region
> 
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-08 17:34     ` Galen Boyer
@ 2003-01-08 18:49       ` Henrik Enberg
  2003-01-08 19:16         ` Galen Boyer
  0 siblings, 1 reply; 10+ messages in thread
From: Henrik Enberg @ 2003-01-08 18:49 UTC (permalink / raw)


Galen Boyer <galenboyer@hotpop.com> writes:

> On Wed, 8 Jan 2003, xsumsky@fi.muni.cz wrote:
>> Galen Boyer wrote:
>> 
>>> Doesn't M-; do this for you, both commenting and uncommenting?
>> No, I need to comment, uncomment region
>
> Did you try it on a region?

That only works when transient-mark-mode is active.  Maybe the OP
doesn't use that.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-08 18:49       ` Henrik Enberg
@ 2003-01-08 19:16         ` Galen Boyer
  0 siblings, 0 replies; 10+ messages in thread
From: Galen Boyer @ 2003-01-08 19:16 UTC (permalink / raw)


On Wed, 08 Jan 2003, henrik+news@enberg.org wrote:
> Galen Boyer <galenboyer@hotpop.com> writes:
> 
>> On Wed, 8 Jan 2003, xsumsky@fi.muni.cz wrote:
>>> Galen Boyer wrote:
>>> 
>>>> Doesn't M-; do this for you, both commenting and
>>>> uncommenting?
>>> No, I need to comment, uncomment region
>>
>> Did you try it on a region?
> 
> That only works when transient-mark-mode is active.  Maybe the
> OP doesn't use that.

Hm...  (tries it out).  I see.  I've had that turned on since
like my second day with Emacs.
-- 
Galen Boyer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-08 15:08 How to set shortcut for uncomment-region?!? Dave Sumsky
  2003-01-08 15:18 ` Galen Boyer
@ 2003-01-13 20:06 ` Dave Sumsky
  2003-01-14 10:48   ` Kester Clegg
  1 sibling, 1 reply; 10+ messages in thread
From: Dave Sumsky @ 2003-01-13 20:06 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-13 20:06 ` Dave Sumsky
@ 2003-01-14 10:48   ` Kester Clegg
  2003-01-14 12:47     ` Thomas Traub
  0 siblings, 1 reply; 10+ messages in thread
From: Kester Clegg @ 2003-01-14 10:48 UTC (permalink / raw)


Dave Sumsky <xsumsky@fi.muni.cz> writes:

> 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>


What happens if you do M-x comment-region ?


-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to set shortcut for uncomment-region?!?
  2003-01-14 10:48   ` Kester Clegg
@ 2003-01-14 12:47     ` Thomas Traub
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Traub @ 2003-01-14 12:47 UTC (permalink / raw)


Kester Clegg wrote:
> Dave Sumsky <xsumsky@fi.muni.cz> writes:
> 
> 
>>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>
> 
> 
> 
> What happens if you do M-x comment-region ?
> 
> 

Hi,
try C-c C-c
Greets, Thomas...

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-01-14 12:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-08 15:08 How to set shortcut for uncomment-region?!? Dave Sumsky
2003-01-08 15:18 ` Galen Boyer
2003-01-08 17:11   ` Dave Sumsky
2003-01-08 17:34     ` Galen Boyer
2003-01-08 18:49       ` Henrik Enberg
2003-01-08 19:16         ` Galen Boyer
2003-01-13 20:06 ` Dave Sumsky
2003-01-14 10:48   ` Kester Clegg
2003-01-14 12:47     ` Thomas Traub
  -- strict thread matches above, loose matches on Subject: below --
2003-01-08 17:57 Moore, Mathew L

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.