Re: How to comment out large section of codes in IDL? [message #56035] |
Mon, 01 October 2007 06:04 |
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  |
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  |
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 #56045 is a reply to message #56044] |
Fri, 28 September 2007 10:07  |
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 #56047 is a reply to message #56046] |
Fri, 28 September 2007 09:40  |
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  |
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  |
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  |
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  |
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  |
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.
|
|
|