Silex / docker.el

Manage docker from Emacs.
750 stars 77 forks source link

Using eat terminal if available #238

Open jvillasante opened 1 week ago

jvillasante commented 1 week ago

Currently I use vterm when available like this

(when (package-installed-p 'vterm)
        (setq docker-run-async-with-buffer-function #'docker-run-async-with-buffer-vterm))

Is there a similar setting I can use for eat terminal?

Silex commented 1 week ago

Not yet. PR welcome 😉

jvillasante commented 5 days ago

Looks like I don't have permissions or something?

$ git push origin eat_terminal_support
ERROR: Permission to Silex/docker.el.git denied to jvillasante.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
jvillasante commented 5 days ago

Anyway, I don't think a PR is even needed, it works by defining the function outside docker.el. Maybe that can be added to the docs or something...

(defun my--docker-run-async-with-buffer-eat (program &rest args)
        "Execute \"PROGRAM ARGS\" and display output in a new `eat' buffer."
        (defvar eat-buffer-name)
        (defvar eat-kill-buffer-on-exit)
        (if (fboundp 'eat-other-window)
                (let* ((process-args (-remove 's-blank? (-flatten args)))
                       (eat-buffer-name (s-join " " (-insert-at 0 program process-args)))
                       (eat-kill-buffer-on-exit nil))
                    (eat-other-window eat-buffer-name args))
            (error "The eat package is not installed")))

(when (package-installed-p 'eat)
        (setq docker-run-async-with-buffer-function #'my--docker-run-async-with-buffer-eat))
Silex commented 3 days ago

To make a PR you need to fork the repository, commit in your repository, then make a PR from your repository to this one.

If you want I'll let you do the above so you get the commit at your name, or I can also just take the code and make the commit myself. You decide.

Silex commented 3 days ago

Btw, do you think eat should be the default, then vterm, then shell?

Is eat the globally accepted superior shell over vterm now?

jvillasante commented 3 days ago

That's ok, you can just take the code and do the commit yourself.

I like eat since I don't need compile the module or have another dependency, vterm is still faster, so, maybe an option for the user?

In my PR I have it after vterm

(defcustom docker-run-async-with-buffer-function
    (cond ((featurep 'vterm) 'docker-run-async-with-buffer-vterm)
          ((featurep 'eat) 'docker-run-async-with-buffer-eat)
          (t 'docker-run-async-with-buffer-shell))
    "Function used to run a program with a live buffer attached to it."
    :group 'docker
    :type 'symbol)