Skip to content

Adding custom plugins support easily #71

Open
@paquiteau

Description

@paquiteau

Hello there,
I am using your package more and more, and keep liking it. In my python projects I usually defines some custom command lines arguments for pytest, and found a nice way to add them dynamically to the transient menu.

I rely on .dir-locals.el for projects variables, to store custom transients menu and load them accordingly:

(defvar pytest-local-transient '((:info "No local options")) "Local options for creating local prefixes." )

;; Custom Group specification 
;; https://www.gnu.org/software/emacs/manual/html_mono/transient.html#Group-Specifications
(transient-append-suffix 'python-pytest-dispatch '(-2)
 ["Local Options" 
  :setup-children (lambda (_) 
     (list (transient-parse-suffix transient--suffixes pytest-local-transient)))
]))

And then define custom transient suffix in a .dir-locals.el file:

;; $MY_PYTHON_PROJECT/.dir-locals.el
((python-mode (pytest-local-transient .
                ((
                    "b" "Backend to run" "--backend="
                    :multi-value repeat
                    :choices ("cpu" "gpu")
                )))
))

Let me know if you would like to have this as a PR, but as it is fairly minimal coda I think it will still be happy if it stayed comfy in my config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions