Re: IDLWAVE and starting a comment on a new line [message #48659 is a reply to message #48658] |
Wed, 10 May 2006 11:03   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Wed, 10 May 2006 07:09:36 -0700, newbie16 wrote:
> Hi Everyone:
>
> Just a quick question here. I routinely use EMACS for editing code and
> IDLWAVE has been working great for me so far...with one maddening
> exception.
>
> When using EMACS for FORTRAN, I routinely start a comment by the character
> sequence: M-;
>
> This puts a "C" at the beginning of a line and indents to column 7. I
> love this feature of EMACS and do it quite automatically now. However,
> when using the same sequence in IDLWAVE-mode, a ";" is placed in the
> middle of the line and the comment starts there, when I really want it at
> the beginning of the line.
>
> For the last week I've tried fooling around with the various IDLWAVE
> configuration examples online (here and at IDLWAVE.org), but for the life
> of me, I can't seem to figure out which line needs to be changed and/or
> added (or how for that matter). Now, I know this isn't a serious issue
> but man it drives me nuts, and I finally brokedown today.
>
>
> Does anyone know of a configuration setting I can add to my .emacs file to
> set the behaviour of the above sequence to what I'm used to?
>
> Any pointers in the right direction are appreciated.
I actually didn't know about M-;, thanks.
By default, comments starting with ";" are indented to the right
(usually after a line of code), those starting with ";;" are indented
to the code indent location, and those starting with ";;;" are not
moved at all. Also, any comment starting at the very beginning of the
line is left there (regardless of how many semi-colons it starts
with).
The best way to get what you want is to set `comment-add' to 1
locally, by adding to your idlwave-mode-hook in .emacs:
(add-hook 'idlwave-mode-hook
(lambda ()
(set (make-local-variable 'comment-add) 1)))
In fact, I like this so much I'm adding it to the next version of
IDLWAVE. It also affects C-c ; (comment-region -- for the better I
think).
For those of you who want to try M-;, with this fix, on a blank line it
indents and puts in ";; ", on a line with code, it moves to the right
of the code with a ";". Really quite useful. For the curious, M-; calls
`comment-dwim'... "do what I mean" indeed.
Thanks for the suggestion.
JD
|
|
|