This is a quick and dirty repl hack for emacs -- i.e. use it when AFK and need to show people REPL-based development without a huge setup hassle.
;; emacs -Q ;; then paste in the commands below ;; then M-x eval-buffer ;; then M-x shell and run python or whatnot ;; then C-x o back to scratch buffer ;; then M-x python-mode or whatnot (defun send-region-to-shell(start end) (interactive "r") (append-to-buffer (get-buffer "*shell*") start end) (execute-kbd-macro (read-kbd-macro "M-w C-x o C-m C-x o")) ) (global-set-key (kbd "C-c r") 'send-region-to-shell) (defun send-line-to-shell () (interactive) (execute-kbd-macro (read-kbd-macro "C-a C-SPC C-e C-c r")) ) (global-set-key (kbd "C-c l") 'send-line-to-shell)And when people want vertical splits, eval the following before M-x shell:
;; https://stackoverflow.com/questions/2081577/emacs-split-horizontal (setq split-height-threshold nil) (setq split-width-threshold 0)