reddit / emacs

How to enable the Oh-my-posh PowerShell prompt in the Emacs shell?

eis3nheim · 2022-11-24 21:25
I have the Oh-my-posh prompt installed for the PowerShell terminal and runs just fine in the Windows terminal and Alacritty, but when I try to open PowerShell from within Emacs, I see “?” symbols all over the prompt. This is my configuration for PowerShell: (defun run-powershell () "Run powershell" (interactive) (async-shell-command "C:/Program Files/PowerShell/7/pwsh.exe" nil nil)) (defun my-buffer-face-mode-fixed () "Sets a fixed width (monospace) font in current buffer" (interactive) (setq buffer-face-mode-face '(:family "FuraCode NF" :height 100)) (buffer-face-mode)) (add-hook 'shell-mode-hook 'my-buffer-face-mode-fixed)
MitchellMarquez42 · 2022-11-24 22:11
1. Is that a typo? Never heard of FuraCode, but FiraCode is definitely a font. 2. https://github.com/jschaf/powershell.el exists. M-x powershell, plus syntax highlighting files.
eis3nheim · 2022-11-25 09:02
I have tried to use `powershell.el`, but I am getting this error: $pswidth; if ($cwidth -lt $pswidth) { $rawui.BufferSize = $bufsize; $rawui.WindowSize = $winsize; } elseif ($cwidth -gt $pswidth) { $rawui.WindowSize = $winsize; $rawui.BufferSize = $bufsize; }; Set-Variable -name rawui -value $null; Set-Variable -name winsize -value $null; Set-Variable -name bufsize -value $null; Set-Variable -name cwidth -value $null; }
eis3nheim · 2022-11-25 09:06
And then on another line I am getting SetValueInvocationException: Exception setting "BufferSize": "Cannot set the buffer size because the size specified is too large or too small. (Parameter 'value') Actual value was 7,9001.
jandedobbeleer · 2022-11-28 08:12
You need to set the correct font for Emacs, that's all.