Page 1 of 1

Matching Parenthesis

Posted: Fri Mar 30, 2001 6:40 am
by Cher-Wah Tan
Hi All,

I am coding Scheme (you know, the language that has more parenthesis in it than code *g*) and I would like my cursor to bounce back to its matching left parenthesis when I typed a right parenthesis (just like what Emacs does).

Is there a setting or macro that will allow me to do this?

Thanks a bunch!

Re: Matching Parenthesis

Posted: Fri Mar 30, 2001 8:08 am
by Thomas Schremser
Try Ctrl+M

HTH
Greetings
Thomas

Re: Matching Parenthesis

Posted: Fri Mar 30, 2001 9:06 am
by Andreas
You could create a macro that does <b>Ctrl-M Ctrl-M Cursor-Right</b> and assign it to the <b>)</b> key.

Re: Matching Parenthesis

Posted: Sat Mar 31, 2001 10:15 am
by Randall McDougall
Shouldn't that be ")" Ctrl-M Ctrl-M Cursor-Right ? Otherwise you can't add a real ")" ... This is another example of where Doc Class specific Macros are needed ... you don't want that while typing regular text. It would be better to assign it to Ctrl-")"... and train yourself to close parentheses in that language with the Ctrl version.

Re: Matching Parenthesis

Posted: Sat Mar 31, 2001 1:03 pm
by Andreas
Uuuups. I did not create such a macro, so the parenthesis slipped by...
Nobody is perfect - I am somebody!
Andreas

Re: Matching Parenthesis

Posted: Sat Mar 31, 2001 6:51 pm
by Cher-Wah Tan
I have tried both methods:-

[1] Ctrl-M Ctrl-M Cursor-Right ...
[2] ')' Ctrl-M Ctrl-M Cursor-Right ...
and assign it to the ')' key.

but none of them seemed to work. after i assigned it to the ')' key, hitting the ')' key does not print the ')' character anymore (and thus nothing to match).

these are my steps for method [2]:-

i type '(abc', then record macro. i type in ')', then Ctrl-M Ctrl-M and move cursor to the right. then i save the macro. then, go to Preferences -> Keyboard and select Marcos. and assign my macro to the key ')'.

did i miss anything?
thanks for your time.

Re: Matching Parenthesis

Posted: Sat Mar 31, 2001 9:50 pm
by Randall McDougall
I'm not familiar with EMACS so I took the Ctrl-M,Ctrl-M,Cursor-Right at face value ... looking at your description I'd say ")",Ctrl-M,Cursor-Right is more what you want. (a single Ctrl-M sends it back to the matching open "(", the *second* one would send it back to the closing one just typed, effectively doing nothing) ...

Re: Matching Parenthesis

Posted: Sun Apr 01, 2001 4:05 pm
by Andreas
I did not try it - I thought the first Ctrl-M would move the cursor to the opening ( and the second would move it back - which would emulate the short flashing of the cursor at the matching ( of emacs.
It might be that the macro interpreter does not flash the cursor at the opening (

Andreas