Differences between revisions 11 and 21 (spanning 10 versions)
Revision 11 as of 2014-09-18 16:29:32
Size: 1802
Editor: iandrus
Comment:
Revision 21 as of 2023-02-23 20:10:56
Size: 2804
Editor: mkoeppe
Comment: trac->gh
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
{{https://www.gnu.org/software/emacs/images/emacs.png||width=128px}}
Line 4: Line 6:
and developpers using the text editor Emacs. and developers using the text editor Emacs as an [[IDE]].
Line 6: Line 8:
== Sage-mode == == sage-shell-mode ==
Line 8: Line 10:
This emacs mode allows for running a Sage interpreter inside emacs,
and interacting with it sending in chunks of code or doctests,
directly opening the appropriate source files from the help, the
debugger or the tracebacks. It also provides goodies for running
tests, typesetting output, etc.
[[https://github.com/stakemori/sage-shell-mode|sage-shell-mode]] is the recommended mode for Sage in Emacs. This mode provides two features:
Line 14: Line 12:
See: [[sage-mode]] or [[http://bitbucket.org/gvol/sage-mode]] 1. Run a Sage shell inside Emacs, fully equipped with command history,
completion, dynamic help and opening of source files, etc.
Line 16: Line 15:
== Sage-shell-mode == 2. A major mode for `.sage` files along with functionality for sending chunks of code to a running Sage shell.
Line 18: Line 17:
This is another newer mode for Sage inside emacs. It's known as sage-shell-mode and includes extensions for auto-complete, helm, and anything. It was written from scratch by Sho Takemori and is available from MELPA. `sage-shell-mode` allows extensions for `auto-complete`, `helm`, `anything`, and embedding in `org-mode`. It was written from scratch by Sho Takemori.
Line 20: Line 19:
See: [[https://github.com/stakemori/sage-shell-mode]] `sage-shell-mode` is most easily installed using the Emacs package manager MELPA. Alternatively, go to [[https://github.com/stakemori/sage-shell-mode|the GitHub page]].

See: SageModeComparison, [[https://github.com/stakemori/sage-shell-mode]]

== emacs-jupyter ==

- See 2020 blog post: [[https://martinralbrecht.wordpress.com/2020/08/23/conda-jupyter-and-emacs/|Martin Albrecht: Conda, Jupyter and Emacs]]
Line 30: Line 35:
- http://trac.sagemath.org/ticket/16053 - https://github.com/sagemath/sage/issues/16053

== Sage-mode ==

Note: `sage-mode` works only for Sage 7.3 and earlier.

This emacs mode allows for running a Sage interpreter inside emacs,
and interacting with it sending in chunks of code or doctests,
directly opening the appropriate source files from the help, the
debugger or the tracebacks. It also provides goodies for running
tests, typesetting output, etc.

See: SageModeComparison, [[sage-mode]], [[http://bitbucket.org/gvol/sage-mode]]
Line 34: Line 51:
- which-function-mode: this minor mode displays in the status bar the
  name of the class or function being edited. This is a life saver for
  code with nested classes, and in particular category code.
 * Sage already provides an editor configuration for Emacs, using the file
``.dir-locals.el``, to use spaces instead of tabs. To avoid introducing [[https://doc.sagemath.org/html/en/developer/coding_basics.html#general-coding-style-regarding-whitespace|trailing whitespace]], see https://www.emacswiki.org/emacs/DeletingWhitespace
for various solutions.
Line 38: Line 55:
  Setup: M-x customize-variable which-function-mode
Line 40: Line 56:
- I (NT) have this in my python-mode-hook:
  {{{
  (set-variable 'indent-tabs-mode nil)
  (set-variable 'py-indent-offset 4)
  }}}
  This might not be so relevant with recent versions of emacs.
 * which-function-mode: this minor mode displays in the status bar the
   name of the class or function being edited. This is a life saver for
   code with nested classes, and in particular category code.

   Setup: M-x customize-variable which-function-mode
Line 49: Line 64:
- This (not sot recent) [[http://www.saltycrane.com/blog/2010/05/my-emacs-python-environment/|blog post]] on customizing emacs for Python - 2010 [[http://www.saltycrane.com/blog/2010/05/my-emacs-python-environment/|blog post]] on customizing emacs for Python

https://www.gnu.org/software/emacs/images/emacs.png

Sage and Emacs

The purpose of this page is to collect tips and tricks for Sage users and developers using the text editor Emacs as an IDE.

sage-shell-mode

sage-shell-mode is the recommended mode for Sage in Emacs. This mode provides two features:

1. Run a Sage shell inside Emacs, fully equipped with command history, completion, dynamic help and opening of source files, etc.

2. A major mode for .sage files along with functionality for sending chunks of code to a running Sage shell.

sage-shell-mode allows extensions for auto-complete, helm, anything, and embedding in org-mode. It was written from scratch by Sho Takemori.

sage-shell-mode is most easily installed using the Emacs package manager MELPA. Alternatively, go to the GitHub page.

See: SageModeComparison, https://github.com/stakemori/sage-shell-mode

emacs-jupyter

- See 2020 blog post: Martin Albrecht: Conda, Jupyter and Emacs

EIN: IPython notebook client in Emacs

https://github.com/tkf/emacs-ipython-notebook

This is currently non functional due to an incompatibility with the ipython shipped with Sage. Yet this sounds promising. See:

- https://github.com/tkf/emacs-ipython-notebook/issues/131 - https://github.com/sagemath/sage/issues/16053

Sage-mode

Note: sage-mode works only for Sage 7.3 and earlier.

This emacs mode allows for running a Sage interpreter inside emacs, and interacting with it sending in chunks of code or doctests, directly opening the appropriate source files from the help, the debugger or the tracebacks. It also provides goodies for running tests, typesetting output, etc.

See: SageModeComparison, sage-mode, http://bitbucket.org/gvol/sage-mode

Miscellaneous

  • Sage already provides an editor configuration for Emacs, using the file

.dir-locals.el, to use spaces instead of tabs. To avoid introducing trailing whitespace, see https://www.emacswiki.org/emacs/DeletingWhitespace for various solutions.

  • which-function-mode: this minor mode displays in the status bar the
    • name of the class or function being edited. This is a life saver for code with nested classes, and in particular category code. Setup: M-x customize-variable which-function-mode

See also

- 2010 blog post on customizing emacs for Python

Emacs (last edited 2023-02-23 20:10:56 by mkoeppe)