parenthesis matching in notebook environment

20 views
Skip to first unread message

pong

unread,
Apr 22, 2008, 4:21:41 AM4/22/08
to sage-support
I wonder if there is any parenthesis matching function in SAGE
notebook environment (like that in Emacs). It is helpful in typing an
instruction with severals nested parenthesis.

If this has been implemented, how how to invoke it? If not, I hope
this will be implemented in later versions of SAGE.

Mike Hansen

unread,
Apr 22, 2008, 4:25:02 AM4/22/08
to sage-s...@googlegroups.com
Hi,

Do you know a good example of an javascript text editor that does
this? If you could search around, that would be most helpful. The
biggest concern is probably the impact on performance; it's the same
issue with things like syntax highlighting.

--Mike

William Stein

unread,
Apr 22, 2008, 11:30:59 AM4/22/08
to sage-s...@googlegroups.com
On Tue, Apr 22, 2008 at 1:25 AM, Mike Hansen <mha...@gmail.com> wrote:
>
> Hi,
>
> Do you know a good example of an javascript text editor that does
> this? If you could search around, that would be most helpful. The
> biggest concern is probably the impact on performance; it's the same
> issue with things like syntax highlighting.
>
> --Mike

Mike,

Currently every time the user presses a key in the notebook
we run a javascript command to resize the cell input
area. This is pretty optimized. It would certainly also
be possible that every time the ')' key is pressed, a javascript
command is run that does some matching -- I don't know
what it would *literally* do to emphasize the matching -- but
it could do something. I think the hard part, by far, is simply
writing a javascript function to find the corresponding matching
paranthesis earlier in a string. And, well, that doesn't
sound very hard.

I think this feature request is reasonable, but the way to
implement it is to just do it directly instead of including a
full javascript text editor. What do you think?

william

Lars Fischer

unread,
Apr 22, 2008, 6:43:31 PM4/22/08
to sage-support
Hello,

> I think this feature request is reasonable, but the way to
> implement it is to just do it directly instead of including a
> full javascript text editor. What do you think?

you could write a more general function that does not only match
parenthesis (), but also brackets [] and braces {} and "" and '' and
so on.

With best regards,
Lars Fischer

Jason Grout

unread,
Apr 22, 2008, 6:50:43 PM4/22/08
to sage-s...@googlegroups.com

This page might be relevant and interesting, if only for ideas of what
we could do:

http://en.wikipedia.org/wiki/Comparison_of_Javascript-based_source_code_editors

Jason

Jason Grout

unread,
Apr 22, 2008, 6:56:01 PM4/22/08
to sage-s...@googlegroups.com


In particular, this editor already has python capabilities, apparently:

http://www.cdolivet.net/editarea/

Jason

William Stein

unread,
Apr 23, 2008, 10:39:59 AM4/23/08
to sage-s...@googlegroups.com

People should play around with that editor and see if it feels
snappy enough that they would *actually* want to use it a lot.

For me on FF3 the editor doesn't even work, which is
worrisome.

William

Jurgis Pralgauskis

unread,
Apr 23, 2008, 1:50:43 PM4/23/08
to sage-s...@googlegroups.com
http://Crunchy.sf.net uses editarea,
and they had a rough test on FF3 with no complains on editor
http://groups.google.com/group/crunchy-discuss

there's a screenshot
http://popmokslas.projektas.lt/failai/etc/CrunchyEditor%e2%80%93FF.png

and js
http://www.koders.com/javascript/fidC214ECA4C1C5462DE7D06A92F09654C34B0AC8FA.aspx?s=search

best regards..

--
Jurgis Pralgauskis
omni: 8-616 77613; teledema: 8-657 65656;
jabber: jur...@akl.lt; skype: dz0rdzas;
Don't worry, be happy and make things better ;)

Jason Grout

unread,
Apr 23, 2008, 4:22:58 PM4/23/08
to sage-s...@googlegroups.com

I just upgraded to Ubuntu 8.04 (RC), which has FF3Beta5. Of the
examples on
http://www.cdolivet.net/editarea/editarea/exemples/exemple_full.html,
only the python works for me. The other examples have lots of
characters superimposed on others and are messes to look at.

Jason

William Stein

unread,
Apr 24, 2008, 1:01:47 AM4/24/08
to sage-s...@googlegroups.com
On Wed, Apr 23, 2008 at 1:22 PM, Jason Grout

Yes, same here under OS X.

By the way, precisely what paran matching do people want?
Precisely how would it be to use it? Exactly like emacs?

William

Jason Grout

unread,
Apr 24, 2008, 4:54:30 AM4/24/08
to sage-s...@googlegroups.com


I've posted an spkg and a patch which enables the functionality at least
a little bit on trac #3016.

Edit Area says that it supports Firefox 2.5 and Safari 3.0. It seems
like it is under pretty active development, so my guess is that it's
only a matter of time before supporting Firefox 3 fully.

The settings that the patch enables seem to work for my FF3 on Ubuntu.

Of course, I don't think this editor does parenthesis matching! :) The
syntax highlighting is pretty, though.

Jason


Reply all
Reply to author
Forward
0 new messages