ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 27 Dec 2020 18:09:57 +0100sage-shell-mode positions cursor incorrectlyhttps://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/Hi
After clean `apt-get install` of Sage 9.0 on Ubuntu 20.04 and cloning the latest `sage-shell-mode` git repository I find that running sage within Emacs 26.3 results in the prompt being positioned to the far right of the screen with preceding spaces. After each command the cursor is positioned to the far right of the screen. I have filed a bug report (issue 56). I would be grateful if anyone is familiar with the problem, and could point me to any known work around.
The problem is reproducible with a bare minimum `.emacs` file shown below
<pre><code>
;; Add local elisp directory and sub-directories to load-path
(let ((default-directory "~/.elisp/"))
(normal-top-level-add-subdirs-to-load-path))
;;-------------------------------------------------------------------
;; Sagemath mode
(require 'sage-shell-mode)
(setq sage-shell:use-prompt-toolkit t)
(setq sage-shell:sage-root "/usr/share/sagemath")
(setq sage-shell:sage-executable "/usr/bin/sage")
;; Run SageMath by M-x run-sage instead of M-x sage-shell:run-sage
(sage-shell:define-alias)
;; Turn on eldoc-mode in Sage terminal and in Sage source files
(add-hook 'sage-shell-mode-hook #'eldoc-mode)
(add-hook 'sage-shell:sage-mode-hook #'eldoc-mode)
;; Enable inline plots and LaTeX preview
(require 'sage-shell-view)
(setq sage-shell-view-default-commands 'output)
(setq sage-shell-view-default-commands 'plot)
(add-hook 'sage-shell-after-prompt-hook #'sage-shell-view-mode)
</code></pre>
regards
ThomasThu, 24 Dec 2020 16:39:33 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/Comment by slelievre for <p>Hi</p>
<p>After clean <code>apt-get install</code> of Sage 9.0 on Ubuntu 20.04 and cloning the latest <code>sage-shell-mode</code> git repository I find that running sage within Emacs 26.3 results in the prompt being positioned to the far right of the screen with preceding spaces. After each command the cursor is positioned to the far right of the screen. I have filed a bug report (issue 56). I would be grateful if anyone is familiar with the problem, and could point me to any known work around. </p>
<p>The problem is reproducible with a bare minimum <code>.emacs</code> file shown below</p>
<pre><code>
;; Add local elisp directory and sub-directories to load-path
(let ((default-directory "~/.elisp/"))
(normal-top-level-add-subdirs-to-load-path))
;;-------------------------------------------------------------------
;; Sagemath mode
(require 'sage-shell-mode)
(setq sage-shell:use-prompt-toolkit t)
(setq sage-shell:sage-root "/usr/share/sagemath")
(setq sage-shell:sage-executable "/usr/bin/sage")
;; Run SageMath by M-x run-sage instead of M-x sage-shell:run-sage
(sage-shell:define-alias)
;; Turn on eldoc-mode in Sage terminal and in Sage source files
(add-hook 'sage-shell-mode-hook #'eldoc-mode)
(add-hook 'sage-shell:sage-mode-hook #'eldoc-mode)
;; Enable inline plots and LaTeX preview
(require 'sage-shell-view)
(setq sage-shell-view-default-commands 'output)
(setq sage-shell-view-default-commands 'plot)
(add-hook 'sage-shell-after-prompt-hook #'sage-shell-view-mode)
</code></pre>
<p>regards
Thomas</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54888#post-id-54888Welcome to Ask Sage! Thank you for your question!Fri, 25 Dec 2020 01:08:56 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54888#post-id-54888Answer by Emmanuel Charpentier for <p>Hi</p>
<p>After clean <code>apt-get install</code> of Sage 9.0 on Ubuntu 20.04 and cloning the latest <code>sage-shell-mode</code> git repository I find that running sage within Emacs 26.3 results in the prompt being positioned to the far right of the screen with preceding spaces. After each command the cursor is positioned to the far right of the screen. I have filed a bug report (issue 56). I would be grateful if anyone is familiar with the problem, and could point me to any known work around. </p>
<p>The problem is reproducible with a bare minimum <code>.emacs</code> file shown below</p>
<pre><code>
;; Add local elisp directory and sub-directories to load-path
(let ((default-directory "~/.elisp/"))
(normal-top-level-add-subdirs-to-load-path))
;;-------------------------------------------------------------------
;; Sagemath mode
(require 'sage-shell-mode)
(setq sage-shell:use-prompt-toolkit t)
(setq sage-shell:sage-root "/usr/share/sagemath")
(setq sage-shell:sage-executable "/usr/bin/sage")
;; Run SageMath by M-x run-sage instead of M-x sage-shell:run-sage
(sage-shell:define-alias)
;; Turn on eldoc-mode in Sage terminal and in Sage source files
(add-hook 'sage-shell-mode-hook #'eldoc-mode)
(add-hook 'sage-shell:sage-mode-hook #'eldoc-mode)
;; Enable inline plots and LaTeX preview
(require 'sage-shell-view)
(setq sage-shell-view-default-commands 'output)
(setq sage-shell-view-default-commands 'plot)
(add-hook 'sage-shell-after-prompt-hook #'sage-shell-view-mode)
</code></pre>
<p>regards
Thomas</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?answer=54893#post-id-54893`Sage` 9.2.beta8 broke `sage-shell-mode` compatibility with `emacs` by upgrading `Ipython`. A patch was created and proposed on a pull request on Aug 125, 2020. It has not yet been reviewed as of Dec 25, 2020.
In the interim, feel free to try my [fork](https://github.com/EmmanuelCharpentier/sage-shell-mode), source of the pull request.
**EDIT :** The patch just got merged in the main tree, and should diffuse to normal channels (i. e. MELPA) in due time.
**Re-EDIT :** The patched version has diffused to MELPA. My fork is no longer necessary.
HTH,Fri, 25 Dec 2020 11:01:20 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?answer=54893#post-id-54893Comment by bthomas for <p><code>Sage</code> 9.2.beta8 broke <code>sage-shell-mode</code> compatibility with <code>emacs</code> by upgrading <code>Ipython</code>. A patch was created and proposed on a pull request on Aug 125, 2020. It has not yet been reviewed as of Dec 25, 2020.</p>
<p>In the interim, feel free to try my <a href="https://github.com/EmmanuelCharpentier/sage-shell-mode">fork</a>, source of the pull request.</p>
<p><strong>EDIT :</strong> The patch just got merged in the main tree, and should diffuse to normal channels (i. e. MELPA) in due time.</p>
<p><strong>Re-EDIT :</strong> The patched version has diffused to MELPA. My fork is no longer necessary.</p>
<p>HTH,</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54904#post-id-54904Thank you for your response.
I just pulled latest git master. Sage version 9.0 does not seem to support "simple-prompt". So after setting `(setq sage-shell::sage-simple-prompt nil)` and executing `M-x run-sage`, I find the problem still occurs. Although looks like with a few less spaces.Sat, 26 Dec 2020 00:38:14 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54904#post-id-54904Comment by slelievre for <p><code>Sage</code> 9.2.beta8 broke <code>sage-shell-mode</code> compatibility with <code>emacs</code> by upgrading <code>Ipython</code>. A patch was created and proposed on a pull request on Aug 125, 2020. It has not yet been reviewed as of Dec 25, 2020.</p>
<p>In the interim, feel free to try my <a href="https://github.com/EmmanuelCharpentier/sage-shell-mode">fork</a>, source of the pull request.</p>
<p><strong>EDIT :</strong> The patch just got merged in the main tree, and should diffuse to normal channels (i. e. MELPA) in due time.</p>
<p><strong>Re-EDIT :</strong> The patched version has diffused to MELPA. My fork is no longer necessary.</p>
<p>HTH,</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54912#post-id-54912By pulling the latest git master, you mean of sage-shell-mode, right?
Try using a more recent Sage version? You can easily get Sage 9.2 via Conda or Docker, or by downloading binaries for Ubuntu 20.04 from the Linux download page on the Sage website..Sat, 26 Dec 2020 01:59:40 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54912#post-id-54912Comment by Emmanuel Charpentier for <p><code>Sage</code> 9.2.beta8 broke <code>sage-shell-mode</code> compatibility with <code>emacs</code> by upgrading <code>Ipython</code>. A patch was created and proposed on a pull request on Aug 125, 2020. It has not yet been reviewed as of Dec 25, 2020.</p>
<p>In the interim, feel free to try my <a href="https://github.com/EmmanuelCharpentier/sage-shell-mode">fork</a>, source of the pull request.</p>
<p><strong>EDIT :</strong> The patch just got merged in the main tree, and should diffuse to normal channels (i. e. MELPA) in due time.</p>
<p><strong>Re-EDIT :</strong> The patched version has diffused to MELPA. My fork is no longer necessary.</p>
<p>HTH,</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54920#post-id-54920> Sage version 9.0 does not seem to support "simple-prompt"
This is, IIRC cared for in the initialization code
Anyway, upgrading to Sage > 9.1 is recommended, for much stronger reasons (Python 3....).Sat, 26 Dec 2020 09:36:00 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54920#post-id-54920Comment by Emmanuel Charpentier for <p><code>Sage</code> 9.2.beta8 broke <code>sage-shell-mode</code> compatibility with <code>emacs</code> by upgrading <code>Ipython</code>. A patch was created and proposed on a pull request on Aug 125, 2020. It has not yet been reviewed as of Dec 25, 2020.</p>
<p>In the interim, feel free to try my <a href="https://github.com/EmmanuelCharpentier/sage-shell-mode">fork</a>, source of the pull request.</p>
<p><strong>EDIT :</strong> The patch just got merged in the main tree, and should diffuse to normal channels (i. e. MELPA) in due time.</p>
<p><strong>Re-EDIT :</strong> The patched version has diffused to MELPA. My fork is no longer necessary.</p>
<p>HTH,</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54921#post-id-54921And, BTW :
> I just pulled latest git master
My patch is in the `simple prompt` branch of my forked tree ; `master` is untouched (necessary to submit a PR through Github's baroque mechanisms...).
Again, this has now been merged in the `master` branch of the version distributed by MELPA.
HTH,Sat, 26 Dec 2020 12:03:09 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?comment=54921#post-id-54921Answer by bthomas for <p>Hi</p>
<p>After clean <code>apt-get install</code> of Sage 9.0 on Ubuntu 20.04 and cloning the latest <code>sage-shell-mode</code> git repository I find that running sage within Emacs 26.3 results in the prompt being positioned to the far right of the screen with preceding spaces. After each command the cursor is positioned to the far right of the screen. I have filed a bug report (issue 56). I would be grateful if anyone is familiar with the problem, and could point me to any known work around. </p>
<p>The problem is reproducible with a bare minimum <code>.emacs</code> file shown below</p>
<pre><code>
;; Add local elisp directory and sub-directories to load-path
(let ((default-directory "~/.elisp/"))
(normal-top-level-add-subdirs-to-load-path))
;;-------------------------------------------------------------------
;; Sagemath mode
(require 'sage-shell-mode)
(setq sage-shell:use-prompt-toolkit t)
(setq sage-shell:sage-root "/usr/share/sagemath")
(setq sage-shell:sage-executable "/usr/bin/sage")
;; Run SageMath by M-x run-sage instead of M-x sage-shell:run-sage
(sage-shell:define-alias)
;; Turn on eldoc-mode in Sage terminal and in Sage source files
(add-hook 'sage-shell-mode-hook #'eldoc-mode)
(add-hook 'sage-shell:sage-mode-hook #'eldoc-mode)
;; Enable inline plots and LaTeX preview
(require 'sage-shell-view)
(setq sage-shell-view-default-commands 'output)
(setq sage-shell-view-default-commands 'plot)
(add-hook 'sage-shell-after-prompt-hook #'sage-shell-view-mode)
</code></pre>
<p>regards
Thomas</p>
https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?answer=54953#post-id-54953For whatever it is worth, I was able to find a work around on Ubuntu 20.04 using the prepackaged Sage 9.0. The trick is to
follow the advice on [issue 52](https://github.com/sagemath/sage-shell-mode/issues/52) by editing the line `exec sage-ipython "$@" -i` in `/usr/bin/sage` and changing it to `exec sage-ipython "$@" --simple-prompt -i` . It is also necessary to add `(setq sage-shell::sage-simple-prompt nil)` to the `.emacs` file. All this was found to work with the latest `sage-shell-mode` version from its git repository that had Emmanuel Charpentier's patches merged in. Sun, 27 Dec 2020 18:09:57 +0100https://ask.sagemath.org/question/54882/sage-shell-mode-positions-cursor-incorrectly/?answer=54953#post-id-54953