unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dave Sumsky <xsumsky@fi.muni.cz>
Subject: Re: How to set shortcut for uncomment-region?!?
Date: Mon, 13 Jan 2003 20:06:43 GMT	[thread overview]
Message-ID: <H8o50y.D0o@news.muni.cz> (raw)
In-Reply-To: <H8EHw9.E1B@news.muni.cz>

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

  parent reply	other threads:[~2003-01-13 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=H8o50y.D0o@news.muni.cz \
    --to=xsumsky@fi.muni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).