update my-view-python

This commit is contained in:
2024-05-06 16:50:56 +02:00
parent 8b80ceda39
commit 156cec64fb
5 changed files with 2916 additions and 14 deletions

View File

@@ -3,27 +3,59 @@
;;; Commentary:
;;; Code:
(defun my-view-python ()
"Three windows.
On the right side a *Anaconda* buffer with optionally
`virtual-auto-fill-mode' active and a *Python* buffer."
"Python IDE like view.
Language Server Support, Emacs built-in package `eglot'
Language Server Protocol, python package `python-lsp-server'
- install e.g. with: pip install \"python-lsp-server[all]\"
Syntax Checking, Emacs built-in package `flymake'
Four windows:
- left: file
- right
- top: help (`eldoc')
- middle: cross-references (`xref')
- bottom: python shell
"
(interactive)
(require 'python)
(unless (get-buffer (concat "*" python-shell-buffer-name "*"))
(run-python) ;; cursor is now inside the python buffer.
(other-window -1))
;; first make visiting file full and run eglot
(delete-other-windows)
(eglot-ensure)
;; split horizontal 0.6 - 0.4
(split-window-horizontally (truncate (* 0.6 (window-body-width))))
(other-window 1)
(switch-to-buffer (concat "*" python-shell-buffer-name "*"))
(switch-to-buffer (eldoc-doc-buffer))
(other-window -1)
)
(split-window-vertically) ;; both are python buffers now.
(switch-to-buffer "*Anaconda*")
(when (fboundp 'virtual-auto-fill-mode) (virtual-auto-fill-mode))
(other-window -1))
;; python old using anaconda
;; (defun my-view-python ()
;; "Three windows.
;; On the right side a *Anaconda* buffer with optionally
;; `virtual-auto-fill-mode' active and a *Python* buffer."
;; (interactive)
;; (require 'python)
;; (unless (get-buffer (concat "*" python-shell-buffer-name "*"))
;; (run-python) ;; cursor is now inside the python buffer.
;; (other-window -1))
;; (delete-other-windows)
;; (split-window-horizontally (truncate (* 0.6 (window-body-width))))
;; (other-window 1)
;; (switch-to-buffer (concat "*" python-shell-buffer-name "*"))
;; (split-window-vertically) ;; both are python buffers now.
;; (switch-to-buffer "*Anaconda*")
;; (when (fboundp 'virtual-auto-fill-mode) (virtual-auto-fill-mode))
;; (other-window -1))
(defun my-view-elisp ()
"Two windows side-by-side.