positron-solutions / transient-showcase

Example forms for transient UI's in Emacs
GNU General Public License v3.0
213 stars 22 forks source link

transient-append-suffix examples #10

Closed agzam closed 1 year ago

agzam commented 1 year ago

Would be nice to have examples of transient-append-suffix. Thanks.

psionic-k commented 1 year ago

It is done. I used insert, but the signature and the arguments that they accept are basically the same. You can have difficulty inserting into a completely empty group, but this shouldn't stop you from doing anything practically.

agzam commented 1 year ago

Doesn't look what I had in mind. Sometimes you want to add new keys to existing transients, for example:

(defun +magit-log-orig_head--head (args files)
  "Compare log since the last pull. i.e.: show only commits between last pull the head."
  (interactive (magit-log-arguments))
  (magit-log-other
   (list "ORIG_HEAD..HEAD")
   (car (magit-log-arguments)) files))

(transient-append-suffix 'magit-log "l"
    '("p" "orig_head..head" +magit-log-orig_head--head))

This adds a new thing to the magit-log transient

psionic-k commented 1 year ago

I did it dynamically, using user input to fill out the argument list. The magit example you have shown is the same thing, but the arguments are hard-coded and the LOC argument is a letter instead of a coordinate. That should help you read the example.