I'm trying to modify a transient defined in python-pytest and add some suffix for pytest-django extension. I would like one of my arguments to be "active". It is similar to https://emacs.stackexchange.com/a/66462/13945, but I cannot modify the original transient's :value
.
The following image should explain what I want (my stuff is in the group "Options for pytest-django"):
I define a variable that the user can customize and that will be the default for my suffix (and an helper function). Then I define the new argument that I would like to be set active by default.
My code is as follows:
(defcustom DJANGO_SETTINGS_MODULE nil
"django settings module used by pytest."
:type '(string)
)
(defun python-pytest-django:--ds__init ()
"Init value of --ds suffix"
(concat "--ds " DJANGO_SETTINGS_MODULE))
(transient-define-argument python-pytest-django:--ds ()
:description "Set DJANGO_SETTINGS_MODULE."
:class 'transient-option
:argument (python-pytest-django:--ds__init)
;; :init-value '(python-pytest-django:--ds__init) ;; 🠮 transient-setup: Invalid function:...
;; :value '(python-pytest-django:--ds__init) ;; 🠮 invalid-slot-name
:allow-empty nil
:key "--ds"
:reader 'python-pytest--read-quoted-argument-for-short-flag)
(defun append-pytest-django-suffixes ()
"Append options related to pytest-django to python-pytest transient."
(transient-append-suffix 'python-pytest-dispatch '(-2) ;; just before the last group
["Options for pytest-django"
("--rd" "reuse DB" "--reuse-db")
("--cd" "create DB" "--create-db")
(python-pytest-django:--ds)
]))
(append-pytest-django-suffixes)