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

Doesn't work with the Gnu port of emacs for Windows. #38

Open
EmmanuelCharpentier opened this issue Jan 10, 2018 · 4 comments
Open

Doesn't work with the Gnu port of emacs for Windows. #38

EmmanuelCharpentier opened this issue Jan 10, 2018 · 4 comments

Comments

@EmmanuelCharpentier
Copy link
Collaborator

What does work : using the cygwin port of emacs along with the cygwin version of sage.

What I tried :

  • Install the Gnu "native" port of emacs to Windows (works)
  • Compile Sage on Cygwin (works, sort-of : I can start sage (via a shell script) from the Windows command line and pass it whatever arguments I need, but sage -n jupyter fails, for entirely different reasons...)
  • Install sage_shell_mode on emacs (works)
  • run sage in sage_shell_mode : this fails, because I cant't think of a way to tell sage_shell_mode to start a shell script.

I have been able to build a cmd.exe shell script that starts sage in cygwin (with any argument it needs), passes keyboard input to Sage and prints answers in the Windows console. But sage_shell_mode does not accept it, and asks me to set sage-shell-sage-root and sage-shell:sage-executable correctly.

I suppose that this function wants an executable, not a script. I tried to pass cmd.exe /c <my_path>\\sage.cmd to sage-shell-sage-executable, to no avail.

Do you see a workaround for this ? I don't. And the previous solution essentially amounts to running the whole thing (Sage + Emacs + AUCTeX) on top of a Cygwin machine : not fun, and not efficient.

Icing on this unappetizing cake : I have to do that on a machine where I have no admin rights (dont ask : my administration has reasons unknown to Reason...;-). That's why I have to recompile Sage : the marvelous installer of Erik M. Bray needs admin rights.

Suggestions ?

@stakemori
Copy link
Collaborator

Thank you for detailed report. To use GNU port of Emacs with Sage on Cygwin, I think I have to modify sage-shell-mode.el. And I would like to try your cmd.exe shell script that starts Sage. Is it possible to show it to me?

@EmmanuelCharpentier
Copy link
Collaborator Author

Sorry for the late answer (I wasn't available the last two days). Here is my script :

@echo off
rem Start Sage from Windows' console
rem Current directory, cmd.exe syntax
for /F "usebackq tokens=*" %%i in (`cd`) do set CPW=%%i
rem Translation to Cygwin's path syntax
for /F "usebackq tokens=*" %%i in (`C:\Users\121235\Cygwin64\bin\cygpath.exe %CPW%`) do set CurPath=%%i
rem path to Mozilla : necessary for notebook display (currently unoperative, see EB).
set Moz=/cygdrive/c/Users/121235/AppData/Local/Mozilla\ Firefox/firefox.exe
rem Sage invocation
C:\Users\121235\Cygwin64\bin\bash.exe -l -c "cd %CurPath% && BROWSER=%Moz% sage %*"

I switched back to Cygwin's emacs, which can be started from Windows' command line by a similar script and can successfully use Sage. However, in this setup, the Notebook does not really work : Jupyter starts ; one can use Sage's Python in an notebook, but the Sage interpreter crashes and restarts immediately ==> no usable Sage notebook.

So I think that having sage_shell_mode able to start Sage from the native Windows port of emacs is still useful.

@stakemori
Copy link
Collaborator

Thanks. I will try this with gnu port of Emacs.

@stakemori
Copy link
Collaborator

I have a trouble when trying to work sage-shell-mode with the gnu port of Emacs (NTEmacs). This seems to be related to a bug (see https://www.emacswiki.org/emacs/NTEmacsWithCygwin) of NTEmacs and I don't know how to avoid it. I'm afraid that I have to wait until the bug is fixed.

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

2 participants