Matching Parenthesis

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Cher-Wah Tan

Matching Parenthesis

Post 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!
Thomas Schremser

Re: Matching Parenthesis

Post by Thomas Schremser »

Try Ctrl+M

HTH
Greetings
Thomas
Andreas

Re: Matching Parenthesis

Post 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.
Randall McDougall

Re: Matching Parenthesis

Post 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.
Andreas

Re: Matching Parenthesis

Post by Andreas »

Uuuups. I did not create such a macro, so the parenthesis slipped by...
Nobody is perfect - I am somebody!
Andreas
Cher-Wah Tan

Re: Matching Parenthesis

Post 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.
Randall McDougall

Re: Matching Parenthesis

Post 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) ...
Andreas

Re: Matching Parenthesis

Post 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
Post Reply