Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve TAB-completion in Macaulay2 #7915

Closed
novoselt opened this issue Jan 13, 2010 · 7 comments
Closed

Improve TAB-completion in Macaulay2 #7915

novoselt opened this issue Jan 13, 2010 · 7 comments

Comments

@novoselt
Copy link
Member

There are the following problems with the current TAB-completion in Macaulay2:

  • it is slow and there is a special function which creates the list of commands and stores it in file for future use;
  • this function prints a message which is not visible in the notebook and it looks like the notebook stopped responding;
  • new objects defined by user or introduced by loaded packages do not appear in this static list;
  • TAB-completion for Macaulay2 objects shows the same list of more than 1000 names as for Macaulay2 sessions, most of the stuff in this list cannot be applied to the given object.

The attached patch changes trait_names functions so that

  • functions for building command lists execute reasonably fast for interaction (0.2-0.6 second on my machine);
  • both lists for an interpreter session and for objects in it are computed dynamically on each call and take into account loaded and created names;
  • only methods which can take an object as the first argument are shown for objects;
  • execution time for "sage -t --optional macaulay2.py" dropped from 3 minutes (which was really annoying me for the last 5 days) to 30 seconds.

New problem (doesn't need much attention, I think):

  • shortcuts like "gens" for "generators" are not displayed in both lists because of the way they are defined in Macaulay2, this is likely to be fixed in the next release (of Macaulay2).

Remaining problem (to be addressed later):

  • Macaulay2 convention is to put "the important argument" last, so a useful function "f" will not be displayed in TAB-completion for "x" if it should be called like "f(7, x)" in Macaulay2. Since the default call corresponding to Sage command "x.f(7)" is "f(x, 7)", this is actually correct and "f" should not be listed. However, it may be useful to have an option to translate all calls of the form "x.f(...)" in Sage to "f(..., x)" in Macaulay2.

Patches from #7897 are a prerequisite for this one.
Patch from #5467 is independent, but relevant and trivial, so please try to review it too if you are interested in this one.

Component: interfaces

Keywords: Macaulay2, interface, TAB-completion

Author: Andrey Novoseltsev

Reviewer: Mike Hansen

Merged: sage-4.5.2.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/7915

@novoselt
Copy link
Member Author

comment:1

Attachment: macaulay2_improved_tab.patch.gz

@novoselt
Copy link
Member Author

novoselt commented Feb 1, 2010

@novoselt
Copy link
Member Author

novoselt commented Feb 1, 2010

comment:2

Changed the patch name and the commit message to contain the ticket number.

@novoselt

This comment has been minimized.

@novoselt novoselt added this to the sage-4.4 milestone Apr 11, 2010
@mwhansen
Copy link
Contributor

mwhansen commented Jul 9, 2010

Reviewer: Mike Hansen

@mwhansen
Copy link
Contributor

mwhansen commented Jul 9, 2010

comment:5

Looks good to me.

@qed777
Copy link
Mannequin

qed777 mannequin commented Jul 21, 2010

Merged: sage-4.5.2.alpha0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants