Opened 3 years ago

Last modified 3 years ago

#21227 new defect

sage-mode broken in Sage 7.4. sage-shell-mode is the future?

Reported by: mantepse Owned by:
Priority: major Milestone:
Component: user interface Keywords: sage_mode, sage-mode
Cc: darthandrus@…, jsrn, vbraun, dimpase, fbissey, charpent, stakemori Merged in:
Authors: Reviewers:
Report Upstream: Reported upstream. No feedback yet. Work issues:
Branch: u/mkoeppe/sage_mode_for_emacs_has_display_problem_in_sage_7_4_beta0 (Commits) Commit: 92378caa0c1a030b9399e889f42edb5afc8c6d87
Dependencies: Stopgaps:

Description

On sage 7.4 beta0, emacs GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07 on lamiak, modified by Debian, beloved sage_mode 0.14 is broken. All in and output except the banner is unreadable!

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 7.4.beta0, Release Date: 2016-08-10               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
[?12l [?25h1+1
[J [?7h [?12l [?25h [?2004l [?7h2
[?12l [?25h

Change History (72)

comment:1 Changed 3 years ago by mantepse

Leif mentioned on sage-devel:

3) Probably disable the color mode. 

I'm not sure what he means with that, but just typing %colors NoColor after the weird sage prompt doesn't help.

comment:2 Changed 3 years ago by leif

You may play with (settings in)

sage: %config SageTerminalInteractiveShell

comment:3 Changed 3 years ago by leif

(Sage 7.4.beta0 upgraded IPython to 5.0, see #21006.)

comment:4 Changed 3 years ago by jsrn

  • Cc jsrn added

comment:5 Changed 3 years ago by mkoeppe

  • Cc vbraun added

Here's a simple change that enables "simple prompts" when sage is run within an Emacs inferior shell. However, as has been noted here, the "simple prompts" mode lacks multi-line support, so one gets this:

In [1]: def f(x):
  File "<ipython-input-1-cde3fd95d55b>", line 1
    def f(x):
             ^
SyntaxError: unexpected EOF while parsing
  • src/sage/repl/interpreter.py

    diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py
    index 1f4eda7..1d69829 100644
    a b class SageTerminalInteractiveShell(SageShellOverride, TerminalInteractiveShell): 
    248248        <sage.repl.interpreter.SageNotebookInteractiveShell object at 0x...>
    249249    """
    250250
     251    def init_prompt_toolkit_cli(self):
     252        """
     253        Use plain non-interactive output if TERM=dumb (as in an Emacs inferior shell)
     254        """
     255        if os.environ['TERM'] == 'dumb':
     256            self.simple_prompt = True
     257        return super(SageTerminalInteractiveShell, self).init_prompt_toolkit_cli()
     258
    251259    def init_display_formatter(self):
    252260        """
    253261        Switch to the Sage IPython commandline rich output backend

comment:6 Changed 3 years ago by mantepse

Thank you for this! At least I can work again!

comment:7 Changed 3 years ago by mkoeppe

  • Branch set to u/mkoeppe/sage_mode_for_emacs_has_display_problem_in_sage_7_4_beta0

comment:8 Changed 3 years ago by mkoeppe

  • Commit set to 92378caa0c1a030b9399e889f42edb5afc8c6d87
  • Report Upstream changed from N/A to Reported upstream. No feedback yet.

I've opened an IPython issue for this: https://github.com/ipython/ipython/issues/9886


New commits:

92378caFix for sage shell with TERM=dumb

comment:9 Changed 3 years ago by mkoeppe

  • Cc dimpase fbissey added

comment:10 Changed 3 years ago by charpent

  • Cc charpent added

comment:11 Changed 3 years ago by charpent

A few remarks :

  • The current patch waits endlessly for a prompt.
  • When interrupted (C-G), it gives a functional prompt : the Sage REPL is working.
  • When inline plots are enabled, they are displayed, but the sustems claims (falsely) to have launced a png viewer.
  • When tyepeset output is enabled in the menu, the output is displayed as text :
    In [24]: integrate(arctan(x),x)
    
    
    BEGIN_TEXT:x*arctan(x) - 1/2*log(x^2 + 1):END_TEXT
    BEGIN_LATEX:\newcommand{\Bold}[1]{\mathbf{#1}}x \arctan\left(x\right) - \frac{1}{2} \, \log\left(x^{2} + 1\right):END_LATEX
    
  • Ditto when using the %display typeset magic...

"Oooohhh, so clooose..."

HTH,

comment:12 Changed 3 years ago by mantepse

  • Priority changed from major to blocker

I'm making this a blocker, because without fix sage would loose a frontend which is used by not so few. I also tried the ipython 5.0 branch of https://github.com/stakemori/sage-shell-mode, but could not (yet) get it to work. (Install went OK, but I cannot even evaluate 1+1.)

comment:13 Changed 3 years ago by mantepse

  • Summary changed from sage_mode for emacs has display problem in sage 7.4 beta0 to No emacs interface anymore in sage 7.4 beta0: both sage_mode and sage-shell-mode broken

comment:14 follow-up: Changed 3 years ago by stakemori

I've pushed fixes to the master branch of sage-shell-mode. sage-shell-mode was fixed. To use sage-shell-mode with Sage7.4 beta0, please set sage-shell:use-prompt-toolkit to t.

As for the patch, could you use an environment variable other than TERM? (IPython uses IPY_TEST_SIMPLE_PROMPT for the same purpose). If this is merged, sage-shell-mode is forced to use the simple prompt. And I don't want to use the simple prompt inside Emacs.

I think sage-mode (or inferior-python-mode) has to implement its own process filter function to fix this bug (without using simple prompt). IPython sends escape sequences that delete text or move the cursor position. So just ignoring escape sequences doesn't work. comint-mode cannot handle escape sequences well, but term-mode can handle them very well. So I imitated term-mode.

Last edited 3 years ago by stakemori (previous) (diff)

comment:15 Changed 3 years ago by stakemori

  • Cc stakemori added

comment:16 in reply to: ↑ 14 ; follow-up: Changed 3 years ago by mkoeppe

Replying to stakemori:

I've pushed fixes to the master branch of sage-shell-mode. sage-shell-mode was fixed. To use sage-shell-mode with Sage7.4 beta0, please set sage-shell:use-prompt-toolkit to t.

As for the patch, could you use an environment variable other than TERM? (IPython uses IPY_TEST_SIMPLE_PROMPT for the same purpose). If this is merged, sage-shell-mode is forced to use the simple prompt. And I don't want to use the simple prompt inside Emacs.

I think sage-mode (or inferior-python-mode) has to implement its own process filter function to fix this bug (without using simple prompt). IPython sends escape sequences that delete text or move the cursor position. So just ignoring escape sequences doesn't work. comint-mode cannot handle escape sequences well, but term-mode can handle them very well. So I imitated term-mode.

Well, term-mode does not set TERM=dumb. It sets TERM=eterm-color. So?

comment:17 in reply to: ↑ 16 ; follow-up: Changed 3 years ago by stakemori

Sorry. I don't understand your question. What I meant is that the process filter function in term-mode (term-emulate-terminal) handles escape sequences very well. sage-shell-mode is also derived from comint-mode.

comment:18 in reply to: ↑ 17 ; follow-up: Changed 3 years ago by mkoeppe

Replying to stakemori:

Sorry. I don't understand your question. What I meant is that the process filter function in term-mode (term-emulate-terminal) handles escape sequences very well. sage-shell-mode is also derived from comint-mode.

What I'm saying is that:

  • term-mode sets TERM=eterm-color and so, even with the patch on this ticket, no "simple prompts" are used.
  • comint-mode does not handle escape sequences. Therefore it sets TERM=dumb to inform the applications running under it about this fact.
  • If your mode, derived from comint-mode, handles escape sequences, then it should not be using TERM=dumb but rather something else; perhaps TERM=vt100.

comment:19 in reply to: ↑ 18 Changed 3 years ago by stakemori

Thanks for your explanation. I will change it to other than dumb.

comment:20 follow-up: Changed 3 years ago by mkoeppe

Unfortunately IPython/Prompt Toolkit don't handle the TERM variable. I've just reported another upstream issue here (in addition to the IPython one, which so far has been ignored): https://github.com/jonathanslenders/python-prompt-toolkit/issues/390

comment:21 follow-up: Changed 3 years ago by mantepse

I am so grateful that you are working on this! I'm documenting here how it went, following Installation and Setup in README.org:

  1. perfect
  2. perfect
  3. set sage-shell:use-prompt-toolkit to non-nil I wanted to use customize, but it complains:
    Creating customization items...
    widget-apply: Symbol's function definition is void: nil
    
  4. doing M-x sage-shell:run-sage I get sage-shell:-window-max-chars-per-line: Wrong number of arguments: window-body-width, 2

comment:22 in reply to: ↑ 21 ; follow-up: Changed 3 years ago by stakemori

Thanks. I've pushed fix to master. But it will take a few hours for Melpa to rebuild the recipe. As for 3, please put (setq sage-shell:use-prompt-toolkit t) in your configuration file.

According to the error message, it seems that you are using Emacs older than 24.4. Please use Emacs 24.4 or later.

comment:23 in reply to: ↑ 22 Changed 3 years ago by mantepse

Replying to stakemori:

Thanks. I've pushed fix to master. But it will take a few hours for Melpa to rebuild the recipe. As for 3, please put (setq sage-shell:use-prompt-toolkit t) in your configuration file.

According to the error message, it seems that you are using Emacs older than 24.4. Please use Emacs 24.4 or later.

Indeed, 24.3.1...

I'm a bit afraid of upgrading, but I guess I'll do it :-)

comment:24 Changed 3 years ago by mantepse

I did it (not quite sure yet whether I like Ubuntu 16.04...)

Anyway: M-x sage-shell:run-sage starts sage and I can evaluate stuff.

  • I have no tab-completion (the modeline says: "No match")
  • sending a buffer to the *sage* buffer breaks emacs (Error running timer: (wrong-type-argument bufferp nil) occupies the modeline and won't go away anymore.

thanks for helping!

comment:25 Changed 3 years ago by stakemori

tab-completion and sending buffer work for me (http://i.imgur.com/LL6vm3b.png). I am not sure why such an error occurs.

comment:26 Changed 3 years ago by stakemori

Can you reproduce this even if only sage-shell-mode is loaded? If so, could you tell me the Emacs version and a recipe for reproducing?

comment:27 follow-up: Changed 3 years ago by mantepse

I am using sage 7.4.beta1 with the patch on this ticket applied, emacs is 24.5.1. Running emacs -q and then in *scratch*:

(require 'package)
package

(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(("melpa" . "https://melpa.org/packages/") ("gnu" . "http://elpa.gnu.org/packages/"))

(package-initialize)
t
(setq sage-shell:use-prompt-toolkit 'T)
T
(setq sage-shell:sage-root "~/SAGE")
"~/SAGE"

and finally

M-x sage-shell:run-sage

gives

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 7.4.beta1, Release Date: 2016-08-17               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
In [1]: 12.is

but no tab-completion.

comment:28 in reply to: ↑ 27 Changed 3 years ago by stakemori

Thanks. I have not implemented the simple prompts feature. So sage-shell-mode does not work well with the patch. The latest sage-shell-mode in MELPA sets TERM to emacs. Please upgrade sage-shell-mode by M-x package-list-packages, U and x. The problem still persists?

comment:29 in reply to: ↑ 20 ; follow-up: Changed 3 years ago by stakemori

It seems that sage-shell-mode must set TERM to dumb. sage-shell-mode is not a full terminal emulator. It can handle a part of escape sequences but not all. Also it doesn't handle pager. I set TERM to emacs, but the clear command shows an error message. Again, could you use an environment variable other than TERM in the patch?

comment:30 follow-up: Changed 3 years ago by mantepse

I'm confused now. Is sage-shell-mode working on your computer without the patch in this ticket? (I thought that "simple prompts" is not a feature, but a workaround.)

comment:31 in reply to: ↑ 30 Changed 3 years ago by stakemori

Replying to mantepse:

I'm confused now. Is sage-shell-mode working on your computer without the patch in this ticket? (I thought that "simple prompts" is not a feature, but a workaround.)

Yes. So sage-shell-mode support multi-line input (though there exits a minor issue. See https://github.com/stakemori/sage-shell-mode/issues/7).

sage-shell-mode can handle a part of escape sequences related to text modification and cursor movement. If sage-shell:use-prompt-toolkit is non-nil, then I assume Sage is not using simple prompt or GNU readline. I will also support simple prompt in future.

comment:32 follow-up: Changed 3 years ago by mantepse

Wow! I think you are getting very close!

  • tab completion works
  • sending a buffer with C-c C-c to the sage buffer works, also loading a file with C-c C-l works.

A little suggestion: if the current buffer is a visited file in sage mode, it would be nice to have C-c C-c load the file instead, asking whether to save the buffer if necessary. Because:

sage: load('/tmp/sage_shell_mode17030j9Q/sage_shell_mode_temp.sage')

doesn't give me a clue which file I actually loaded!

  • unfortunately, sending a line to sage does not work correctly:
    sage: load('/tmp/sage_shell_mode17030j9Q/sage_shell_mode_temp.py')
      File "/tmp/sage_shell_mode17030j9Q/sage_shell_mode_temp.py", line 3
        sage: fricas('3 * 5')                                                       # optional - fricas
            ^
    SyntaxError: invalid syntax
    

I think it doesn't strip the "sage:" anymore - was this done by ipython before?

comment:33 in reply to: ↑ 32 ; follow-ups: Changed 3 years ago by stakemori

Thank you for trying.

To fix this issue, I had to changed basic functions of this mode. So there may be such problems. Sorry.

unfortunately, sending a line to sage does not work correctly:

M-x sage-shell-edit:send-line* doesn't work? If it works, I will replace the command.

A little suggestion: if the current buffer is a visited file in sage mode, it would be nice to have C-c C-c load the file instead, asking whether to save the buffer if necessary.

Thank you for the suggestion. I will consider about it.

comment:34 in reply to: ↑ 33 ; follow-up: Changed 3 years ago by mantepse

Replying to stakemori:

Thank you for trying.

To fix this issue, I had to changed basic functions of this mode. So there may be such problems. Sorry.

Hey, your work is fantastic! I have no idea what I would have done without you!

unfortunately, sending a line to sage does not work correctly:

M-x sage-shell-edit:send-line* doesn't work? If it works, I will replace the command.

Great! M-x sage-shell-edit:send-line* (with the asterisk!) does the right thing!

comment:35 in reply to: ↑ 34 ; follow-up: Changed 3 years ago by stakemori

Hey, your work is fantastic! I have no idea what I would have done without you!

Thank you very much! I am very glad that sage-shell-mode works on your computer.

By the way, it would be great if I (or someone) could write a process filter function for sage-mode (or python-mode) that handles escape sequence. In future, I may write one (but to be honest, I do not want to fix this twice. It was harder than I thought).

comment:36 follow-up: Changed 3 years ago by mantepse

why would you want to handle escape sequences?

comment:37 in reply to: ↑ 35 ; follow-up: Changed 3 years ago by jsrn

Replying to stakemori:

By the way, it would be great if I (or someone) could write a process filter function for sage-mode (or python-mode) that handles escape sequence. In future, I may write one (but to be honest, I do not want to fix this twice. It was harder than I thought).

I'm currently a sage-mode user and would be interested in getting it to work again. But my knowledge of terminals and the details of comint-mode is not very extensive, and I've lost track of what changes were necessary to make sage-shell-mode work again. How difficult would you estimate porting your fixes would be?

But perhaps rather: should we take this as a cue to merge the efforts of sage-shell-mode and sage-mode; after all, they're trying to do more or less the same. The current maintainer of sage-mode is Ivan Andrus but my impression is that he is really only maintaining - not developing. sage-shell-mode is much more vibrant in comparison! My impression is that sage-shell-mode currently does completion better than sage-mode, but sage-mode can render latex and images. There might also be small differences in how editing directly in the shell works?

My own contributions to sage-mode are modest: I've written the current help file/landing page, I wrote a small set of functions, sage-blocks.el, for giving light-weight notebook-like editing, and I've helped report and track down some bugs. Rather than porting fixes to sage-mode, I would be interested in trying out sage-shell-mode and lending a hand on implementing the features that would make it a great alternative for current sage-mode users. I'm also an eVil-user, so I would naturally be testing/modding sage-shell-mode to work under those conditions.

Best, Johan

comment:38 in reply to: ↑ 36 Changed 3 years ago by stakemori

Replying to mantepse:

why would you want to handle escape sequences?

I don't want to handle escape sequences if possible. But developers of IPython choose prompt_toolkit rather than readline and prompt_toolkit uses a lot of escape sequences. Therefore I think sage-shell-mode should handle them. And I don't want to use the simple prompt workaround at the moment.

comment:39 in reply to: ↑ 37 ; follow-up: Changed 3 years ago by stakemori

I'm currently a sage-mode user and would be interested in getting it to work again. But my knowledge of terminals and the details of comint-mode is not very extensive, and I've lost track of what changes were necessary to make sage-shell-mode work again. How difficult would you estimate porting your fixes would be?

If you use the simple prompt workaround, then I guess it would be easy to fix sage-mode. But you might lose some features because of the workaround (Above, charpent remarked that

"When inline plots are enabled, they are displayed, but the sustems claims (falsely) to have launced a png viewer."

I am not sure if it is because of the workaround).

If you don't use the workaround, then it would be not so easy to fix it. Most important point is to implement a process filter function. comint-output-filter doesn't work. If you want to implement it, you could copy code in sage-shell-mode and I could help you.

But perhaps rather: should we take this as a cue to merge the efforts of sage-shell-mode and sage-mode; after all, they're trying to do more or less the same. The current maintainer of sage-mode is Ivan Andrus but my impression is that he is really only maintaining - not developing. sage-shell-mode is much more vibrant in comparison! My impression is that sage-shell-mode currently does completion better than sage-mode, but sage-mode can render latex and images. There might also be small differences in how editing directly in the shell works?

I am OK with merging. I would be glad if sage-shell-mode could render latex and images. I have exchanged email with Ivan Andrus a few years ago. He was also writing about merging. I guess he also might agree with merging.

I do not understand sage-blocks.el very well. Is it similar to ob-sagemath (https://github.com/stakemori/ob-sagemath)? And I would be very happy if you contributed to sage-shell-mode.

comment:40 in reply to: ↑ 39 ; follow-up: Changed 3 years ago by jsrn

Replying to stakemori:

If you don't use the workaround, then it would be not so easy to fix it. Most important point is to implement a process filter function. comint-output-filter doesn't work. If you want to implement it, you could copy code in sage-shell-mode and I could help you.

OK, thanks. I'll first try to see if sage-shell-mode could be a replacement for me.

I am OK with merging. I would be glad if sage-shell-mode could render latex and images. I have exchanged email with Ivan Andrus a few years ago. He was also writing about merging. I guess he also might agree with merging.

OK.

I do not understand sage-blocks.el very well. Is it similar to ob-sagemath (https://github.com/stakemori/ob-sagemath)?

It's much simpler than that: it simply assumes that the user has logically separated his source file using markers (### by default), each of which we call a "block". Then there are keybindings for dealing with these: moving up/down block-wise and sending the current block to the shell. This is extremely handy for the way I develop Sage. It's so simple that it would be easy to port to sage-shell-mode, I'm sure.

And I would be very happy if you contributed to sage-shell-mode.

As a first approximation, I've cloned sage-shell-mode and I'm trying it out. As you've already seen I'll post Issues when I hit funky behaviour ;-)

Thanks for your hard work on this!

Best, Johan

comment:41 in reply to: ↑ 33 ; follow-up: Changed 3 years ago by mantepse

unfortunately, sending a line to sage does not work correctly:

M-x sage-shell-edit:send-line* doesn't work? If it works, I will replace the command.

That would be great!

Another tiny problem: saying

(sage-shell:define-alias)

in .emacs doesn't work - must it be in .emacs.d/init.el?

Warning (initialization): An error occurred while loading `/home/martin/.emacs':

Symbol's function definition is void: sage-shell:define-alias

comment:42 in reply to: ↑ 29 ; follow-up: Changed 3 years ago by mkoeppe

Replying to stakemori:

It seems that sage-shell-mode must set TERM to dumb. sage-shell-mode is not a full terminal emulator. It can handle a part of escape sequences but not all. Also it doesn't handle pager. I set TERM to emacs, but the clear command shows an error message. Again, could you use an environment variable other than TERM in the patch?

But I don't have control over the environment variables that are set within a M-x shell in emacs.

comment:43 in reply to: ↑ 42 ; follow-up: Changed 3 years ago by mkoeppe

Replying to mkoeppe:

Replying to stakemori:

It seems that sage-shell-mode must set TERM to dumb. sage-shell-mode is not a full terminal emulator. It can handle a part of escape sequences but not all. Also it doesn't handle pager. I set TERM to emacs, but the clear command shows an error message. Again, could you use an environment variable other than TERM in the patch?

But I don't have control over the environment variables that are set within a M-x shell in emacs.

Here's a reference that may be helpful in choosing the right TERM that reflects what you implemented. http://invisible-island.net/ncurses/terminfo.src.html

comment:44 in reply to: ↑ 40 Changed 3 years ago by stakemori

It's much simpler than that: it simply assumes that the user has logically separated his source file using markers (### by default), each of which we call a "block". Then there are keybindings for dealing with these: moving up/down block-wise and sending the current block to the shell. This is extremely handy for the way I develop Sage. It's so simple that it would be easy to port to sage-shell-mode, I'm sure.

Thank you for explanation. It looks very convenient.

comment:45 in reply to: ↑ 41 ; follow-up: Changed 3 years ago by stakemori

Replying to mantepse:

unfortunately, sending a line to sage does not work correctly:

M-x sage-shell-edit:send-line* doesn't work? If it works, I will replace the command.

That would be great!

Another tiny problem: saying

(sage-shell:define-alias)

in .emacs doesn't work - must it be in .emacs.d/init.el?

Warning (initialization): An error occurred while loading `/home/martin/.emacs':

Symbol's function definition is void: sage-shell:define-alias

It is OK to use .emacs. Place is not a problem, the order of evaluation is a problem. You should evaluate (package-initialize) before evaluating (sage-shell:define-alias). I hope this helps.

comment:46 in reply to: ↑ 43 Changed 3 years ago by stakemori

Here's a reference that may be helpful in choosing the right TERM that reflects what you implemented. ​http://invisible-island.net/ncurses/terminfo.src.html

Thank you. It looks very helpful. I will read it carefully.

comment:47 in reply to: ↑ 45 Changed 3 years ago by mantepse

Replying to stakemori:

It is OK to use .emacs. Place is not a problem, the order of evaluation is a problem. You should evaluate (package-initialize) before evaluating (sage-shell:define-alias). I hope this helps.

Yes, it does! You are my emacs 24 hero!

Martin

comment:48 follow-up: Changed 3 years ago by iandrus

I would be happy to combine sage-mode and sage-shell-mode. I quite like sage-mode, but I haven't had much time for working on it, and don't forsee that I will in the future either. Sage users deserve something that's maintained.

Long ago I wrote a feature comparison at https://wiki.sagemath.org/SageModeComparison but it's probably out of date. For example, I think sage-shell-mode recently got blocks. If that's the case then the things to port from sage-mode to

  • AUCTeX integration
    • This can probably be copied as-is or moved to a separate package entirely. I think it only references sage-mode once.
  • Inline plots and typeset output
    • This is somewhat intricate, but could probably be simplified by dropping support for ancient versions of Sage.
  • Doctesting and Building help
    • I'm less sure about how much work this will be.
Version 0, edited 3 years ago by iandrus (next)

comment:49 in reply to: ↑ 48 Changed 3 years ago by stakemori

Replying to iandrus:

Thank you very much! I also would be very glad if you could port those features to sage-shell-mode.

comment:50 Changed 3 years ago by mantepse

I suggest to close the ticket, since sage-shell-mode now works very well, as far as I can tell.

Thank you stakemori!

The optional package sage-mode does not work anymore, so it probably should be moved to experimental or something similar.

I have no idea how to do any of this, though.

comment:51 follow-up: Changed 3 years ago by mkoeppe

Let's keep this ticket open to keep track of the issues that I reported upstream with IPython and python-prompt-toolkit.

comment:52 Changed 3 years ago by jsrn

Considering the excellent state of sage-shell-mode and the Comment 48 by Ivan, perhaps we should also open a ticket for making sage-shell-mode the default package in Sage for Emacs, and move sage-mode to experimental or remove it.

comment:53 follow-up: Changed 3 years ago by stakemori

mantepse, you are welcome!

jsrn, thanks for the suggestion.

making sage-shell-mode the default package in Sage for Emacs

What does it exactly mean? It means editing the wiki or the link in http://www.sagemath.org/download-linux.html?

comment:54 in reply to: ↑ 53 ; follow-up: Changed 3 years ago by jsrn

making sage-shell-mode the default package in Sage for Emacs

What does it exactly mean? It means editing the wiki or the link in http://www.sagemath.org/download-linux.html?

Yes, something like:

  1. Modify the link http://www.sagemath.org/download-linux.html.
  2. Modify any other mention of sage-mode on sagemath.org.
  3. Modify any mention of sage-mode on the Sage wiki.
  4. Don't ship sage-mode together with Sage.
  5. Start shipping sage-emacs-mode with Sage? I vote yes.
  6. Modify references to sage-mode in source code (a grep found e.g. src/sage/repl/rich_output/backend_emacs.py which might be necessary for porting sage-view to sage-shell-mode).

Apart from that one could consider:

  1. In future sage-shell-mode releases, consider activating the aliases by default.
  2. Put a warning on the sage-mode bitbucket page that it no longer works?

comment:55 Changed 3 years ago by mantepse

Actually, given that iandrus agrees and is interested in having the remaining features of sage-mode merged into sage-shell-mode, and given that sage-mode is unlikely to be resurrected, wouldn't it be easier to make sage-mode an alias for sage-shell-mode?

comment:56 follow-up: Changed 3 years ago by stakemori

Thanks for making the list, jsrn.

Modify any other mention of sage-mode on sagemath.org.

Do you know how to do this? I don't know.

In future sage-shell-mode releases, consider activating the aliases by default.

To do this, sage-shell-mode has to renamed to sage-mode or sage. This is convention of elisp.

given that sage-mode is unlikely to be resurrected

If mkoeppe's request to prompt_toolkit is accepted, sage-mode will be resurrected. So concerning with alias or renaming, I will see how it goes for a while.

comment:57 Changed 3 years ago by mkoeppe

Renaming software is usually not a good idea, because it causes confusion.

comment:58 follow-up: Changed 3 years ago by mkoeppe

Is sage-shell-mode available on MELPA?

comment:59 in reply to: ↑ 58 Changed 3 years ago by stakemori

Replying to mkoeppe:

Is sage-shell-mode available on MELPA?

Yes. https://melpa.org/#/sage-shell-mode

comment:60 follow-up: Changed 3 years ago by mkoeppe

Great. Then there's probably no need to ship it with Sage (step 5 above), as installing via MELPA is probably the easiest way for users.

comment:61 in reply to: ↑ 60 Changed 3 years ago by stakemori

Replying to mkoeppe: I agree.

comment:62 in reply to: ↑ 56 ; follow-up: Changed 3 years ago by jsrn

Modify any other mention of sage-mode on sagemath.org.

Do you know how to do this? I don't know.

Hmm, no, sorry.

comment:63 in reply to: ↑ 62 Changed 3 years ago by stakemori

Replying to jsrn:

There is no need to apologize. Thanks.

I will ask how to do it at sage-devel. But before doing this, I would like iandrus's agreement with making sage-shell-mode the default package.

comment:64 follow-up: Changed 3 years ago by dimpase

to request updates to sagemath.org, submit a pull request with the proposed changes at https://github.com/sagemath/website

comment:65 in reply to: ↑ 64 Changed 3 years ago by stakemori

Replying to dimpase:

to request updates to sagemath.org, submit a pull request with the proposed changes at https://github.com/sagemath/website

Thank you very much for your information!

comment:66 in reply to: ↑ 54 Changed 3 years ago by jsrn

I think that Ivan was pretty clear on his stance: "Sage users deserve something that's maintained". In any case, thank you for your hard work on maintaining sage-mode these years, Ivan!

Replying to jsrn:

  1. Modify any mention of sage-mode on the Sage wiki.

I modified the pages https://wiki.sagemath.org/sage-mode, https://wiki.sagemath.org/Emacs and https://wiki.sagemath.org/SageModeComparison, but kept all of them for now. Later on we might prune and/or clean them further.

  1. Don't ship sage-mode together with Sage.
  2. Start shipping sage-emacs-mode with Sage? I vote yes.

I opened #21549 for this.

  1. Modify references to sage-mode in source code (a grep found e.g. src/sage/repl/rich_output/backend_emacs.py which might be necessary for porting sage-view to sage-shell-mode).

Until the sage-view features of sage-mode have been ported to sage-shell-mode, it is unclear to me how much of this will be used. I vote for just leaving it for now.

Apart from that one could consider:

  1. In future sage-shell-mode releases, consider activating the aliases by default.

As pointed out by stakemori, this is against Elisp conventions.

Best, Johan

comment:67 Changed 3 years ago by jsrn

  • Priority changed from blocker to major
  • Summary changed from No emacs interface anymore in sage 7.4 beta0: both sage_mode and sage-shell-mode broken to sage_mode broken in Sage 7.4. sage-shell-mode is the future?

I removed the "blocker" status since stakemori's hard work means we have a Sage mode again!

I also updated the title of the ticket. Perhaps this ticket will contain the changes to Sage documentation for making sage-shell-mode the official Emacs mode?

comment:68 Changed 3 years ago by mantepse

  • Keywords sage-mode added
  • Summary changed from sage_mode broken in Sage 7.4. sage-shell-mode is the future? to sage-mode broken in Sage 7.4. sage-shell-mode is the future?

comment:69 Changed 3 years ago by mantepse

I am quite sure it would be good (with iandrus permission, of course) to make sage-shell-mode the successor of sage-mode and rename it. The current function names are terrible to type.

comment:70 follow-up: Changed 3 years ago by stakemori

Thank you for your good work, Johan!

I sent a PR (https://github.com/sagemath/website/pull/95) to https://github.com/sagemath/website.

The current function names are terrible to type.

I try to make interactive function names shorter or define more aliases.

comment:71 in reply to: ↑ 70 Changed 3 years ago by mantepse

Replying to stakemori:

The current function names are terrible to type.

I try to make interactive function names shorter or define more aliases.

Sorry, I was unclear. What I meant is: without the aliases it's terrible, and it's easier for the user if she doesn't need to modify .emacs. But it's only a suggestion, personally I have no problem. Indeed, I am very happy. (special thanks for send-doctest, which I immediately bound to C-c C-j :-)

comment:72 in reply to: ↑ 51 Changed 3 years ago by mkoeppe

Replying to mkoeppe:

Let's keep this ticket open to keep track of the issues that I reported upstream with IPython and python-prompt-toolkit.

I've actually created a new ticket #21558 for that purpose. So it's OK with me if the present ticket is closed when items 1--3 are done.

Note: See TracTickets for help on using tickets.