all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bash comments in emacs
@ 2008-04-27  2:34 Amadeus W.M.
  2008-04-27  9:29 ` Pascal Bourguignon
  0 siblings, 1 reply; 5+ messages in thread
From: Amadeus W.M. @ 2008-04-27  2:34 UTC (permalink / raw)
  To: help-gnu-emacs

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. 

Thanks!



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

* Re: bash comments in emacs
  2008-04-27  2:34 bash comments in emacs Amadeus W.M.
@ 2008-04-27  9:29 ` Pascal Bourguignon
  2008-04-27 12:02   ` Richard G Riley
  2008-04-27 21:54   ` Amadeus W.M.
  0 siblings, 2 replies; 5+ messages in thread
From: Pascal Bourguignon @ 2008-04-27  9:29 UTC (permalink / raw)
  To: help-gnu-emacs

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

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

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

"Specifications are for the weak and timid!"


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

* Re: bash comments in emacs
  2008-04-27  9:29 ` Pascal Bourguignon
@ 2008-04-27 12:02   ` Richard G Riley
  2008-04-27 21:54   ` Amadeus W.M.
  1 sibling, 0 replies; 5+ messages in thread
From: Richard G Riley @ 2008-04-27 12:02 UTC (permalink / raw)
  To: help-gnu-emacs

Pascal Bourguignon <pjb@informatimago.com> writes:

> "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-;
>
> 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...

What command does that invoke?

On my Emacs system it has always been M-; to comment out. It invokes comment-dwim.



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

* Re: bash comments in emacs
  2008-04-27  9:29 ` Pascal Bourguignon
  2008-04-27 12:02   ` Richard G Riley
@ 2008-04-27 21:54   ` Amadeus W.M.
  2008-04-29 10:44     ` Rupert Swarbrick
  1 sibling, 1 reply; 5+ messages in thread
From: Amadeus W.M. @ 2008-04-27 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

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.



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

* Re: bash comments in emacs
  2008-04-27 21:54   ` Amadeus W.M.
@ 2008-04-29 10:44     ` Rupert Swarbrick
  0 siblings, 0 replies; 5+ messages in thread
From: Rupert Swarbrick @ 2008-04-29 10:44 UTC (permalink / raw)
  To: help-gnu-emacs

"Amadeus W.M." <amadeus84@verizon.net> writes:

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

I think by default, in C mode, C-c C-c calls comment-region, which I
assumed was what Amadeus was originally after. You could always do
something like

(add-hook 'sh-mode-hook
          (lambda ()
             (define-key sh-mode-map "\C-c\C-c" 'comment-region)))

(pilfering blatantly from the code I just snipped)


Rupert


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

end of thread, other threads:[~2008-04-29 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-27  2:34 bash comments in emacs Amadeus W.M.
2008-04-27  9:29 ` Pascal Bourguignon
2008-04-27 12:02   ` Richard G Riley
2008-04-27 21:54   ` Amadeus W.M.
2008-04-29 10:44     ` Rupert Swarbrick

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.