From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Amadeus W.M." Newsgroups: gmane.emacs.help Subject: Re: bash comments in emacs Date: Sun, 27 Apr 2008 21:54:23 GMT Message-ID: References: <87d4obr6h8.fsf@hubble.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1209336041 9409 80.91.229.12 (27 Apr 2008 22:40:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Apr 2008 22:40:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 28 00:41:17 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JqFYZ-00005a-9c for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Apr 2008 00:41:15 +0200 Original-Received: from localhost ([127.0.0.1]:48454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JqFXs-0004pn-RT for geh-help-gnu-emacs@m.gmane.org; Sun, 27 Apr 2008 18:40:32 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!cyclone1.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny06.POSTED!e22bd3c2!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Pan/0.132 (Waxed in Black) Original-Lines: 39 Original-NNTP-Posting-Host: 72.81.143.62 Original-X-Complaints-To: abuse@verizon.net Original-X-Trace: trndny06 1209333263 72.81.143.62 (Sun, 27 Apr 2008 17:54:23 EDT) Original-NNTP-Posting-Date: Sun, 27 Apr 2008 17:54:23 EDT Original-Xref: shelby.stanford.edu gnu.emacs.help:158213 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:53579 Archived-At: On Sun, 27 Apr 2008 11:29:23 +0200, Pascal Bourguignon wrote: > "Amadeus W.M." 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.