comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to comment out large section of codes in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: How to comment out large section of codes in IDL? [message #56035] Mon, 01 October 2007 06:04
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On Sep 28, 9:24 pm, JD Smith <jdsm...@as.arizona.edu> wrote:

> I think he meant IDLDE, not IDLWAVE.

Ah - yes - my chronic emacs infection is so bad that I never even
thought of that!

> Also, it's [C-c ;]. Another fun one is M-;, which in Emacs
> 22 will move you to a comment or create a new one in an
> intelligent way at the current line, or (un-)comment highlighted
> blocks. My favorite part is that this function is called
> `comment-dwim', for Do What I Mean.

I'll have to read up on the new stuff in emacs 22. It seems like
whatever I want to do, it has already been implemented in emacs!

Mike
Re: How to comment out large section of codes in IDL? [message #56042 is a reply to message #56035] Fri, 28 September 2007 18:24 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 28 Sep 2007 16:49:58 -0700, Mike wrote:

> On Sep 28, 10:37 am, "Jeff N." <jnett...@utk.edu> wrote:
>
>> Does this feature have a keyboard shortcut? There isn't one listed
>> beside the command in the menu, as there is for other menu commands,
>> so i assume there isn't one. If there isn't, i wish there was :(
>
> It is bound to C-;
>
> I've never used it much - instead I use emacs's comment region (M-x
> comment-region). To uncomment, just use C-u M-x comment-region.

I think he meant IDLDE, not IDLWAVE. Also, it's [C-c ;]. Another fun
one is M-;, which in Emacs 22 will move you to a comment or create a
new one in an intelligent way at the current line, or (un-)comment
highlighted blocks. My favorite part is that this function is called
`comment-dwim', for Do What I Mean.

JD
Re: How to comment out large section of codes in IDL? [message #56043 is a reply to message #56042] Fri, 28 September 2007 16:49 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
On Sep 28, 10:37 am, "Jeff N." <jnett...@utk.edu> wrote:

> Does this feature have a keyboard shortcut? There isn't one listed
> beside the command in the menu, as there is for other menu commands,
> so i assume there isn't one. If there isn't, i wish there was :(

It is bound to C-;

I've never used it much - instead I use emacs's comment region (M-x
comment-region). To uncomment, just use C-u M-x comment-region.

Mike
Re: How to comment out large section of codes in IDL? [message #56044 is a reply to message #56043] Fri, 28 September 2007 10:29 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
Marshall Perrin wrote:
> Paul van Delst <Paul.vanDelst@noaa.gov> wrote:
>> I googled "vim block comment" and got the following (among others):
>>
>> http://www.vim.org/scripts/script.php?script_id=473
>> http://notfaq.wordpress.com/2006/07/28/vim-comment-blocks-of -code/
>>
>> The first details how to set up vim to do it, the second appears to indicate it's already
>> possible with the right combo of keystrokes.
>
> Sure is. Once you've selected the block of text you want to comment
> out, just type :s/^/;/ and you're all set. Perfectly obvious, no? ;-)

I wonder how that compares with EMACS ( outside IDLWAVE
mode) "CTRL-x r t ; RETURN" after selection... ;-)

Ciao,
Paolo

>
> - Marshall (loves vim's brevity, hates the learning curve)
Re: How to comment out large section of codes in IDL? [message #56045 is a reply to message #56044] Fri, 28 September 2007 10:07 Go to previous message
Marshall Perrin is currently offline  Marshall Perrin
Messages: 44
Registered: December 2005
Member
mgalloy@gmail.com <mgalloy@gmail.com> wrote:
> On Sep 27, 6:01 pm, full...@gmail.com wrote:
>> As title. In C/C++, we can comment out many lines at once by /* */,
>> but in IDL, it seems the only way is to put ";" in front of every
>> line. Is there a better way?
>
> There is no multi-line comment syntax in IDL.

That said, often one can get away with wrapping an "if 0 then begin...endif"
around the code in question. It's an ugly solution, but does work.

- Marshall
Re: How to comment out large section of codes in IDL? [message #56046 is a reply to message #56045] Fri, 28 September 2007 10:06 Go to previous message
Marshall Perrin is currently offline  Marshall Perrin
Messages: 44
Registered: December 2005
Member
Paul van Delst <Paul.vanDelst@noaa.gov> wrote:
> I googled "vim block comment" and got the following (among others):
>
> http://www.vim.org/scripts/script.php?script_id=473
> http://notfaq.wordpress.com/2006/07/28/vim-comment-blocks-of -code/
>
> The first details how to set up vim to do it, the second appears to indicate it's already
> possible with the right combo of keystrokes.

Sure is. Once you've selected the block of text you want to comment
out, just type :s/^/;/ and you're all set. Perfectly obvious, no? ;-)

- Marshall (loves vim's brevity, hates the learning curve)
Re: How to comment out large section of codes in IDL? [message #56047 is a reply to message #56046] Fri, 28 September 2007 09:40 Go to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
<fullyu4@gmail.com> wrote in message
news:1190937705.321763.225700@r29g2000hsg.googlegroups.com.. .
> As title. In C/C++, we can comment out many lines at once by /* */,
> but in IDL, it seems the only way is to put ";" in front of every
> line. Is there a better way?

Block comments have been mentioned (under the edit menu in the IDLDE).
Also, many editors have "column mode" where you can select
row 1, for multiple columns and paste in the ";" (ultra edit can do this).

Another way, it to programatically make a IF block.

dothispart = 1

if dothispart then begin
...
endif

That is actually pretty handy to do, especially if you are in an
exploratory mood looking through data. I also use this to switch
between screen graphics, and postscript graphics for instance.

Cheers,
bob
Re: How to comment out large section of codes in IDL? [message #56051 is a reply to message #56047] Fri, 28 September 2007 07:37 Go to previous message
Jeff N. is currently offline  Jeff N.
Messages: 120
Registered: April 2005
Senior Member
On Sep 27, 9:55 pm, "mgal...@gmail.com" <mgal...@gmail.com> wrote:
> On Sep 27, 6:01 pm, full...@gmail.com wrote:
>
>> As title. In C/C++, we can comment out many lines at once by /* */,
>> but in IDL, it seems the only way is to put ";" in front of every
>> line. Is there a better way?
>
> There is no multi-line comment syntax in IDL. If you use the IDLDE,
> there is a feature to comment out selected lines.
>
> Mike
> --www.michaelgalloy.com

Does this feature have a keyboard shortcut? There isn't one listed
beside the command in the menu, as there is for other menu commands,
so i assume there isn't one. If there isn't, i wish there was :(

Jeff
Re: How to comment out large section of codes in IDL? [message #56053 is a reply to message #56051] Fri, 28 September 2007 06:48 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
fullyu4@gmail.com wrote:
> On Sep 27, 6:41 pm, mankoff <mank...@gmail.com> wrote:
>> On Sep 27, 8:01 pm, full...@gmail.com wrote:
>>
>>> As title. In C/C++, we can comment out many lines at once by /* */,
>>> but in IDL, it seems the only way is to put ";" in front of every
>>> line. Is there a better way?
>> Use emacs idlwave-mode and then select region, then CTRL-c + ;
>>
>> -k
> Hello,
>
> Thank you very much. I've heard a lot of good thing about IDLWAVE, but
> unfortunately, I am used to use vim. Is there a alternative plug-in
> for vim or shall I force myself to start using emacs?

This block commenting feature is almost ubiquitous on modern editors. If they can't
already do it, they can be made to do so (e.g. I used nedit and it can now comment
selected blocks for a variety of languages that require the "line-by-line" type of block
comment).

I googled "vim block comment" and got the following (among others):

http://www.vim.org/scripts/script.php?script_id=473
http://notfaq.wordpress.com/2006/07/28/vim-comment-blocks-of -code/

The first details how to set up vim to do it, the second appears to indicate it's already
possible with the right combo of keystrokes.

cheers,

paulv
Re: How to comment out large section of codes in IDL? [message #56057 is a reply to message #56053] Thu, 27 September 2007 19:16 Go to previous message
fullyu4 is currently offline  fullyu4
Messages: 4
Registered: September 2007
Junior Member
On Sep 27, 6:41 pm, mankoff <mank...@gmail.com> wrote:
> On Sep 27, 8:01 pm, full...@gmail.com wrote:
>
>> As title. In C/C++, we can comment out many lines at once by /* */,
>> but in IDL, it seems the only way is to put ";" in front of every
>> line. Is there a better way?
>
> Use emacs idlwave-mode and then select region, then CTRL-c + ;
>
> -k
Hello,

Thank you very much. I've heard a lot of good thing about IDLWAVE, but
unfortunately, I am used to use vim. Is there a alternative plug-in
for vim or shall I force myself to start using emacs?
Re: How to comment out large section of codes in IDL? [message #56058 is a reply to message #56057] Thu, 27 September 2007 18:55 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Sep 27, 6:01 pm, full...@gmail.com wrote:
> As title. In C/C++, we can comment out many lines at once by /* */,
> but in IDL, it seems the only way is to put ";" in front of every
> line. Is there a better way?

There is no multi-line comment syntax in IDL. If you use the IDLDE,
there is a feature to comment out selected lines.

Mike
--
www.michaelgalloy.com
Re: How to comment out large section of codes in IDL? [message #56060 is a reply to message #56058] Thu, 27 September 2007 18:41 Go to previous message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Sep 27, 8:01 pm, full...@gmail.com wrote:
> As title. In C/C++, we can comment out many lines at once by /* */,
> but in IDL, it seems the only way is to put ";" in front of every
> line. Is there a better way?

Use emacs idlwave-mode and then select region, then CTRL-c + ;

-k.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: WINDOWS drag and drop into a draw widget
Next Topic: Re: Seasonal Variation in Trend Analysis

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:44:41 PDT 2025

Total time taken to generate the page: 0.00700 seconds