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

Home » Public Forums » archive » Re: IDLWAVE and starting a comment on a new line
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDLWAVE and starting a comment on a new line [message #48645] Thu, 11 May 2006 12:21 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 11 May 2006 06:05:18 -0700, Gianguido Cianci wrote:

> Thanks a lot JD!
>
>> It only works with the stanza in .emacs that I provided. The next release
>> won't need this, but for now, you must set the "comment-add" parameter.
>
> The M-; trick does not work despite the addition of the "command-add"
> parameter and that's why I am perplexed.

Perhaps you're not setting it correctly in .emacs. Try, in a .pro buffer,
C-h v comment-add. It should say something like:

comment-add is a variable defined in `newcomment.el'.
Its value is 1
Local in buffer foo.pro; global value is 0

>> Yes, indeed. You might add something like this to your idlwave-mode-hook
>> inside of .emacs:
>>
>> (define-key (current-local-map)
>> [f6]
>> '(lambda () (interactive)
>> (insert ";{{{")
>> (indent-according-to-mode)))
>>
>> The same pattern can be used to insert anything.
>
>
> For anyone wanting to try it the define-key trick works great, though
> it only indents if the cursor is not in column 1. Which I guess is how
> idlwave indents comments in the first place. In case you're curious, I
> use ;{{{ and ;}}} with folding.el to fold IDL code in emacs, pretty
> nifty.

This is the correct behavior, since any comment starting at the
beginning of the line is not moved when indenting. If you always want
it to indent no matter where point is, perhaps inset " ;{{{" instead.

By the way, for "folding", the next version of IDLWAVE will support
HideShow, which lets you collapse blocks (routine definitions or
otherwise) with a few keystrokes. Very useful, and no comment
trickery required. A hidden function, for instance, look like:

function my_func,arg1,arg2...

but contains the full collapsed text. Sometimes I find it useful to
collapse (C-c @ C-M-h) everything, and then show a few functions at a
time. You can also hide any control block.

> I realize this is an IDL forum and not an emacs forum but I will
> give this a shot anyway... I think the super-uber version of the
> define-key command above would act slightly differently: it would
> insert the string "{{{", prepend the relevant comment characters for
> the current mode and finally indent the whole thing properly. Is
> *this* possible or am I just asking too much of either xemacs or
> this fine community?

In that case just stick it in the global map.

(define-key global-map
[f6]
'(lambda () (interactive)
(insert (concat " " comment-start "{{{"))
(indent-according-to-mode)))

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: very slow object graphics creation
Next Topic: 6.3 reactions?

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

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

Total time taken to generate the page: 0.00453 seconds