Skip to content

Commit

Permalink
tangling line spaces
Browse files Browse the repository at this point in the history
Signed-off-by: Psionik K <[email protected]>
  • Loading branch information
psionic-k committed Dec 24, 2022
1 parent 5a6a307 commit 1b5d458
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion transient-showcase.el
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
the-prefix-arg scope args)))

;; ts-suffix-print-args command is incidentally created

(transient-define-prefix ts-hello ()
"Prefix that is minimal and uses an anonymous command suffix."
[("s" "call suffix"
Expand All @@ -106,6 +107,7 @@
;; First, use M-x org-babel-execute-src-blk to cause `ts-hello' to be defined
;; Second, M-x `eval-last-sexp' with your point at the end of the line below
;; (ts-hello)

(transient-define-suffix ts-suffix-wave-macroed ()
"Prefix that waves with macro-defined suffix."
:transient t
Expand All @@ -118,13 +120,15 @@
;; (ts-suffix-wave-macroed)
;; Because that's where the suffix object is stored
;; (get 'ts-suffix-wave-macroed 'transient--suffix)

;; ts-suffix-wave-suffix defined above

(transient-define-prefix ts-wave-macro-defined ()
"Prefix to wave using a macro-defined suffix."
[(ts-suffix-wave-macroed)]) ; note, information moved from prefix to the suffix.

;; (ts-wave-macro-defined)

(defun ts--wave-override ()
"Vanilla command used to override suffix's commands."
(interactive)
Expand All @@ -139,6 +143,7 @@
:command ts--wave-override)]) ; we overrode what the suffix even does

;; (ts-wave-overridden)

(transient-define-prefix ts-layout-descriptions ()
"Prefix with descriptions specified with slots."
["Let's Give This Transient a Title\n" ; yes the newline works
Expand All @@ -159,6 +164,7 @@
("we" "wave excessively" ts-suffix-wave)]])

;; (ts-layout-descriptions)

(transient-define-prefix ts-layout-dynamic-descriptions ()
"Prefix that generate descriptions dynamically when transient is shown."
;; group using function-name to generate description
Expand All @@ -173,18 +179,21 @@
("wu" "wave uniquely" ts-suffix-wave)])

;; (ts-layout-dynamic-descriptions)

(transient-define-prefix ts-layout-stacked ()
"Prefix with layout that stacks groups on top of each other."
["Top Group" ("wt" "wave top" ts-suffix-wave)]
["Bottom Group" ("wb" "wave bottom" ts-suffix-wave)])

;; (ts-layout-stacked)

(transient-define-prefix ts-layout-columns ()
"Prefix with side-by-side layout."
[["Left Group" ("wl" "wave left" ts-suffix-wave)]
["Right Group" ("wr" "wave right" ts-suffix-wave)]])

;; (ts-layout-columns)

(transient-define-prefix ts-layout-stacked-columns ()
"Prefix with stacked columns layout."
["Top Group"
Expand All @@ -196,6 +205,7 @@
("wr" "wave right" ts-suffix-wave)]])

;; (ts-layout-stacked-columns)

(transient-define-prefix ts-layout-spaced-out ()
"Prefix lots of spacing for users to space out at."
["" ; cannot add another empty string because it will mix suffixes with groups
Expand Down Expand Up @@ -223,6 +233,7 @@
("br" "wave bottom-right" ts-suffix-wave)]])

;; (ts-layout-spaced-out)

(transient-define-prefix ts-layout-the-grid ()
"Prefix with groups in a grid-like arrangement."

Expand All @@ -242,6 +253,7 @@
("rbb" "right bottom bottom\n" ts-suffix-wave)]])

;; (ts-layout-the-grid)

(transient-define-prefix ts-layout-explicit-classes ()
"Prefix with group class used to explicitly specify layout."
[:class transient-row "Row"
Expand All @@ -252,6 +264,7 @@
("b" "wave bottom" ts-suffix-wave)])

;; (ts-layout-explicit-classes)

(transient-define-prefix ts-stay-transient ()
"Prefix where some suffixes do not exit."
["Exit or Not?"
Expand All @@ -261,6 +274,7 @@
("ws" "wave & stay" ts-wave :transient t)])

;; (ts-stay-transient)

(transient-define-prefix ts--simple-child ()
["Simple Child"
("wc" "wave childishly" ts-suffix-wave)])
Expand All @@ -273,6 +287,7 @@

;; (ts--simple-child)
;; (ts-simple-parent)

(transient-define-prefix ts-simple-parent-with-return ()
"Prefix with a child prefix that returns."
["Parent With Return"
Expand All @@ -282,6 +297,7 @@
;; Child does not "return" when called independently
;; (ts--simple-child)
;; (ts-simple-parent-with-return)

(transient-define-suffix ts-suffix-setup-child ()
"A suffix that uses `transient-setup' to manually load another transient."
(interactive)
Expand All @@ -304,6 +320,7 @@
("bc" "become child" ts-suffix-setup-child :transient transient--do-replace)])

;; (ts-parent-with-setup-suffix)

(transient-define-suffix ts--suffix-interactive-string (user-input)
"An interactive suffix that obtains string input from the user."
(interactive "sPlease just tell me what you want!: ")
Expand All @@ -321,6 +338,7 @@
("b" "select buffer" ts--suffix-interactive-buffer-name)])

;; (ts-interactive-basic)

(defvar ts--complex nil "Show complex menu or not.")

(transient-define-suffix ts--toggle-complex ()
Expand Down Expand Up @@ -367,6 +385,7 @@
;; (ts-simple-messager)
;; does not "return" when called independently
;; (ts-complex-messager)

;; infix defined with a macro
(transient-define-argument ts--exclusive-switches ()
"This is a specialized infix for only selecting one of several values."
Expand Down Expand Up @@ -398,6 +417,7 @@
("s" "show arguments" ts-suffix-print-args)])

;; (ts-basic-infixes)

(transient-define-suffix ts--read-prefix-scope ()
"Read the scope of the prefix."
:transient 'transient--do-call
Expand Down Expand Up @@ -446,6 +466,7 @@
;; Then r to read
;; ... and so on
;; C-g to exit

(transient-define-suffix ts-suffix-eat-snowcone (args)
"Eat the snowcone!
This command can be called from it's parent, `ts-snowcone-eater' or independently."
Expand Down Expand Up @@ -500,6 +521,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
;; When you call the suffix independently, it can still read the saved values!
;; M-x ts-suffix-eat-snowcone or `eval-last-sexp' below
;; (call-interactively 'ts-suffix-eat-snowcone)

(transient-define-prefix ts-ping ()
"Prefix demonstrating history sharing."

Expand Down Expand Up @@ -529,6 +551,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
;; 5. p to switch to the ts-pong transient
;; 6. C-x p to load the previous history, see the old value from ts-ping???
;; 7. Note that ts-pong uses the same history as ts-ping!

(transient-define-prefix ts-goldfish ()
"A prefix that cannot remember anything."
["Goldfish"
Expand All @@ -540,6 +563,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("a" "print args" ts-suffix-print-args :transient nil)])

;; (ts-goldfish)

(transient-define-suffix ts-suffix-remember-and-wave ()
"Wave, and force the prefix to set it's saveable infix values."
(interactive)
Expand All @@ -561,6 +585,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("a" "print args (skips remembering)" ts-suffix-print-args :transient nil)])

;; (ts-elephant)

(transient-define-prefix ts-default-values ()
"A prefix with a default value."

Expand All @@ -574,6 +599,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("s" "show arguments" ts-suffix-print-args)])

;; (ts-default-values)

(transient-define-prefix ts-enforcing-inputs ()
"A prefix with enforced input type."

Expand All @@ -584,6 +610,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("s" "show arguments" ts-suffix-print-args)])

;; (ts-enforcing-inputs)

(defvar ts--position '(0 0) "A transient prefix location.")

(transient-define-infix ts--pos-infix ()
Expand All @@ -609,6 +636,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
[("m" "message" ts--msg-pos)]])

;; (ts-lisp-variable)

(transient-define-prefix ts-switches-and-arguments (arg)
"A prefix with switch and argument examples."
[["Arguments"
Expand All @@ -627,6 +655,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("s" "show arguments" ts-suffix-print-args)]) ; use to analyze the switch values

;; (ts-switches-and-arguments)

(transient-define-infix ts--random-init-infix ()
"Switch on and off."
:argument "--switch"
Expand All @@ -648,6 +677,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
;; ...
;; Run the command a few times to see the random initialization of `ts--random-init-infix'
;; It will only take more than ten tries for one in a thousand users. Good luck.

(transient-define-argument ts--animals-argument ()
"Animal picker."
:argument "--animals="
Expand All @@ -663,6 +693,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("s" "show arguments" ts-suffix-print-args)])

;; (ts-animal-choices)

(transient-define-argument ts--snowcone-flavor ()
:description "Flavor of snowcone."
:class 'transient-switches
Expand All @@ -681,6 +712,7 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("s" "show arguments" ts-suffix-print-args)])

;; (ts-exclusive-switches)

(transient-define-prefix ts-incompatible ()
"Prefix demonstrating incompatible switches."
;; update your transient version if you experience #129 / #155
Expand All @@ -701,11 +733,12 @@ This command can be called from it's parent, `ts-snowcone-eater' or independentl
("s" "show arguments" ts-suffix-print-args)])

;; (ts-incompatible)

(defun ts--animal-choices (_complete-me _predicate flag)
"Programmed completion for animal choice.
_COMPLETE-ME: whatever the user has typed so far
_PREDICATE: function you should use to filter candidates (only nil seen so far)
FLAG: request for metadata (which can be disrespected)"
FLAG: request for metadata (which can be disrespected)"

;; if you want to respect metadata requests, here's what the form might
;; look like, but no behavior was observed.
Expand All @@ -729,6 +762,7 @@ FLAG: request for metadata (which can be disrespected)"
("s" "show arguments" ts-suffix-print-args)])

;; (ts-choices-with-completions)

(defun ts--quit-cowsay ()
"Kill the cowsay buffer and exit."
(interactive)
Expand Down Expand Up @@ -794,6 +828,7 @@ FLAG: request for metadata (which can be disrespected)"
("q" "quit" ts--quit-cowsay)]])

;; (ts-cowsay)

(transient-define-prefix ts-visibility-predicates ()
"Prefix with visibility predicates.
Try opening this prefix in buffers with modes deriving from different
Expand Down Expand Up @@ -826,6 +861,7 @@ abstract major modes."
("to" "wave org-modeishly" ts-suffix-wave :if-mode org-mode)]])

;; (ts-visibility-predicates)

(defun ts--child-scope-p ()
"Return the scope of the current transient.
When this is called in layouts, it's the transient being layed out"
Expand Down Expand Up @@ -862,6 +898,7 @@ When this is called in layouts, it's the transient being layed out"
("c" "launch child prefix" ts--inapt-children :transient transient--do-recurse)])

;; (ts-inapt-parent)

(transient-define-prefix ts-levels-and-visibility ()
"Prefix with visibility levels for hiding rarely used commands."

Expand All @@ -886,6 +923,7 @@ When this is called in layouts, it's the transient being layed out"
("we" "wave eventually" ts--wave-eventually)]])

;; (ts-levels-and-visibility)

(transient-define-prefix ts-generated-child ()
"Prefix that uses `setup-children' to generate single child."

Expand All @@ -906,6 +944,7 @@ When this is called in layouts, it's the transient being layed out"
(message "You should replace me!")))])

;; (ts-generated-child)

(transient-define-prefix ts-generated-group ()
"Prefix that uses `setup-children' to generate a group."

Expand All @@ -926,6 +965,7 @@ When this is called in layouts, it's the transient being layed out"
(message "You should replace me!")))])

;; (ts-generated-group)

;; The children we will be picking can be of several forms. The
;; transient--layout symbol property of a prefix is a vector of vectors, lists,
;; and strings. It's not the actual eieio types or we would use
Expand Down Expand Up @@ -1048,6 +1088,7 @@ Show either the child's description or a default if no child is selected."
;; Save the infix, re-evaluate the prefix, and open the prefix again
;; Try flipping through history
;; Now do think of doing things like this with org ids, magit-sections, buffers etc.

(transient-define-suffix ts--inception-update-description ()
"Update the description of of the selected child."
(interactive)
Expand Down Expand Up @@ -1096,6 +1137,7 @@ Show either the child's description or a default if no child is selected."
;; Using a transient to modify a transient (⊃。•́‿•̀。)⊃━✿✿✿✿✿✿
;; Try to rename a group, such as (0 0)
;; Rename the very outer group, (0)

(transient-define-prefix ts-showcase ()
"A launcher for a currated selection of examples.
While most of the prefixes have their :transient slot set to t, it's not
Expand Down

0 comments on commit 1b5d458

Please sign in to comment.