Configure Emacs

Procedure 9.1. Set up the editor virtual environment.

Note

In this configuration, we use two virtual enviromnents. The one we are creating in this chapter is semi-permanent; it's for emacs. We'll make another one for the project. Note that this may make it harder to run code directly from emacs, but since this approach doesn't do that (yet), that's a future problem.

  1. Create the editor's virtual environment

    python -m venv ~/.config/venv/emacs_python_ide source ~/.config/venv/emacs_python_ide/bin/activate

  2. Install IDE python software

    pip install ruff

  3. Install Treesit prerequisites in emacs

  4. Set up editor project defaults

  5. Install tree-sitter python

    from 2024-11 Habamax https://gist.github.com/habamax/290cda0e0cdc6118eb9a06121b9bc0d7)

  6. Verify treesit setup

    M-x ielm (treesit-language-available-p 'python)

    It should return t.

    Open python file and activate treesitter mode with M-x python-ts-mode RET

  7. One-time setup?

    maybe set treesit-font-lock-level to 4