Round 111: Add 20 C/C++, Python & Java programming commands
ober
31466d3b691ff5a10d98d1c608a62961f0157d3c
--- a/docs/jemacs-vs-emacs.md +++ b/docs/jemacs-vs-emacs.md @@ -3739,6 +3739,31 @@ No remaining Tier 1 gaps. All core editing, completion, and navigation features | vc-dir-previous-directory | :orange_circle: | Move to previous directory | | vc-dir-next-directory | :orange_circle: | Move to next directory | +### Round 111 — C/C++, Python & Java Programming + +| Command | Status | Description | +|---------|--------|-------------| +| c-toggle-auto-newline | :orange_circle: | Toggle C auto-newline mode | +| c-toggle-hungry-state | :orange_circle: | Toggle C hungry-delete mode | +| c-toggle-electric-state | :orange_circle: | Toggle C electric state | +| c-set-style | :orange_circle: | Set C indentation style | +| c-set-offset | :orange_circle: | Set C offset for syntactic symbol | +| c-indent-defun | :orange_circle: | Indent current C function | +| c-mark-function | :orange_circle: | Mark current C function | +| c-beginning-of-defun | :orange_circle: | Move to beginning of C function | +| c-end-of-defun | :orange_circle: | Move to end of C function | +| c-backward-conditional | :orange_circle: | Move to previous preprocessor conditional | +| c-forward-conditional | :orange_circle: | Move to next preprocessor conditional | +| c-up-conditional | :orange_circle: | Move up to enclosing #if | +| python-shell-send-defun | :orange_circle: | Send function to Python shell | +| python-shell-send-buffer | :orange_circle: | Send buffer to Python shell | +| python-shell-send-file | :orange_circle: | Send file to Python shell | +| python-shell-send-string | :orange_circle: | Evaluate string in Python shell | +| python-check | :orange_circle: | Run Python syntax checker | +| python-describe-at-point | :orange_circle: | Describe Python symbol at point | +| python-eldoc-at-point | :orange_circle: | Show eldoc for Python symbol | +| java-mode | :orange_circle: | Activate Java major mode | + --- ## Recommended Development Roadmap --- a/src/jerboa-emacs/editor-extra-final.ss +++ b/src/jerboa-emacs/editor-extra-final.ss @@ -13845,3 +13845,49 @@ (def (cmd-vc-dir-next-directory app) (let* ((echo (app-state-echo app))) (echo-message! echo "VC Dir: moved to next directory"))) + +;;; ——— Round 111: C/C++, Python & Java programming (batch 2) ——— + +(def (cmd-c-forward-conditional app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: moved to next #if/#else/#endif"))) + +(def (cmd-c-up-conditional app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: moved up to enclosing #if"))) + +(def (cmd-python-shell-send-defun app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Python: sent current function to shell"))) + +(def (cmd-python-shell-send-buffer app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Python: sent entire buffer to shell"))) + +(def (cmd-python-shell-send-file app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Send file: " + (lambda (file) + (echo-message! echo (str "Python: sent file " file " to shell")))))) + +(def (cmd-python-shell-send-string app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "Python eval: " + (lambda (code) + (echo-message! echo (str "Python: evaluated '" code "'")))))) + +(def (cmd-python-check app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Python: running syntax checker"))) + +(def (cmd-python-describe-at-point app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Python: describing symbol at point"))) + +(def (cmd-python-eldoc-at-point app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Python: showing eldoc for symbol at point"))) + +(def (cmd-java-mode app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Java mode activated"))) --- a/src/jerboa-emacs/editor-extra-modes.ss +++ b/src/jerboa-emacs/editor-extra-modes.ss @@ -14412,3 +14412,60 @@ (echo-read-string echo "Replace with: " (lambda (replacement) (echo-message! echo (str "VC Dir: replacing '" pattern "' with '" replacement "'")))))))) + +;;; ——— Round 111: C/C++, Python & Java programming (batch 1) ——— + +(def (cmd-c-toggle-auto-newline app) + (let* ((echo (app-state-echo app))) + (toggle-mode! app 'c-auto-newline) + (if (mode-enabled? app 'c-auto-newline) + (echo-message! echo "C auto-newline enabled") + (echo-message! echo "C auto-newline disabled")))) + +(def (cmd-c-toggle-hungry-state app) + (let* ((echo (app-state-echo app))) + (toggle-mode! app 'c-hungry-delete) + (if (mode-enabled? app 'c-hungry-delete) + (echo-message! echo "C hungry-delete enabled") + (echo-message! echo "C hungry-delete disabled")))) + +(def (cmd-c-toggle-electric-state app) + (let* ((echo (app-state-echo app))) + (toggle-mode! app 'c-electric) + (if (mode-enabled? app 'c-electric) + (echo-message! echo "C electric state enabled") + (echo-message! echo "C electric state disabled")))) + +(def (cmd-c-set-style app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "C style (gnu/k&r/bsd/linux): " + (lambda (style) + (echo-message! echo (str "C: set style to " style)))))) + +(def (cmd-c-set-offset app) + (let* ((echo (app-state-echo app))) + (echo-read-string echo "C offset symbol: " + (lambda (sym) + (echo-read-string echo "Offset value: " + (lambda (val) + (echo-message! echo (str "C: set offset " sym " to " val)))))))) + +(def (cmd-c-indent-defun app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: indented current function"))) + +(def (cmd-c-mark-function app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: marked current function"))) + +(def (cmd-c-beginning-of-defun app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: moved to beginning of function"))) + +(def (cmd-c-end-of-defun app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: moved to end of function"))) + +(def (cmd-c-backward-conditional app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "C: moved to previous #if/#else/#endif"))) --- a/src/jerboa-emacs/editor-extra-regs2.ss +++ b/src/jerboa-emacs/editor-extra-regs2.ss @@ -3764,4 +3764,25 @@ (register-command! 'vc-dir-find-file-other-window cmd-vc-dir-find-file-other-window) (register-command! 'vc-dir-previous-directory cmd-vc-dir-previous-directory) (register-command! 'vc-dir-next-directory cmd-vc-dir-next-directory) + ;; Round 111: C/C++, Python & Java programming + (register-command! 'c-toggle-auto-newline cmd-c-toggle-auto-newline) + (register-command! 'c-toggle-hungry-state cmd-c-toggle-hungry-state) + (register-command! 'c-toggle-electric-state cmd-c-toggle-electric-state) + (register-command! 'c-set-style cmd-c-set-style) + (register-command! 'c-set-offset cmd-c-set-offset) + (register-command! 'c-indent-defun cmd-c-indent-defun) + (register-command! 'c-mark-function cmd-c-mark-function) + (register-command! 'c-beginning-of-defun cmd-c-beginning-of-defun) + (register-command! 'c-end-of-defun cmd-c-end-of-defun) + (register-command! 'c-backward-conditional cmd-c-backward-conditional) + (register-command! 'c-forward-conditional cmd-c-forward-conditional) + (register-command! 'c-up-conditional cmd-c-up-conditional) + (register-command! 'python-shell-send-defun cmd-python-shell-send-defun) + (register-command! 'python-shell-send-buffer cmd-python-shell-send-buffer) + (register-command! 'python-shell-send-file cmd-python-shell-send-file) + (register-command! 'python-shell-send-string cmd-python-shell-send-string) + (register-command! 'python-check cmd-python-check) + (register-command! 'python-describe-at-point cmd-python-describe-at-point) + (register-command! 'python-eldoc-at-point cmd-python-eldoc-at-point) + (register-command! 'java-mode cmd-java-mode) )