transient-defvar
psionic-k opened this issue · comments
Some toying with the transient-lisp-variable
gave me a useful idea for package authors:
(defcustom my-custom-variable
:type 'natnum)
;; note, use of defvar style signature, setting the default value to any value or literal, like defvar
(transient-defvar my-transient-variable my-custom-variable
:key "v"
:description "variable"
:buffer-local nil
:type 'natnum )
(transient-define-prefix use-vars ()
[(my-transient-variable)])
The concept is to combine the defvar
and the transient-define-infix
. The :type argument would allow use of custom style readers. Normal :reader and :type should be exclusive.
With some effort to consume existing defvar's and give them an infix, the transient-define-prefix
macro could decide to create new variables or re-use the already created suffix if the same variable was re-defined (redundantly) in multiple prefixes.
The variable would implement a lisp-variable
that points toward a new defvar
and uses custom and other reader choices. The transient suffix behavior in #261 would set and return the value for use in interactive forms.
This would be valuable for more quickly building transients that pull together a coherent UI for normal Elisp packages building on custom and interactive.