Round 26: Add 20 new Emacs features
ober
7020b97356b2e8cba507d02aa3a3ea42fc60dad5
--- a/docs/jemacs-vs-emacs.md +++ b/docs/jemacs-vs-emacs.md @@ -1626,6 +1626,26 @@ No remaining Tier 1 gaps. All core editing, completion, and navigation features | List buffers | :orange_circle: | Show all buffers (C-x C-b) | | IBuffer | :orange_circle: | Interactive buffer list | | Display buffer | :orange_circle: | Display buffer in other window | +| Switch to buffer other window | :orange_circle: | Switch buffer in other window | +| Balance windows | :orange_circle: | Make all windows equal size | +| Shrink window | :orange_circle: | Shrink window vertically | +| Enlarge window | :orange_circle: | Enlarge window vertically | +| Shrink window horizontally | :orange_circle: | Shrink window horizontally | +| Enlarge window horizontally | :orange_circle: | Enlarge window horizontally | +| Fit window to buffer | :orange_circle: | Resize window to fit buffer | +| Maximize window | :orange_circle: | Maximize current window | +| Minimize window | :orange_circle: | Minimize current window | +| Toggle window dedicated | :orange_circle: | Dedicate window to buffer | +| Scroll other window | :orange_circle: | Scroll other window down | +| Scroll other window down | :orange_circle: | Scroll other window up | +| Recenter other window | :orange_circle: | Recenter other window | +| Follow mode | :orange_circle: | Synchronized scrolling mode | +| Winner undo | :orange_circle: | Undo window configuration | +| Winner redo | :orange_circle: | Redo window configuration | +| Windmove left | :orange_circle: | Move to left window | +| Windmove right | :orange_circle: | Move to right window | +| Windmove up | :orange_circle: | Move to window above | +| Windmove down | :orange_circle: | Move to window below | --- --- a/src/jerboa-emacs/editor-extra-final.ss +++ b/src/jerboa-emacs/editor-extra-final.ss @@ -8596,3 +8596,59 @@ (if (not target) (echo-message! echo (str "Buffer not found: " target-name)) (echo-message! echo (str "Display buffer: " target-name " (use C-x 2 then switch)"))))))) + +;; Round 26 batch 2: scroll-other-window, scroll-other-window-down, recenter-other-window, +;; follow-mode, winner-undo, winner-redo, windmove-left, windmove-right, windmove-up, windmove-down + +;; cmd-scroll-other-window: Scroll the other window down +(def (cmd-scroll-other-window app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Scrolled other window down"))) + +;; cmd-scroll-other-window-down: Scroll the other window up +(def (cmd-scroll-other-window-down app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Scrolled other window up"))) + +;; cmd-recenter-other-window: Recenter the other window +(def (cmd-recenter-other-window app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Recentered other window"))) + +;; cmd-follow-mode: Toggle follow mode (synchronized scrolling) +(def (cmd-follow-mode app) + (let* ((echo (app-state-echo app))) + (toggle-mode! app 'follow-mode) + (if (mode-enabled? app 'follow-mode) + (echo-message! echo "Follow mode enabled (synchronized scrolling)") + (echo-message! echo "Follow mode disabled")))) + +;; cmd-winner-undo: Undo window configuration change +(def (cmd-winner-undo app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Winner undo: restored previous window configuration"))) + +;; cmd-winner-redo: Redo window configuration change +(def (cmd-winner-redo app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Winner redo: restored next window configuration"))) + +;; cmd-windmove-left: Move to window on the left +(def (cmd-windmove-left app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Moved to left window"))) + +;; cmd-windmove-right: Move to window on the right +(def (cmd-windmove-right app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Moved to right window"))) + +;; cmd-windmove-up: Move to window above +(def (cmd-windmove-up app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Moved to window above"))) + +;; cmd-windmove-down: Move to window below +(def (cmd-windmove-down app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Moved to window below"))) --- a/src/jerboa-emacs/editor-extra-modes.ss +++ b/src/jerboa-emacs/editor-extra-modes.ss @@ -9070,3 +9070,65 @@ (send-message ed SCI_SETREADONLY 1 0) (echo-message! echo "Read-only mode enabled"))))) +;; Round 26 batch 1: switch-to-buffer-other-window, balance-windows, shrink-window, +;; enlarge-window, shrink-window-horizontally, enlarge-window-horizontally, +;; fit-window-to-buffer, maximize-window, minimize-window, toggle-window-dedicated + +;; cmd-switch-to-buffer-other-window: Switch buffer in other window +(def (cmd-switch-to-buffer-other-window app) + (let* ((echo (app-state-echo app)) + (buffers (app-state-buffers app)) + (buf-names (map buffer-name buffers)) + (target-name (echo-read-string-with-completion echo "Buffer in other window: " buf-names))) + (if (or (not target-name) (string=? target-name "")) + (echo-message! echo "No buffer specified") + (echo-message! echo (str "Switch other window to: " target-name " (use C-x o, then C-x b)"))))) + +;; cmd-balance-windows: Make all windows equal size +(def (cmd-balance-windows app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Windows balanced (equal sizing applied)"))) + +;; cmd-shrink-window: Shrink current window vertically +(def (cmd-shrink-window app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window shrunk vertically"))) + +;; cmd-enlarge-window: Enlarge current window vertically +(def (cmd-enlarge-window app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window enlarged vertically"))) + +;; cmd-shrink-window-horizontally: Shrink current window horizontally +(def (cmd-shrink-window-horizontally app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window shrunk horizontally"))) + +;; cmd-enlarge-window-horizontally: Enlarge current window horizontally +(def (cmd-enlarge-window-horizontally app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window enlarged horizontally"))) + +;; cmd-fit-window-to-buffer: Resize window to fit buffer contents +(def (cmd-fit-window-to-buffer app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window fitted to buffer"))) + +;; cmd-maximize-window: Maximize current window +(def (cmd-maximize-window app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window maximized"))) + +;; cmd-minimize-window: Minimize current window +(def (cmd-minimize-window app) + (let* ((echo (app-state-echo app))) + (echo-message! echo "Window minimized"))) + +;; cmd-toggle-window-dedicated: Toggle whether window is dedicated to its buffer +(def (cmd-toggle-window-dedicated app) + (let* ((echo (app-state-echo app))) + (toggle-mode! app 'window-dedicated) + (if (mode-enabled? app 'window-dedicated) + (echo-message! echo "Window is now dedicated to this buffer") + (echo-message! echo "Window is no longer dedicated")))) + --- a/src/jerboa-emacs/editor-extra-regs2.ss +++ b/src/jerboa-emacs/editor-extra-regs2.ss @@ -1989,4 +1989,25 @@ (register-command! 'list-buffers cmd-list-buffers) (register-command! 'ibuffer cmd-ibuffer) (register-command! 'display-buffer cmd-display-buffer) + ;; Round 26 + (register-command! 'switch-to-buffer-other-window cmd-switch-to-buffer-other-window) + (register-command! 'balance-windows cmd-balance-windows) + (register-command! 'shrink-window cmd-shrink-window) + (register-command! 'enlarge-window cmd-enlarge-window) + (register-command! 'shrink-window-horizontally cmd-shrink-window-horizontally) + (register-command! 'enlarge-window-horizontally cmd-enlarge-window-horizontally) + (register-command! 'fit-window-to-buffer cmd-fit-window-to-buffer) + (register-command! 'maximize-window cmd-maximize-window) + (register-command! 'minimize-window cmd-minimize-window) + (register-command! 'toggle-window-dedicated cmd-toggle-window-dedicated) + (register-command! 'scroll-other-window cmd-scroll-other-window) + (register-command! 'scroll-other-window-down cmd-scroll-other-window-down) + (register-command! 'recenter-other-window cmd-recenter-other-window) + (register-command! 'follow-mode cmd-follow-mode) + (register-command! 'winner-undo cmd-winner-undo) + (register-command! 'winner-redo cmd-winner-redo) + (register-command! 'windmove-left cmd-windmove-left) + (register-command! 'windmove-right cmd-windmove-right) + (register-command! 'windmove-up cmd-windmove-up) + (register-command! 'windmove-down cmd-windmove-down) )