[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash comments in emacs
From: |
Amadeus W.M. |
Subject: |
Re: bash comments in emacs |
Date: |
Sun, 27 Apr 2008 21:54:23 GMT |
User-agent: |
Pan/0.132 (Waxed in Black) |
On Sun, 27 Apr 2008 11:29:23 +0200, Pascal Bourguignon wrote:
> "Amadeus W.M." <amadeus84@verizon.net> writes:
>
>> How can I set up a shortcut to comment out or uncomment whole regions
>> in a bash script? Like C-c C-c for C++ comments.
>
> C-;
Thanks. Just to be sure, you mean Ctrl followed by a semicolon (;) right?
Unfortunately didn't work. M-; did though, and that's good enough.
>
> Note that it's C-; also for C++ comments and any other comment. I don't
> you where you got that C-c C-c...
Good question. I looked at my .emacs file and I think C-c C-c comes from
the dwim thing:
;; Nice trick for commenting/uncommenting regions, using dwim (do what I
mean)
;;
;;
;; Otherwise, to uncomment use C-u C-c C-c (opposite of C-c C-c to
comment out)
;; The C-u trick works with latex too.
;; Highlight region, then M-x comment-region.
;; To uncomment, highlight, then C-u M-x comment-region.
(if (fboundp 'comment-dwim)
(add-hook (if (boundp 'c-mode-common-hook)
'c-mode-common-hook
'c-mode-hook)
(lambda ()
(define-key c-mode-map "\C-c\C-c" 'comment-dwim))))
and similarly for C++, latex and matlab.