rejeep / prodigy.el

Manage external services from within Emacs
GNU General Public License v3.0
550 stars 39 forks source link

custom prodigy columns #121

Closed FrancescElies closed 2 years ago

FrancescElies commented 6 years ago

Context

Problem: Sometimes I need to checkout different branches for certain processes running under prodigy. In that situation I would like to see which branches I checked out.

Description

This pull request adds a new column that could be activated via defcustom.

Todos

Would you eventually interested in something like this? At the moment looks as follows

screen shot 2018-03-16 at 20 50 35
Fuco1 commented 6 years ago

I think it's pretty neat idea, I often run multiple versions of the same service as well. But for me a docker tag would be more useful :D

rejeep commented 6 years ago

Would be great if this could be done as a plugin instead. Git is too specific.

FrancescElies commented 6 years ago

I think it's pretty neat idea, I often run multiple versions of the same service as well. But for me a docker tag would be more useful :D

For running docker containers I use docker.el, how do you run them in prodigy, could you link me to an example? :)

FrancescElies commented 6 years ago

Would be great if this could be done as a plugin instead. Git is too specific.

As a plugin, do you mean, that the user could configure it's own columns via defcustom? Basically getting prodigy-branch-col related code out of the repo. Then adding that code to a custom column via defcustom?

Fuco1 commented 6 years ago

@FrancescElies docker.el is not very great with compose so I use prodigy to start compose stacks. I also use ssh serverXYZ docker logs -f container to run a "service" that just prints the logs so that I can quickly jump to that in Emacs. Seeing what image the container is using would be neat there.

I think this is "pluggable" enough but maybe rename "branch" to "git" or something to make it clear this is only git related, after all, mercurial or svn has branches too. [edit: or use vc instead of magit and make it work with everything]

I'm not sure starting a separate repository for this is worth it. Flycheck bundles a lot of checkers and it works fine for them, I think we can ship "additional columns" in this project similarly.

rejeep commented 6 years ago

I agree that git is better than branch. Creating a plugin only for git might be a bit excessive, but at the same time, I don't like assuming that everyone uses Git. One alternative would be to create a prodigy-scm.el package that can support any SCM system.

FrancescElies commented 6 years ago

I removed magit specific code from this pull request. I left prodigy-default-list-columns which contains the current columns and their formats together. Added a defcustom prodigy-custom-list-columns which would allow the user to pass custom columns.

In my specific use case looks like this:

screen shot 2018-03-18 at 16 20 44

This way you would have some time to think if you want to have this additional column definitions inside the repository or if that should be moved to something like prodigy-scm.el, in the meanwhile one could use prodigy-custom-list-columns to plug-in custom columns.

What do you think?

Fuco1 commented 6 years ago

I like this setup.

I still think that we should keep the extra stuff in this repository. I don't particularly like the situations where there is 5 million trivial packages as "plugins" for a package, it does not feel very Emacs-y.

We can have a file prodigy-columns.el with all the extra column functions/formats.

FrancescElies commented 6 years ago

I like this setup.

I still think that we should keep the extra stuff in this repository. I don't particularly like the situations where there is 5 million trivial packages as "plugins" for a package, it does not feel very Emacs-y.

We can have a file prodigy-columns.el with all the extra column functions/formats.

I moved columns' related code to prodigy-columns.el and replaced 'symbols' with :keywords.

CI failing though, I seem not to understand the loading process in emacs :/, I believe I need to modify the load-path, at the moment I'm having a look how other packages do this, but I could not get my head around this yet.

How can I make prodigy.el load prodigy-columns.el properly? Help much appreciated, thanks in advance

Fuco1 commented 6 years ago

You should put (require '...) into the main file and also edit the Cask file because that declares that the package file is only the prodigy.el file so probably cask initializes emacs only loading that? (not sure here)

rejeep commented 6 years ago

I removed magit specific code from this pull request.

No?

FrancescElies commented 6 years ago

No?

I did, but after https://github.com/rejeep/prodigy.el/pull/121#issuecomment-374181999 if I understood correctly, we might want to have an extra file for that kind of column specific code, that's why I brought it back.

I added c5c39623233b081d3e740ae2528cde2f6fe27416 which deletes that code and prodigy-additional-list-columns.

So currentlyprodigy-default-list-columns holds the default prodigy columns and the user could use prodigy-custom-list-columns to add new ones.

I see travis failing with

The command "curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh" failed and exited with 1 during .
FrancescElies commented 6 years ago

Tests passing now, I squashed all changes on a single commit

shevchuk commented 4 years ago

This is a handy feature, is there any chance to see it merged? @rejeep

rejeep commented 4 years ago

Sure! @FrancescElies I added you as a collaborator, feel free to merge when rebased.

FrancescElies commented 4 years ago

ℹ️ Maybe useful to someone else, currently I am using something like

(setq prodigy-custom-list-columns
   (quote
    ((:function prodigy-git-branch-col :format
                ("Git" 25 t)))))

(defun prodigy-git-branch-col (service)
  "Return SERVICE git branch.

  - Prepend ✏ if something any file in the repository has been modified.
  - Prepend ∦ if remote branch and current branch are not in sync."
  (-if-let (default-directory (prodigy-service-cwd service))
      (my/magit-repolist-branch-status)
    ""))

(defun my/magit-repolist-branch-status (&optional _id)
  (if (magit-git-repo-p default-directory)
      (s-trim (s-join " "
                      `(,(if (magit-anything-modified-p)
                             "✏")
                        ,(if (not (magit-rev-eq (magit-get-current-branch)
                                                (magit-get-push-branch)))
                             "∦")
                        ,(or (magit-get-current-branch)
                             (magit-rev-name "HEAD")))))
    "n.a.")
  )

Previous code would give you a new git column

Screenshot 2020-01-06 at 21 22 56
FrancescElies commented 4 years ago

Travis fails for emacs 26

image

I believe this is not related to changes introduced by this pr.

Update: This Issue was reported at https://github.com/rejeep/evm/issues/134

DamienCassou commented 2 years ago

I'm closing all old PRs. If you still care, please rebase your branch and reopen the PR.