News for hackers. Stuff that matters.

loskutak

Re:Bcvi – run vi over a 'back-channel' (2010) on Friday March 07, 2025 @09:01AM (#43290196)
Nice!

I do something like this with WezTerm. When I ssh into a server where I work, I can run

    e some/path/whatever
which just prints a special string containing some control characters, the server hostname and the path. The local wezterm parses it and calls emacsclient with the appropriate TRAMP path. So ssh to server, work there, call `e ~/.bashrc` and the remote file immediately opens in my local emacs. This is really useful when I am in some deep directory structure.

I use the same mechanism to play remote videos - running `mpv experiment/output_foobar.mp4` just prints the special string, which the WezTerm terminal emulator parses and plays the video using my laptop mpv video player. Really really useful for me every day. I run some experiments, can inspect the results immediately. I also have the "reverse scp" which I use from time to time. `rscp foobar.py /tmp/` causes my laptop to download the foobar.py from the current working directory on the remote server into local /tmp/.

The mechanism is explained here [1] and here [2]

The bash function `e` on the server just prints the special string to SetUserVar with name remotemacs and value hostname---path. In wezterm config I have:

    wezterm.on('user-var-changed',
        function(win, pane, name, value)
            if name == "remotemacs" then
         -- remotemacs:hostname---path
         local match_start, match_end, hostname, path = string.find(value, "^(.-)[-][-][-](.-)$")
         local tramp_path = "/ssh:" .. hostname .. ":" .. path
         wezterm.background_child_process {'sh', '/home/loskutak/scripts/remotemacs', tramp_path}
[1] https://wezterm.org/config/lua/window-events/user-var-change...

[2] https://wezterm.org/recipes/passing-data.html

Re:Building a DIY Pen Plotter on Thursday October 05, 2023 @01:54AM (#37775312)
That is true, but org-mode really shines when you want to do literate programming stuff, e.g. have the matplotlib code directly in the orgfile, ...
Re:Absolute Beginner's Guide to Emacs (2012) on Tuesday December 04, 2018 @03:04PM (#18603145)
you can use ssh controlmaster (adding variation of the following into your .ssh/config):

Host *

ControlMaster auto

ControlPath /tmp/ssh-%r@%h:%p

This helped me quite a lot with tramp