reddit / emacs
Version 0.7 of detached.el (formerly known as dtache)
squirelpower · 2022-05-25 15:51
Hello everyone :)
I wanted to notify the community that there is a new release of my package *dtache*, which now also has been renamed to *detached.el*, or *detached*. For those previously not familiar with the package, the short description is "An Emacs package to launch, and manage, detached processes". It can be used to dispatch shell commands to an external program *dtach*, which allows processes to outlive Emacs.
The new release is version 0.7, and here is a list of improvements and change that has been made:
- The development of the package has been moved to *sourcehut* at https://git.sr.ht/~niklaseklund/detached.el
- The configuration of the package has been drastically improved, now users simply need to call *(dtache-init)* to integrate with all supported packages. Of course the integration is lazy-loaded
- The completion of sessions are now dynamic. Both the width of the command as well as the annotations adapts dynamically
- There is an integration with *dired's* dired-do-shell-command
There has also been improvements to the user experience of the package, credits should go to user https://gitlab.com/rosetail
- The package now features an option to show a session's output when attaching to it. This feature can be enabled through *detached-show-output-on-attach*. As of now this seems like a better alternative then *detached* *tail* command which users previously had to resort to gain similar functionality. The upside is that the attach functions in detached is more performant.
- The packages *detached-env* script now features a mode, which can either be *plain-text* or *terminal-data*. The former is basically what detached have offered till now, the latter allows a session to store raw terminal data so that session output could contain colored data for example. If a specific command is misbehaving with the *terminal-data* option it can be added to *detached-env-plain-text-commands* to force it to use plain-text.
The package, under its new name, is available at ELPA and MELPA. A patch with the update has been provided to Guix, but has not yet merged.
FrostyX_cz · 2022-05-25 17:53
Thank you very much for working on this.
I don't know if people see it the same way as I do, but IMHO this is one of the most promising Emacs packages at the moment.
Personally, I tried the former `dtache` somewhere around a month ago in order to replace my urxvt + tmux setup with vterm + dtache but my experiment wasn't successful. Looking forward to trying 0.7.
squirelpower · 2022-05-25 19:53
Thanks, glad to hear!
Since I don't use *detached* with *vterm* myself feedback from users are appreciated :). Do you recall why it wasn't a successful experiment?
Setting up the integration with *vterm* should work out of the box now with the latest release, but a part from that I haven't improved anything on it lately. But feel free to try the latest release out, maybe it works better, and if not you could create an issue here [https://lists.sr.ht/\~niklaseklund/detached.el](https://lists.sr.ht/~niklaseklund/detached.el)
FrostyX_cz · 2022-05-25 21:06
I will try again and write up some more constructive feedback :-)
ispinfx · 2022-05-26 01:12
Got seomthing like
script: illegal option -- -
usage: script [-adkpqr] [-t time] [file [command ...]]
Process Shell finished
when using `async-shell-command` and `dired-do-shell-command`.
[deleted] · 2022-05-26 03:24
[deleted]
squirelpower · 2022-05-26 07:19
That's something new. The *script* tool is used in the *detached-env* so the error should come from there. What version of *script* do you have on your machine?
You could verify this by using:
(setq detached-env-plain-text-commands '(".*")) which should turn of the usage of script since the regexp would match any command you would run.
Edit:
This is *detached-env* https://git.sr.ht/~niklaseklund/detached.el/tree/main/item/detached-env
Which use the options for *script* described here https://man7.org/linux/man-pages/man1/script.1.html
Looking at the output you have it seems like the -c or --command option is not present. So I am guessing that is something you can try to alter in *detached-env*
ispinfx · 2022-05-26 07:44
Hi, I used straight.el to install the package just now and it came with `;; Version: 0.7`.
`(setq detached-env-plain-text-commands '(".*"))` works.
I'm on macOS and the manual of `script` is here: https://dpaste.com/43RJWLBRR
ispinfx · 2022-05-26 07:55
After `detached-init` is called, starting a shell in a remote buffer by `M-x shell` will no longer ask for a shell variant, and `/bin/sh` is selected. Is this a bug?
squirelpower · 2022-05-26 09:19
That seems correct then, I guess the issue is that I didn't anticipate that *script* would have different options on macos. Seems like it needs special handling :)
squirelpower · 2022-05-26 09:23
I'll need to see if I can replicate that on my machine. Just on top of my head I can't see a reason why detached would cause a change in that behavior.
Also if you are running on a remote machine make sure to check out this section of the readme :) https://sr.ht/~niklaseklund/detached.el/#remote-support
ispinfx · 2022-05-26 09:42
Yes, I follow the section to setup. The setup is fine and the issue exists with or without the settings. I also tested in an `emacs -q` session.
squirelpower · 2022-05-26 10:10
Alright, great you found that section :)
Maybe you can start a post here https://lists.sr.ht/~niklaseklund/detached.el and share the commands you ran with emacs -q? :)
In the meantime you could see if setting
(setq detached-init-block-list '(shell)) prior to calling (detached-init) is having any effect.
After that is done what will still remain of the shell integration is that *detached-shell* is enabled in shell buffers, which provide the keybindings as well as two filters for the output in the buffer.
squirelpower · 2022-05-30 20:18
u/ispinfx I have created a post for this [issue](https://lists.sr.ht/~niklaseklund/detached.el/%3C871qwapyrm.fsf%40posteo.net%3E). There I reference a commit and instruction on how to fix so that the usage of script works. Have a look and give it a try when you got time :)
squirelpower · 2022-05-30 20:19
An [issue](https://lists.sr.ht/~niklaseklund/detached.el/%3CCAMWOVxmKn7G4SwfG9_hH5%3D9n0KLGfa0GN8cUk8AjCVw_1Ps6%2Bg%40mail.gmail.com%3E) was created for this. And there exists an upstream solution which at least addresses the issue on my local machine, where I could replicate the bug that u/ispinfx reported.