-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
The error is produced under
transientversion0.8.7(afc88b2)
Related Codes
transient-showcase/transient-showcase.el
Lines 588 to 613 in ac2bbe6
| (defvar tsc--position '(0 0) "A transient prefix location.") | |
| (transient-define-infix tsc--pos-infix () | |
| "A location, key, or command symbol." | |
| :class 'transient-lisp-variable | |
| :transient t | |
| :prompt "An expression such as (0 0), \"p\", nil, 'tsc--msg-pos: " | |
| :variable 'tsc--position) | |
| (transient-define-suffix tsc--msg-pos () | |
| "Message the element at location." | |
| :transient 'transient--do-call | |
| (interactive) | |
| ;; lisp variables are not sent in the usual (transient-args) list. | |
| ;; Just read `tsc--position' directly. | |
| (let ((suffix (transient-get-suffix | |
| transient-current-command tsc--position))) | |
| (message "%s" (oref suffix description)))) | |
| (transient-define-prefix tsc-lisp-variable () | |
| "A prefix that updates and uses a lisp variable." | |
| ["Location Printing" | |
| [("p" "position" tsc--pos-infix)] | |
| [("m" "message" tsc--msg-pos)]]) | |
| ;; (tsc-lisp-variable) |
Errors
In this example that uses transient-get-suffix, when running with loc (0 0) it errors with
message: Wrong type argument: (or eieio-object cl-structure-object oclosure), [nil transient-column nil ((nil transient-suffix (:key "p" :description "position" :command tsc--pos-infix)))] It locates a column. To pick a suffix, use (0 0 0). But it errors with
message: Wrong type argument: (or eieio-object cl-structure-object oclosure), (nil transient-suffix (:key "p" :description "position" :command tsc--pos-infix))Root Cause
Turns out that the function returns a list of form (LEVEL CLASS PLIST) rather than the ones oref expects, see transient.org from transient
Proposed Change
By change the way of accessing suffix (see the implement of transient-suffix-put at https://github.com/magit/transient/blob/afc88b24e4faa5c7e246303648e70b4507652f32/lisp/transient.el#L1564-L1566), it message the desired slot value.
(message "%s" (plist-get (elt suffix 2) :description)))) Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels