Fix PS1 command substitution and margin width scaling

ober

4dfe89363e836b258881d48feaa1000ba74859d3

diff --git a/src/jerboa-emacs/qt/commands-shell.ss b/src/jerboa-emacs/qt/commands-shell.ss
index 0b03d65..fdf4050 100644
--- a/src/jerboa-emacs/qt/commands-shell.ss
+++ b/src/jerboa-emacs/qt/commands-shell.ss
@@ -61,12 +61,18 @@
 
 (def (apply-font-size-to-all-editors! app)
   "Apply the current global font size to all open editors."
-  (let ((fr (app-state-frame app)))
+  (let ((fr (app-state-frame app))
+        ;; Scale margin width proportionally to font size (50px at 11pt baseline)
+        (margin-w (max 30 (inexact->exact (round (* (/ *default-font-size* 11.0) 50))))))
     (for-each
       (lambda (win)
         (let ((ed (qt-edit-window-editor win)))
           (sci-send ed SCI_STYLESETSIZE STYLE_DEFAULT *default-font-size*)
-          (sci-send ed SCI_STYLECLEARALL)))
+          (sci-send ed SCI_STYLECLEARALL)
+          ;; Recalculate margin width for new font size
+          (sci-send ed SCI_SETMARGINWIDTHN 0 margin-w)
+          ;; Re-apply theme (STYLECLEARALL resets colors)
+          (qt-apply-editor-theme! ed)))
       (qt-frame-windows fr)))
   ;; Update Qt stylesheet so chrome widgets match
   (when *qt-app-ptr*
diff --git a/src/jerboa-emacs/qt/window.ss b/src/jerboa-emacs/qt/window.ss
index 0f60cd6..d8d0556 100644
--- a/src/jerboa-emacs/qt/window.ss
+++ b/src/jerboa-emacs/qt/window.ss
@@ -254,9 +254,10 @@
   "Configure QScintilla editor: theme, margins, caret, save-point signals."
   ;; Apply theme colors from face system
   (qt-apply-editor-theme! ed)
-  ;; Line number margin (margin 0)
+  ;; Line number margin (margin 0) — scale width with font size
   (sci-send ed SCI_SETMARGINTYPEN 0 SC_MARGIN_NUMBER)
-  (sci-send ed SCI_SETMARGINWIDTHN 0 50)
+  (sci-send ed SCI_SETMARGINWIDTHN 0
+    (max 30 (inexact->exact (round (* (/ *default-font-size* 11.0) 50)))))
   ;; Disable other margins (symbol, fold) to avoid white gutters
   (sci-send ed SCI_SETMARGINWIDTHN 1 0)  ; symbol margin
   (sci-send ed SCI_SETMARGINWIDTHN 2 0)  ; fold margin
diff --git a/src/jerboa-emacs/terminal.ss b/src/jerboa-emacs/terminal.ss
index c1b5f9c..f31e8a3 100644
--- a/src/jerboa-emacs/terminal.ss
+++ b/src/jerboa-emacs/terminal.ss
@@ -323,12 +323,13 @@
     (if (not env)
       "$ "
       (let* ((ps1 (or (env-get env "PS1") "$ "))
-             (env-getter (lambda (name) (env-get env name))))
+             (env-getter (lambda (name) (env-get env name)))
+             (cmd-exec (make-cmd-exec-fn env)))
         (expand-prompt ps1 env-getter
                        0  ; job-count
                        (shell-environment-cmd-number env)
                        0  ; history-number
-                       )))))
+                       cmd-exec)))))
 
 (def (terminal-prompt ts)
   "Return the expanded PS1 prompt string (ANSI stripped)."