dot-emacs

My emacs dotfiles/config
git clone git://git.ethandl.dev/dot-emacs
Log | Files | Refs

commit 681b22da370ad3da4d58c3eabf26e0856b756258
parent 0a620917caa1b7141eb6bfe7b71c2149b5e46a84
Author: Ethan Long <ethandavidlong@gmail.com>
Date:   Fri, 26 Jun 2026 00:46:00 +1000

Made `python-ts-mode` actually function.

Also added Powershell support (why??? because Windows unfortunately
exists)

Diffstat:
Mconfig.org | 49+++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 45 insertions(+), 4 deletions(-)

diff --git a/config.org b/config.org @@ -476,6 +476,9 @@ If we want images generated by the output of ~org-babel~ to automatically render #+end_src This will save a ~C-c C-x C-v~ invocation every time we want to display newly generated images. * The programming environment +This will be perpetually incomplete, my config cannot support /every/ language, nor do I really need it to. + +The selection of languages may seem odd, but they are just what I have been bothered to put the effort into to-date. If I stop using one and it breaks, I will delete it rather than fix it until I need it again. ** Org babel In addition to being a useful Markdown alternative, Org mode can also serve as a literate programming environment and (shitty) Jupyter replacement. @@ -507,15 +510,19 @@ Treesitter grammar installation is slow and blocks up the emacs process. The fol `(treesit-install-language-grammar ',lang) "\\`treesit-language-source-alist\\'"))) #+end_src -** Markdown mode +** Markdown Emacs comes with ~markdown-ts-mode~, which utilises treesitter to provide highlighting for markdown. To use this mode, we just install the treesitter grammar(s): #+begin_src emacs-lisp (add-to-list 'treesit-language-source-alist - '(markdown "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "split_parser" "tree-sitter-markdown/src")) + '(markdown "https://github.com/tree-sitter-grammars/tree-sitter-markdown" + "split_parser" + "tree-sitter-markdown/src")) (add-to-list 'treesit-language-source-alist - '(markdown-inline "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "split_parser" "tree-sitter-markdown-inline/src")) - + '(markdown-inline "https://github.com/tree-sitter-grammars/tree-sitter-markdown" + "split_parser" + "tree-sitter-markdown-inline/src")) + (ethandl/treesit-install-async 'markdown) (ethandl/treesit-install-async 'markdown-inline) #+end_src @@ -532,10 +539,44 @@ From my (admittedly limited) experience, ~python-ts-mode~ tends to have better s (add-to-list 'treesit-language-source-alist '(python "https://github.com/tree-sitter/tree-sitter-python")) + (add-to-list 'major-mode-remap-alist + '(python-mode . python-ts-mode)) + (ethandl/treesit-install-async 'python) (add-to-list 'ethandl/org-babel-langs '(python . t)) #+end_src +** Powershell +I don't like or use Powershell, but seeing as I sometimes operate on Windows (and even have a sample in this config for TRAMP compatability), it /could/ be nice to have. + +Due to my general distaste for all things Microslop, this may disappear if I deem it too much effort to keep around. That said, here is a mode to use when working with Powershell (the slowest shell known to mankind). +#+begin_src emacs-lisp + (elpaca powershell) +#+end_src +* Tramp +We all love tramp. Tramp is great. +** Windows remote support +Disclaimer: This isn't my solution, though I got part of the way there are just so many reasons why Windows is broken and shit. I borrowed heavily on the PowerShell and ~sshw~ definition from [[https://emacs.stackexchange.com/a/85533][this stackexchange post]]. + +Ensure first that the Windows remote has been de-crappified as much as possible, with Git and hence ~bash~ installed, and the OpenSSH Server feature enabled with the service started. +Then run the following in a PowerShell prompt on the remote to enable ~bash~ as the SSH shell (if it isn't already): +#+begin_src powershell + New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\Git\bin\bash.exe" -PropertyType String -Force + New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "-c" -PropertyType String -Force +#+end_src + +Now that the remote is set up, we can use the following tramp method: +#+begin_src emacs-lisp + (require 'tramp) + (add-to-list + 'tramp-methods + '("sshw" (tramp-login-program "ssh") + (tramp-login-args + (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") ("-T") + ("-o" "RemoteCommand=\"%l\"") ("%h"))) + (tramp-async-args (("-q"))) (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-c")))) +#+end_src * Platform specifics I have structured the following sections such that each specific platform is tangled only if it is applicable. Tangled outputs are saved to ~config-TARG.el~ where ~TARG~ is a property of your platform.