├── .github ├── .envrc ├── FUNDING.yaml ├── pull_request_template.md ├── flake.nix ├── flake.lock ├── workflows │ └── ci.yml └── run-shim.el ├── .gitignore ├── CONTRIBUTING.org ├── COPYING └── transient-showcase.el /.github/.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .direnv/ 2 | **.elc 3 | **.el~ 4 | **/*autoloads.el 5 | **trash 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yaml: -------------------------------------------------------------------------------- 1 | # This is the bootstrap solution. It will live for approximately a year. 2 | github: positron-solutions 3 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Pull Requests 2 | 3 | See CONTRIBUTING.org for much more info on commit sign-off, GPG signing. Here's 4 | the reminders: 5 | 6 | ### Creating pull requests 7 | 8 | 1. Fork this repository into the personal GitHub account 9 | 1. Make changes on the personal fork 10 | 1. Remember to sign off and sign all commits in your PR branch (instructions in readme) 11 | 1. Make a Pull Request against this repository 12 | 1. **Allow maintainers to make changes to your pull request** (there's a 13 | checkbox) 14 | 1. Once the pull request has been approved, you will be thanked and observe your 15 | changes applied with authorship, signature, and sign-off in the git log 16 | 17 | ### Quality Assurance 18 | 19 | - Don't break =org-babel-execute-source-block= 20 | - Don't break compile or tangle for the package (`org-babel-tangle`) 21 | - Don't break the TOC (use `org-make-toc` package) 22 | - GPG sign your commits 23 | 24 | CI & review are meant to raise quality. Writing quality to begin with in every 25 | change is always faster for everyone. 26 | 27 | ### Updating Nix Versions 28 | 29 | This project usually should not update any nixpkgs versions frequently, but the 30 | emacs overlay may benefit from updates. 31 | 32 | Generated changes to the flake.lock should be kept in a separate commit for the 33 | reviewer. Title your commit as "generated". 34 | 35 | Keeping these changes isolated in specific commits makes it much easier to pull 36 | in your changes in parallel with other features. Maintainers may harvest your 37 | changes. We only guarantee to preserve authorship, signature, and sign-off in 38 | the git log. 39 | -------------------------------------------------------------------------------- /.github/flake.nix: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 Positron Solutions 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | # this software and associated documentation files (the "Software"), to deal in 5 | # the Software without restriction, including without limitation the rights to 6 | # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | # the Software, and to permit persons to whom the Software is furnished to do so, 8 | # subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | { 21 | description = "This flake provides CI & local development dependencies"; 22 | 23 | inputs = { 24 | nixpkgs.url = "github:nixos/nixpkgs?ref=release-23.11"; 25 | flake-utils.url = "github:numtide/flake-utils"; 26 | emacs-overlay = { 27 | url = "github:nix-community/emacs-overlay"; 28 | inputs.nixpkgs.follows = "nixpkgs"; 29 | inputs.flake-utils.follows = "flake-utils"; 30 | }; 31 | }; 32 | 33 | outputs = inputs: 34 | with inputs; 35 | flake-utils.lib.eachDefaultSystem (system: 36 | let 37 | 38 | pkgs = import nixpkgs { 39 | inherit system; 40 | overlays = [ emacs-overlay.overlay ]; 41 | }; 42 | 43 | emacsPackages = [ 44 | "emacs" 45 | "emacs-unstable" # transient upstream changes may appear here 46 | ]; 47 | 48 | devShells = pkgs.lib.genAttrs emacsPackages (emacsPkg: 49 | pkgs.mkShell { 50 | packages = [ 51 | ((pkgs.emacsPackagesFor pkgs.${emacsPkg}).emacsWithPackages 52 | (epkgs: [ 53 | epkgs.melpaPackages.elisp-lint 54 | ])) 55 | ]; 56 | }); 57 | in { 58 | devShells = devShells // { default = devShells.emacsGit; }; 59 | }); 60 | } 61 | -------------------------------------------------------------------------------- /.github/flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "emacs-overlay": { 4 | "inputs": { 5 | "flake-utils": [ 6 | "flake-utils" 7 | ], 8 | "nixpkgs": [ 9 | "nixpkgs" 10 | ], 11 | "nixpkgs-stable": "nixpkgs-stable" 12 | }, 13 | "locked": { 14 | "lastModified": 1706406538, 15 | "narHash": "sha256-VmeZ0iaGJWkzYepUpkzHPz6vFvdB3YAPguZjwKPGueE=", 16 | "owner": "nix-community", 17 | "repo": "emacs-overlay", 18 | "rev": "d6d5dd09b6533a30e3b312f0f225bd3475733f23", 19 | "type": "github" 20 | }, 21 | "original": { 22 | "owner": "nix-community", 23 | "repo": "emacs-overlay", 24 | "type": "github" 25 | } 26 | }, 27 | "flake-utils": { 28 | "inputs": { 29 | "systems": "systems" 30 | }, 31 | "locked": { 32 | "lastModified": 1705309234, 33 | "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", 34 | "owner": "numtide", 35 | "repo": "flake-utils", 36 | "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", 37 | "type": "github" 38 | }, 39 | "original": { 40 | "owner": "numtide", 41 | "repo": "flake-utils", 42 | "type": "github" 43 | } 44 | }, 45 | "nixpkgs": { 46 | "locked": { 47 | "lastModified": 1706387821, 48 | "narHash": "sha256-9kDiEDdS3o6dZg4K7z24Mr095yY21Qxu0wdZqRHpqNs=", 49 | "owner": "nixos", 50 | "repo": "nixpkgs", 51 | "rev": "a93f891e7511780bd9172e69db574242acc79043", 52 | "type": "github" 53 | }, 54 | "original": { 55 | "owner": "nixos", 56 | "ref": "release-23.11", 57 | "repo": "nixpkgs", 58 | "type": "github" 59 | } 60 | }, 61 | "nixpkgs-stable": { 62 | "locked": { 63 | "lastModified": 1706098335, 64 | "narHash": "sha256-r3dWjT8P9/Ah5m5ul4WqIWD8muj5F+/gbCdjiNVBKmU=", 65 | "owner": "NixOS", 66 | "repo": "nixpkgs", 67 | "rev": "a77ab169a83a4175169d78684ddd2e54486ac651", 68 | "type": "github" 69 | }, 70 | "original": { 71 | "owner": "NixOS", 72 | "ref": "nixos-23.11", 73 | "repo": "nixpkgs", 74 | "type": "github" 75 | } 76 | }, 77 | "root": { 78 | "inputs": { 79 | "emacs-overlay": "emacs-overlay", 80 | "flake-utils": "flake-utils", 81 | "nixpkgs": "nixpkgs" 82 | } 83 | }, 84 | "systems": { 85 | "locked": { 86 | "lastModified": 1681028828, 87 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 88 | "owner": "nix-systems", 89 | "repo": "default", 90 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 91 | "type": "github" 92 | }, 93 | "original": { 94 | "owner": "nix-systems", 95 | "repo": "default", 96 | "type": "github" 97 | } 98 | } 99 | }, 100 | "root": "root", 101 | "version": 7 102 | } 103 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2022 Positron Solutions 2 | 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | # this software and associated documentation files (the "Software"), to deal in 5 | # the Software without restriction, including without limitation the rights to 6 | # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | # the Software, and to permit persons to whom the Software is furnished to do so, 8 | # subject to the following conditions: 9 | 10 | # The above copyright notice and this permission notice shall be included in all 11 | # copies or substantial portions of the Software. 12 | 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | name: CI 21 | 22 | on: # trigger this workflow on... 23 | push: 24 | branches: [ $default-branch ] # pushes to the default branch... 25 | pull_request_target: 26 | # ...or every pull request, from any branch to any branch, 27 | paths-ignore: ['README.org'] 28 | 29 | workflow_dispatch: 30 | # Allows you to run this workflow manually from the Actions tab 31 | 32 | jobs: 33 | continuous-integration: # just a job name 34 | 35 | # Run on every OS and Emacsen 36 | # Some steps specify their own logic! 37 | strategy: 38 | matrix: 39 | os: [ ubuntu-latest ] 40 | emacsPkg: [ emacs, emacs-unstable ] 41 | runs-on: ${{ matrix.os }} 42 | 43 | steps: 44 | - uses: actions/checkout@v3.2.0 45 | - uses: cachix/install-nix-action@v22 46 | with: 47 | extra_nix_config: | 48 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 49 | - uses: cachix/cachix-action@v12 50 | with: 51 | # This CACHIX_AUTH_TOKEN & CACHIX_CACHE_NAME are secrets you must set 52 | # in your repository settings 53 | name: ${{ secrets.CACHIX_CACHE_NAME }} 54 | authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} 55 | extraPullNames: nix-community # look for pre-built binaries from upstream 56 | # Some paths may confuse cachix. Add them with a pipe to the pushFilter 57 | pushFilter: "(.drv.chroot$)" 58 | 59 | # Linting the package is less useful on multiple version. Modify the 60 | # logic if you wish to expand lint coverage. 61 | - name: lint package 62 | if: matrix.emacsPkg == 'emacs' 63 | run: | 64 | eval "$(nix print-dev-env \ 65 | --override-input nixpkgs github:nixos/nixpkgs/release-22.11 \ 66 | --update-input emacs-overlay \ 67 | .github#${{ matrix.emacsPkg }})" 68 | 69 | emacs --script .github/run-shim.el -- lint 70 | 71 | # Tangle the package so we can load the result 72 | - name: tangle package 73 | run: | 74 | eval "$(nix print-dev-env \ 75 | --override-input nixpkgs github:nixos/nixpkgs/release-22.11 \ 76 | --update-input emacs-overlay \ 77 | .github#${{ matrix.emacsPkg }})" 78 | 79 | emacs --script .github/run-shim.el -- tangle 80 | 81 | # Load the package to basically see if it evaluates cleanly 82 | - name: load package 83 | run: | 84 | eval "$(nix print-dev-env \ 85 | --override-input nixpkgs github:nixos/nixpkgs/release-22.11 \ 86 | --update-input emacs-overlay \ 87 | .github#${{ matrix.emacsPkg }})" 88 | 89 | emacs --script .github/run-shim.el -- load 90 | -------------------------------------------------------------------------------- /.github/run-shim.el: -------------------------------------------------------------------------------- 1 | ;;; run-shim.el --- -*-no-byte-compile: t; lexical-binding: t -*- 2 | 3 | ;; Copyright (C) 2022 Positron Solutions 4 | 5 | ;; Author: Psionik K <73710933+psionic-k@users.noreply.github.com> 6 | 7 | ;; Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | ;; this software and associated documentation files (the "Software"), to deal in 9 | ;; the Software without restriction, including without limitation the rights to 10 | ;; use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | ;; the Software, and to permit persons to whom the Software is furnished to do so, 12 | ;; subject to the following conditions: 13 | 14 | ;; The above copyright notice and this permission notice shall be included in all 15 | ;; copies or substantial portions of the Software. 16 | 17 | ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | ;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | ;; FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | ;; COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | ;; IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | ;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | ;;; Commentary: 25 | 26 | ;; This package sets up load paths and then loads the test files and runs 27 | ;; commands depending on the command line arguments. 28 | ;; 29 | ;; Usage: 30 | ;; 31 | ;; Always get a fresh Emacs for your test runs. It will reload features and 32 | ;; byte compile where necessary. The Emacs provided by the nix develop shell 33 | ;; contains the dependencies declared in the flake.nix. 34 | ;; 35 | ;; nix develop .github# 36 | ;; "emacs" --quick --script .github/run-shim.el -- tangle 37 | ;; "emacs" --quick --script .github/run-shim.el -- load 38 | ;; "emacs" --quick --script .github/run-shim.el -- lint 39 | ;; 40 | ;; Note that this elisp script assumes that some packages are located in 41 | ;; specific locations. 42 | 43 | ;;; Code: 44 | 45 | (defun run-shim () 46 | "Execute a CI process based on CLI arguments." 47 | (run-shim-setup) 48 | 49 | ;; Consume the command argument and run one of the routines Additional 50 | ;; arguments can be read as needed in sub-commands. 51 | 52 | ;; Modify this hunk to change your CI steps. 53 | (pcase (pop argv) 54 | ("tangle" 55 | (require 'ob-tangle) 56 | (org-babel-tangle-file (expand-file-name "README.org"))) 57 | ("load" 58 | (require 'transient-showcase) 59 | (tsc-showcase)) 60 | ("lint" 61 | (run-shim-lint-package)) 62 | (_ 63 | (message "Command %s not recognized. Use tangle, load, lint etc." 64 | run-shim-command)))) 65 | 66 | (defun run-shim-lint-package () 67 | "Lint the files in the package directory." 68 | 69 | (require 'elisp-lint) 70 | ;; 100-character column limit for lints. If it's good enough for Linux, it's 71 | ;; good enough for us. https://lkml.org/lkml/2020/5/29/1038 72 | (setq-default fill-column 100) 73 | ;; Spaces 74 | (setq-default indent-tabs-mode nil) 75 | 76 | ;; `command-line-args-left has the same effect as passing command line arguments. 77 | (let ((command-line-args-left 78 | (append 79 | '(;; "--no- 80 | ;; "--no-byte-compile" 81 | "--no-checkdoc" 82 | "--no-indent" 83 | "--no-package-lint" 84 | "--no-fill-column" 85 | ;; "--no-check-declare" 86 | ) 87 | (seq-filter 88 | (lambda (s) (not (or (string-match-p "*-test.el$" s) 89 | (string-match-p ".*autoloads.*.el$" s)))) 90 | (file-expand-wildcards 91 | (if (file-exists-p "lisp/") "lisp/*.el" 92 | "*.el")))))) 93 | 94 | (message "ARGS: %s" command-line-args-left) 95 | 96 | ;; (setq elisp-lint-ignored-validators nil 97 | ;; elisp-lint-file-validators nil 98 | ;; elisp-lint-buffer-validators nil 99 | ;; elisp-lint-batch-files nil) 100 | 101 | (elisp-lint-files-batch))) 102 | 103 | (defun run-shim-compile-dir-recursively (dir) 104 | "Compile .el files in DIR. 105 | This is usually before loading for tests etc. The behavior of 106 | byte compiled and native compiled code is more interesting than 107 | uncompiled elisp because usually installed packages will be 108 | compiled when run by the user." 109 | (mapc (if (native-comp-available-p) #'native-compile 110 | #'byte-compile-file) 111 | (directory-files-recursively dir (rx ".el" eol)))) 112 | 113 | (defun run-shim-setup () 114 | "Normalize load paths, compilation, and behavior of shell arguments. 115 | The `default-directory' will be set to the root of the 116 | repository. Arguments will be stripped of Nix wrapper load 117 | paths. The load path will be configured to included /test, 118 | /load, and the repository root. Elisp files on the load path 119 | will be compiled, natively if available." 120 | 121 | ;; This expression normalizes the behavior of --quick --load and --script 122 | ;; behavior. If you don't do this, --script will see every argument 123 | ;; passed and the arguments from the Nix wrapper to set load paths. You can use 124 | ;; this to pass extra options to your scripts in the github actions. 125 | (when (member (car argv) '("-l" "--")) 126 | (print "Normalizing arguments") 127 | (while (not (member (car argv) '("--" nil))) 128 | (print (format "Normalizing arguments, stripped: %s" (pop argv)))) 129 | (pop argv)) ; pop the sentinel "--" 130 | 131 | (message "original default directory: %s" default-directory) 132 | (let* ((root-directory (if load-file-name 133 | (file-name-directory 134 | (directory-file-name 135 | (file-name-directory load-file-name))) 136 | (file-name-directory 137 | (directory-file-name 138 | default-directory)))) 139 | (test-dir (concat root-directory "test")) 140 | (lisp-dir (concat root-directory "lisp")) 141 | (package-dir (if (file-exists-p lisp-dir) lisp-dir 142 | root-directory))) 143 | (message "load-file-name for run-shim.el: %s" load-file-name) 144 | (message "root load path: %s" root-directory) 145 | (when (file-exists-p test-dir) 146 | (message (format "test load path: %s" test-dir)) 147 | (push test-dir load-path)) 148 | (message (format "package load path: %s" root-directory)) 149 | (push package-dir load-path) 150 | (setq default-directory root-directory)) 151 | 152 | ;; running manually may encounter stale .elc 153 | (setq load-prefer-newer t)) 154 | 155 | ;; Only attempt to run when Emacs is loading with or --batch --no-x-resources, 156 | ;; which is implied by -Q. 157 | (when (or noninteractive inhibit-x-resources) 158 | (run-shim)) 159 | 160 | (provide 'run-shim) 161 | ;;; run-shim.el ends here 162 | -------------------------------------------------------------------------------- /CONTRIBUTING.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Contributing 2 | #+AUTHOR: Psionik K 3 | 4 | * Contents 5 | :PROPERTIES: 6 | :TOC: :include siblings :ignore this 7 | :END: 8 | :CONTENTS: 9 | - [[#development][Development]] 10 | - [[#reproducing-ci][Reproducing CI]] 11 | - [[#lint-and-byte-compile-code][Lint and byte-compile code]] 12 | - [[#loading-and-re-loading-your-package][Loading and re-loading your package]] 13 | - [[#manual-loading--reloading][Manual Loading & Reloading]] 14 | - [[#license][License]] 15 | - [[#developer-certificate-of-origin-dco][Developer Certificate of Origin (DCO)]] 16 | - [[#sign-off][Sign-off]] 17 | - [[#gpg-signature][GPG signature]] 18 | - [[#user-setup-for-submitting-changes][User setup for submitting changes]] 19 | - [[#automatically-add-sign-off][Automatically add sign-off]] 20 | - [[#automatic-gpg-signing-with-per-project-keys][Automatic GPG signing with per-project keys]] 21 | - [[#manually-signing--adding-sign-off][Manually signing & adding sign-off]] 22 | - [[#maintaining-nixpkgs-versions][Maintaining nixpkgs versions]] 23 | :END: 24 | 25 | There are TODO's within the document. Some are notes to add support to transient. Errata in particular is where something seems possibly broken, missing, or unnecessarily weird. *Transient has been updated a lot, and many Errata were fixed. Please PR if you see something that works!* 26 | 27 | Spot something that seems inconsistent, unclear, or an example where the behavior is just odd? Please file an issue. If you can fix it, please submit a PR or patch suggestion in your issue. 28 | 29 | Want to add a new example? It is welcome. PR please. 30 | 31 | All changes must: 32 | 33 | - Re-generate the =transient-showcase.el= 34 | - Re-generate the the =README.md= 35 | - Don't break ~org-babel-execute-source-block~ 36 | - Don't break compile or tangle for the package 37 | - Don't break the TOC (re-generated using ~org-make-toc~ 38 | - GPG sign your commits 39 | 40 | This repository was created with [[https://github.com/positron-solutions/elisp-repo-kit/][elisp-repo-kit]]. (A literate org template is work in progress). 41 | 42 | * Updating Generated Files 43 | TODO this should be automated with the style of solutions from Elisp Repo Kit, using save hooks. 44 | 45 | ** Tangling 46 | ~org-babel-tangle-file~ 47 | 48 | ** Export 49 | You need to install [[https://github.com/larstvei/ox-gfm][ox-gfm]]. 50 | 51 | The markdown export needs to skip the Elisp sections. If this isn't automatic, you can configure it by running this expression inside the README.org buffer context. (~eval-expression~ when inside the buffer) 52 | 53 | #+begin_src elisp 54 | (let ((org-export-exclude-tags '("export_elisp" "noexport"))) 55 | (call-interactively #'org-gfm-export-to-markdown)) 56 | #+end_src 57 | 58 | The table of contents in the intended position will be printed with angle bracket links but normal title links at the top of the document. Manually clobber the angle bracket link ToC with the one generated at the top. It is silly. I have raised the issue and been given the runaround from both org and ox-gfm maintainers. 59 | * Reproducing CI 60 | CI will tangle the README, load the package, and then try to run =tsc-showcase=. It will also byte compile lint the package. 61 | 62 | If you cannot reproduce a failure (or success) on CI, then you may want to switch to using [[https://nixos.org/download.html][nix]] to get a reproducible toolchain so you can further develop with frozen versions from the nix [[https://nixos.wiki/wiki/Flakes][flake's]] flake.lock. 63 | 64 | #+begin_src shell 65 | 66 | nix develop .github# # loads the devShells.default from flake.nix 67 | cd .github && direnv allow # same as above with file watching 68 | 69 | #+end_src 70 | 71 | The run-shim.el file is a small ad-hoc elisp script. You can reproduce its 72 | three commands almost identically like so: 73 | 74 | #+begin_src shell eval: never 75 | 76 | emacs --quick --script .github/run-shim.el -- tangle 77 | emacs --quick --script .github/run-shim.el -- load 78 | emacs --quick --script .github/run-shim.el -- lint 79 | 80 | #+end_src 81 | 82 | ** Lint and byte-compile code 83 | This package uses [[https://github.com/gonewest818/elisp-lint][elisp-lint]] to detect issues with byte compiling, package format, code structure and others. This is run after tangling the new package. 84 | 85 | The configuration is found inside [[.github/run-shim.el][.github/run-shim.el]]. The CI run is invoked inside of [[.github/workflows/ci.yml][ci.yml]] using Emacs in script mode. Most of the configuration is in the run shim. 86 | 87 | You can run the lints manually almost the same as running tests. 88 | 89 | #+begin_src bash 90 | 91 | nix develop .github# 92 | # nix develop .github#emacs28 93 | # nix develop .github#emacsGit 94 | emacs --script .github/run-shim.el -- lint 95 | 96 | #+end_src 97 | ** Loading and re-loading your package 98 | Run =erk-reload-package= in one of your project files. All features in the /lisp directory will be re-compiled and loaded appropriately. 99 | 100 | *Note*, during reloading, unloading the current module is forced. If other packages you use depend on the project feature, results may be unpredictable. This is one reason batch style testing can be preferred. 101 | *** Manual Loading & Reloading 102 | To manually unload, run built-in command ~unload-feature~ and select your package name. If you do not unload, reloading has no effect and you will see stale behavior. 103 | 104 | Next, add the package to your load-path and then require it or, more directly, call =emacs-lisp-byte-compile-and-load= or =emacs-lisp-native-compile-and-load=. 105 | * License 106 | This project is GPL3 licensed and a copy is distributed in the file, [[./COPYING][COPYING]]. 107 | ** GPG signature 108 | A GPG signed commit shows that the owner of the private key submitted the changes. Wherever signatures are recorded in chains, they can demonstrate participation in changes elsewhere and awareness of what the submitter is participating in. Corroborating user's signature across a history of works strengthens that user's attestation provided by DCO sign-off. 109 | ** User setup for submitting changes 110 | Follow these instructions before you get ready to submit a pull-request. 111 | 112 | Refer to the [[https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits][Github signing commits]] instructions to set up your git client to add GPG signatures. File issues if you run into Emacs-specific problems. 113 | *** Automatic GPG signing with per-project keys 114 | In order to specify which projects you intend to sign with which keys, you will want to configure your git client using path-specific configurations. 115 | 116 | Configuring git for this can be done with the following directory structure: 117 | 118 | #+begin_src 119 | 120 | /home/rjdeveloper/ 121 | ├── .gitconfig 122 | └── .gitconfig.d 123 | ├── sco-linux-projects.conf 124 | ├── other-projects.conf 125 | └── gpg-signing-projects.conf 126 | 127 | #+end_src 128 | 129 | In your root config, ~.gitconfig~, add an =includeIf= directive that will load the configuration you use for projects you intend to GPG sign commits for. 130 | 131 | #+begin_src 132 | 133 | [includeIf "gitdir:/home/rjdeveloper/**/gpg-signing/**/.git"] 134 | path = "~/.gitconfig.d/gpg-signing-projects.conf" 135 | 136 | #+end_src 137 | 138 | In the ~gpg-signing-projects.conf~ add your GPG signing configuration from earlier. =sign= adds the GPG signature automatically. File an issue if you need help with multiple GPG homes or other configurations. 139 | 140 | #+begin_src 141 | 142 | [user] 143 | name = "Random J Developer" 144 | email = "random@developer.example.org" 145 | signingkey = "5FF0EBDC623B3AD4" 146 | 147 | [commit] 148 | sign = true 149 | gpgSign = true 150 | 151 | #+end_src 152 | * Maintaining nixpkgs versions 153 | Nixpkgs has a new release about every six months. You can check their [[https://github.com/NixOS/nixpkgs/branches][branches]] and [[https://github.com/NixOS/nixpkgs/tags][tags]] to see what's current. To get updated dependencies from MELPA, it's necessary to update the emacs-overlay with =nix flake lock --update-input emacs-overlay=. You can also specify revs and branches if you need to roll back. There is a make shortcut: =make flake-update= MacOS tends to get a little less test emphasis, and so =nixpkgs-darwin-= branches exist and are required to pass more Darwin tests before merging. This is more stable if you are on MacOS. =nixpkgs-unstable= or =master= are your other less common options. 154 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /transient-showcase.el: -------------------------------------------------------------------------------- 1 | ;;; transient-showcase.el --- transient features & behavior showcase -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2022-2025 Positron Solutions 4 | 5 | ;; Author: Positron 6 | ;; Keywords: convenience 7 | ;; Version: 0.1.0 8 | ;; Package-Requires: ((emacs "28.1")) 9 | ;; Homepage: http://github.com/positron-solutions/transient-showcase 10 | 11 | ;;; License notice: 12 | 13 | ;; This program is free software: you can redistribute it and/or modify 14 | ;; it under the terms of the GNU General Public License as published by 15 | ;; the Free Software Foundation, either version 3 of the License, or 16 | ;; (at your option) any later version. 17 | 18 | ;; This program is distributed in the hope that it will be useful, 19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | ;; GNU General Public License for more details. 22 | 23 | ;; You should have received a copy of the GNU General Public License 24 | ;; along with this program. If not, see . 25 | 26 | ;;; Commentary: 27 | 28 | ;; This package is created from the README and serves as a fast way to load 29 | ;; all of the examples without tangling the org document. This is appropriate 30 | ;; if you just want to quickly browse through the examples and see their 31 | ;; source code. 32 | ;; 33 | ;; M-x tsc-showcase contains most of the prefixes and can be bound for 34 | ;; use as a quick reference. Just use transient's help for each 35 | ;; command to see the source. C-h . 36 | ;; 37 | 38 | ;;; Code: 39 | 40 | (require 'transient) 41 | (require 'org-id) 42 | 43 | 44 | (defun tsc-suffix-wave () 45 | "Wave at the user." 46 | (interactive) 47 | (message "Waves at the user at: %s." (current-time-string))) 48 | 49 | 50 | (defvar tsc-busy nil "Are we busy?") 51 | 52 | (defun tsc--busy-p () "Are we busy?" tsc-busy) 53 | 54 | (transient-define-suffix tsc--toggle-busy () 55 | "Toggle busy." 56 | (interactive) 57 | (setf tsc-busy (not tsc-busy)) 58 | (message (propertize (format "busy: %s" tsc-busy) 59 | 'face 'success))) 60 | 61 | 62 | (transient-define-suffix tsc-suffix-show-level () 63 | "Show the current transient's level." 64 | :transient t 65 | (interactive) 66 | (message "Current level: %s" (oref transient-current-prefix level))) 67 | 68 | 69 | ;; Because command names are used to store and lookup child levels, we have 70 | ;; define a macro to generate unqiquely named wavers. See #153 at 71 | ;; https://github.com/magit/transient/issues/153 72 | (defmacro tsc--define-waver (name) 73 | "Define a new suffix with NAME tsc--wave-NAME." 74 | `(transient-define-suffix ,(intern (format "tsc--wave-%s" name)) () 75 | ,(format "Wave at the user %s" name) 76 | :transient t 77 | (interactive) 78 | (message (format "Waves %s at %s" ,name (current-time-string))))) 79 | 80 | ;; Each form results in a unique suffix definition. 81 | (tsc--define-waver "surely") 82 | (tsc--define-waver "normally") 83 | (tsc--define-waver "non-essentially") 84 | (tsc--define-waver "definitely") 85 | (tsc--define-waver "eventually") 86 | (tsc--define-waver "hidden") 87 | (tsc--define-waver "inquisitively") 88 | (tsc--define-waver "writingly") 89 | (tsc--define-waver "switchedly") 90 | (tsc--define-waver "unswitchedly") 91 | 92 | 93 | (transient-define-suffix tsc-suffix-print-args (the-prefix-arg) 94 | "Report the PREFIX-ARG, prefix's scope, and infix values." 95 | :transient 'transient--do-call 96 | (interactive "P") 97 | (let ((args (transient-args (oref transient-current-prefix command))) 98 | (scope (transient-scope))) 99 | (message "prefix-arg: %S \nprefix's scope value: %S \ntransient-args: %S" 100 | the-prefix-arg scope args))) 101 | 102 | ;; tsc-suffix-print-args command is incidentally created 103 | 104 | (transient-define-prefix tsc-hello () 105 | "Prefix that is minimal and uses an anonymous command suffix." 106 | [("s" "call suffix" 107 | (lambda () 108 | (interactive) 109 | (message "Called a suffix")))]) 110 | 111 | ;; First, use M-x org-babel-execute-src-blk to cause `tsc-hello' to be 112 | ;; defined 113 | ;; Second, M-x `eval-last-sexp' with your point at the end of the line below 114 | ;; (tsc-hello) 115 | 116 | (transient-define-suffix tsc-suffix-wave-macroed () 117 | "Prefix that waves with macro-defined suffix." 118 | :transient t 119 | :key "T" 120 | :description "wave from macro definition" 121 | (interactive) 122 | (message "Waves from a macro definition at: %s" (current-time-string))) 123 | 124 | ;; Suffix definition creates a command 125 | ;; (tsc-suffix-wave-macroed) 126 | ;; Because that's where the suffix object is stored 127 | ;; (get 'tsc-suffix-wave-macroed 'transient--suffix) 128 | 129 | ;; tsc-suffix-wave-suffix defined above 130 | (transient-define-prefix tsc-wave-macro-defined () 131 | "Prefix to wave using a macro-defined suffix." 132 | [(tsc-suffix-wave-macroed)]) 133 | ;; note, information moved from prefix to the suffix. 134 | 135 | ;; (tsc-wave-macro-defined) 136 | 137 | (defun tsc--wave-override () 138 | "Vanilla command used to override suffix's commands." 139 | (interactive) 140 | (message "This suffix was overridden. I am what remains.")) 141 | 142 | (transient-define-prefix tsc-wave-overridden () 143 | "Prefix that waves with overridden suffix behavior." 144 | [(tsc-suffix-wave-macroed 145 | :transient nil 146 | :key "O" 147 | :description "wave overridingly" 148 | :command tsc--wave-override)]) ; we overrode what the suffix even does 149 | 150 | ;; (tsc-wave-overridden) 151 | 152 | (transient-define-prefix tsc-layout-descriptions () 153 | "Prefix with descriptions specified with slots." 154 | ["Let's Give This Transient a Title\n" ; yes the newline works 155 | ["Group One" 156 | ("wo" "wave once" tsc-suffix-wave) 157 | ("wa" "wave again" tsc-suffix-wave)] 158 | 159 | ["Group Two" 160 | ("ws" "wave some" tsc-suffix-wave) 161 | ("wb" "wave better" tsc-suffix-wave)]] 162 | 163 | ["Bad title" :description "Group of Groups" 164 | ["Group Three" 165 | ("k" "bad desc" tsc-suffix-wave :description "key-value wins") 166 | ("n" tsc-suffix-wave :description "no desc necessary")] 167 | [:description "Key Only Def" 168 | ("wt" "wave too much" tsc-suffix-wave) 169 | ("we" "wave excessively" tsc-suffix-wave)]]) 170 | 171 | ;; (tsc-layout-descriptions) 172 | 173 | (transient-define-prefix tsc-layout-dynamic-descriptions () 174 | "Prefix that generate descriptions dynamically when transient is shown." 175 | ;; group using function-name to generate description 176 | [:description current-time-string 177 | ("-s" "--switch" "switch=") ; switch just to cause updates 178 | ;; single suffix with dynamic description 179 | ("wa" tsc-suffix-wave 180 | :description (lambda () 181 | (format "Wave at %s" (current-time-string))))] 182 | ;; group with anonymoous function generating description 183 | [:description (lambda () 184 | (format "Group %s" (org-id-new))) 185 | ("wu" "wave uniquely" tsc-suffix-wave)]) 186 | 187 | ;; (tsc-layout-dynamic-descriptions) 188 | 189 | (defun tsc--random-info () 190 | (format "Temperature outside: %d" (random 100))) 191 | 192 | (transient-define-prefix tsc-information () 193 | "Prefix that displays some information." 194 | ["Group Header" 195 | (:info "Basic info") 196 | (:info #'tsc--random-info) 197 | (:info "Use :format to remove whitespace" :format "%d") 198 | ("k" :info "Keys will be greyed out") 199 | "" ; empty line 200 | ("wg" "wave greenishly" tsc-suffix-wave)]) 201 | 202 | (transient-define-prefix tsc-layout-stacked () 203 | "Prefix with layout that stacks groups on top of each other." 204 | ["Top Group" ("wt" "wave top" tsc-suffix-wave)] 205 | ["Bottom Group" ("wb" "wave bottom" tsc-suffix-wave)]) 206 | 207 | ;; (tsc-layout-stacked) 208 | 209 | (transient-define-prefix tsc-layout-columns () 210 | "Prefix with side-by-side layout." 211 | [["Left Group" ("wl" "wave left" tsc-suffix-wave)] 212 | ["Right Group" ("wr" "wave right" tsc-suffix-wave)]]) 213 | 214 | ;; (tsc-layout-columns) 215 | 216 | (transient-define-prefix tsc-layout-stacked-columns () 217 | "Prefix with stacked columns layout." 218 | ["Top Group" 219 | ("wt" "wave top" tsc-suffix-wave)] 220 | 221 | [["Left Group" 222 | ("wl" "wave left" tsc-suffix-wave)] 223 | ["Right Group" 224 | ("wr" "wave right" tsc-suffix-wave)]]) 225 | 226 | ;; (tsc-layout-stacked-columns) 227 | 228 | (transient-define-prefix tsc-layout-spaced-out () 229 | "Prefix lots of spacing for users to space out at." 230 | ["" ; cannot add another empty string because it will mix suffixes with groups 231 | ["Left Group" 232 | "" 233 | ("wl" "wave left" tsc-suffix-wave) 234 | ("L" "wave lefter" tsc-suffix-wave) 235 | "" 236 | ("bl" "wave bottom-left" tsc-suffix-wave) 237 | ("z" "zone\n" zone)] ; the newline does pad 238 | 239 | [[]] ; empty vector will do nothing 240 | 241 | [""] ; vector with just empty line has no effect 242 | 243 | ;; empty group will be ignored 244 | ;; (useful for hiding in dynamic layouts) 245 | ["Empty Group\n"] 246 | 247 | ["Right Group" 248 | "" 249 | ("wr" "wave right" tsc-suffix-wave) 250 | ("R" "wave righter" tsc-suffix-wave) 251 | "" 252 | ("br" "wave bottom-right" tsc-suffix-wave)]]) 253 | 254 | ;; (tsc-layout-spaced-out) 255 | 256 | (transient-define-prefix tsc-layout-the-grid () 257 | "Prefix with groups in a grid-like arrangement." 258 | 259 | [:description 260 | "The Grid\n" ; must use slot or macro is confused 261 | ["Left Column" ; note, no newline 262 | ("ltt" "left top top" tsc-suffix-wave) 263 | ("ltb" "left top bottom" tsc-suffix-wave) 264 | "" 265 | ("lbt" "left bottom top" tsc-suffix-wave) 266 | ("lbb" "left bottom bottom" tsc-suffix-wave)] ; note, no newline 267 | 268 | ["Right Column\n" 269 | ("rtt" "right top top" tsc-suffix-wave) 270 | ("rtb" "right top bottom" tsc-suffix-wave) 271 | "" 272 | ("rbt" "right bottom top" tsc-suffix-wave) 273 | ("rbb" "right bottom bottom\n" tsc-suffix-wave)]]) 274 | 275 | ;; (tsc-layout-the-grid) 276 | 277 | (transient-define-prefix tsc-layout-explicit-classes () 278 | "Prefix with group class used to explicitly specify layout." 279 | [ :class transient-row "Row" 280 | ("l" "wave left" tsc-suffix-wave) 281 | ("r" "wave right" tsc-suffix-wave)] 282 | [ :class transient-column "Column" 283 | ("t" "wave top" tsc-suffix-wave) 284 | ("b" "wave bottom" tsc-suffix-wave)]) 285 | 286 | ;; (tsc-layout-explicit-classes) 287 | 288 | (transient-define-prefix tsc-stay-transient () 289 | "Prefix where some suffixes do not exit." 290 | ["Exit or Not?" 291 | 292 | ;; this suffix will not exit after calling sub-prefix 293 | ("we" "wave & exit" tsc-wave-overridden) 294 | ("ws" "wave & stay" tsc-suffix-wave :transient t)]) 295 | 296 | ;; (tsc-stay-transient) 297 | 298 | (transient-define-prefix tsc--simple-child () 299 | ["Simple Child" 300 | ("wc" "wave childishly" tsc-suffix-wave)]) 301 | 302 | (transient-define-prefix tsc-simple-parent () 303 | "Prefix that calls a child prefix." 304 | ["Simple Parent" 305 | ("w" "wave parentally" tsc-suffix-wave) 306 | ("b" "become child" tsc--simple-child)]) 307 | 308 | ;; (tsc--simple-child) 309 | ;; (tsc-simple-parent) 310 | 311 | (transient-define-prefix tsc-simple-parent-with-return () 312 | "Prefix with a child prefix that returns." 313 | ["Parent With Return" 314 | ("w" "wave parentally" tsc-suffix-wave) 315 | ("b" "become child with return" tsc--simple-child :transient t)]) 316 | 317 | ;; Child does not "return" when called independently 318 | ;; (tsc--simple-child) 319 | ;; (tsc-simple-parent-with-return) 320 | 321 | (transient-define-suffix tsc-suffix-setup-child () 322 | "A suffix that uses `transient-setup' to manually load another transient." 323 | (interactive) 324 | ;; note that it's usually during the post-command side of calling the 325 | ;; command that the actual work to set up the transient will occur. 326 | ;; This is an implementation detail because it depends if we are calling 327 | ;; `transient-setup' while already transient or not. 328 | (transient-setup 'tsc--simple-child)) 329 | 330 | (transient-define-prefix tsc-parent-with-setup-suffix () 331 | "Prefix with a suffix that calls `transient-setup'." 332 | ["Simple Parent" 333 | ("wp" "wave parentally" tsc-suffix-wave :transient t) ; remain transient 334 | 335 | ;; You may need to specify a different pre-command (the :transient) key 336 | ;; because we need to clean up this transient or create some conditions 337 | ;; to trigger the following transient correctly. This example will 338 | ;; work with `transient--do-replace' or no custom pre-command 339 | 340 | ("bc" "become child" tsc-suffix-setup-child 341 | :transient transient--do-replace)]) 342 | 343 | ;; (tsc-parent-with-setup-suffix) 344 | 345 | (defvar tsc--complex nil "Show complex menu or not.") 346 | 347 | (transient-define-suffix tsc--toggle-complex () 348 | "Toggle `tsc--complex'." 349 | :transient t 350 | :description (lambda () (format "toggle complex: %s" tsc--complex)) 351 | (interactive) 352 | (setf tsc--complex (not tsc--complex)) 353 | (message (propertize (concat "Complexity set to: " 354 | (if tsc--complex "true" "false")) 355 | 'face 'success))) 356 | 357 | (transient-define-prefix tsc-complex-messager () 358 | "Prefix that sends complex messages, unles `tsc--complex' is nil." 359 | ["Send Complex Messages" 360 | ("s" "snow people" 361 | (lambda () (interactive) 362 | (message (propertize "snow people! ☃" 'face 'success)))) 363 | ("k" "kitty cats" 364 | (lambda () (interactive) 365 | (message (propertize "🐈 kitty cats! 🐈" 'face 'success)))) 366 | ("r" "radiations" 367 | (lambda () (interactive) 368 | (message (propertize "Oh no! radiation! ☢" 'face 'error))) 369 | ;; radiation is dangerous! 370 | :transient transient--do-exit)] 371 | 372 | (interactive) 373 | ;; The command body either sets up the transient or simply returns 374 | ;; This is the "early return" we're talking about. 375 | (if tsc--complex 376 | (transient-setup 'tsc-complex-messager) 377 | (message "Simple and boring!"))) 378 | 379 | (transient-define-prefix tsc-simple-messager () 380 | "Prefix that toggles child behavior!" 381 | [["Send Message" 382 | ;; using `transient--do-recurse' causes suffixes in tsc-child to perform 383 | ;; `transient--do-return' so that we come back to this transient. 384 | ("m" "message" tsc-complex-messager :transient transient--do-recurse)] 385 | ["Toggle Complexity" 386 | ("t" tsc--toggle-complex)]]) 387 | 388 | ;; (tsc-simple-messager) ; toggle complexity on 389 | 390 | ;; Because `tsc--complex' is in a defvar, its behavior persists when called 391 | ;; independently. Because `tsc-simple-messager' is not in the menu stack when 392 | ;; called this way, no return will be performed. 393 | ;; (tsc-complex-messager) 394 | 395 | (transient-define-suffix tsc--suffix-interactive-buffer-name (buffer-name) 396 | "An interactive suffix that obtains a buffer name from the user. 397 | This uses the short interactive code." 398 | (interactive "b") 399 | (message "You selected: %s" buffer-name)) 400 | 401 | (transient-define-suffix tsc--suffix-interactive-string (user-input) 402 | "An interactive suffix that evalutates its arguments exlicitly." 403 | (interactive (list 404 | (read-string "Please just tell me what you want!: "))) 405 | (message "I think you want: %s" user-input)) 406 | 407 | (transient-define-prefix tsc-interactive () 408 | "Prefix with interactive suffixes." 409 | ["Interactive Command Suffixes" 410 | ("s" "enter string" tsc--suffix-interactive-string) 411 | ("b" "select buffer" tsc--suffix-interactive-buffer-name) 412 | ;; using a normal command with a user query in its interactive form 413 | ("f" "find file" find-file)]) 414 | 415 | ;; (tsc-interactive) 416 | 417 | (defvar tsc-creativity-subjective "I Just press buttons on my gen-AI" 418 | "An unverifiable statement about the user's creativity.") 419 | 420 | (defvar tsc-creativity-objective 30 421 | "User's creativity percentile as assesed by our oracle") 422 | 423 | (defun tsc-creativity-subjective-update (creativity) 424 | "Update the users creativity assessment subjectively." 425 | (interactive (list (read-string "User subjective creativity: " 426 | tsc-creativity-subjective))) 427 | (setq tsc-creativity-subjective creativity) 428 | (message "Subjective creativity updated: %s" tsc-creativity-subjective)) 429 | 430 | (defun tsc-creativity-objective-update (creativity) 431 | "Update the users creativity assessment objectively." 432 | (interactive (list (read-number "User objective creativity: " 433 | tsc-creativity-objective))) 434 | (if (and (integerp creativity) (>= 100 creativity -1)) 435 | (progn (setq tsc-creativity-objective creativity) 436 | (message "Objective creativity updated: %d" 437 | tsc-creativity-objective)) 438 | (user-error "Only integers between 0 and 100 allowed"))) 439 | 440 | (defun tsc--creativity-subjective-describe () 441 | "Describe command and display current subjective state." 442 | (format "subjective: %s" (propertize tsc-creativity-subjective 443 | 'face 'transient-value))) 444 | 445 | (defun tsc--creativity-objective-describe () 446 | "Describe command and display current objective state." 447 | (format "objective: %s" 448 | (propertize (number-to-string tsc-creativity-objective) 449 | 'face 'transient-value))) 450 | 451 | ;; When we can't jsut use a symbol for what we want to display, write a function 452 | (defun tsc--creativity-display () 453 | "Returns a formatted assessment of the users value as a human being." 454 | (format "User creativity score of %s self-assesses: %s" 455 | (propertize tsc-creativity-subjective 'face 'transient-value) 456 | (propertize (number-to-string tsc-creativity-objective) 457 | 'face 'transient-value))) 458 | 459 | (transient-define-prefix tsc-defvar-settings () 460 | "A prefix demonstrating file-based ad-hoc persistence." 461 | ;; Note the sharpquote (#') used to distinguish a symbol from just a function 462 | ["Creativity\n" 463 | (:info #'tsc--creativity-display :format " %d") 464 | " " 465 | ("d" tsc-creativity-subjective-update :transient t 466 | :description tsc--creativity-subjective-describe) 467 | ("o" tsc-creativity-objective-update :transient t 468 | :description tsc--creativity-objective-describe)]) 469 | 470 | ;; (tsc-defvar-settings) 471 | 472 | (defvar-local tsc--mode-line-memento nil 473 | "A value we can use to restore the `mode-line-format'.") 474 | 475 | (defun tsc--toggle-mode-line () 476 | "Save and restore the mode line like a pro." 477 | (interactive) 478 | (if (null tsc--mode-line-memento) 479 | (setq tsc--mode-line-memento 480 | (buffer-local-set-state mode-line-format 481 | "Wh000pTY D000PTY D0000!")) 482 | (buffer-local-restore-state tsc--mode-line-memento) 483 | (setq tsc--mode-line-memento nil)) 484 | ;; The mode line won't always redraw if we don't tell the command 485 | ;; loop about what we did. 486 | (force-window-update)) 487 | 488 | (transient-define-prefix tsc-buffer-local () 489 | ["Mode Line Gizmo" 490 | ("m" "toggle modeline" tsc--toggle-mode-line :transient t)]) 491 | 492 | ;; (tsc-buffer-local) 493 | 494 | ;; This just sets the default group for the following defcustom 495 | (defgroup tsc-creativity nil "Creativity" :group 'local) 496 | 497 | ;; This defvar is a bit longer than strictly necessary. Lots of users load 498 | ;; no-littering early in their init to make Elisp programs save files in more 499 | ;; uniform locations. This expression respects no-littering or works without 500 | ;; it. 501 | (defcustom tsc-creativity-file 502 | (if (and (featurep 'no-littering) (require 'no-littering nil t)) 503 | (no-littering-expand-var-file-name "tsc-creativity.el") 504 | (expand-file-name "tsc-creativity.el" user-emacs-directory)) 505 | "Where settings are saved to." 506 | :type 'file) 507 | 508 | (defun tsc-creativity-save () 509 | "Save the current creativity states." 510 | (interactive) 511 | (with-temp-buffer 512 | " *tsc-peristence*" 513 | (pp ; pretty print 514 | ;; Like writing a macro, you just use quasi-quoting to stitch 515 | ;; together the structue you want to be in the output. 516 | `(setq tsc-creativity-subjective ,tsc-creativity-subjective 517 | tsc-creativity-objective ,tsc-creativity-objective) 518 | (current-buffer)) 519 | (write-file tsc-creativity-file) 520 | (message "Transient showcase setting saved!"))) 521 | 522 | (defun tsc-creativity-load () 523 | "Yes, just load what we wrote." 524 | (interactive) 525 | (if (file-exists-p tsc-creativity-file) 526 | (load tsc-creativity-file) 527 | (user-error "No saved settings exist"))) 528 | 529 | (defun tsc-creativity-visit-settings () 530 | "Show us what we wrote." 531 | (interactive) 532 | (if (file-exists-p tsc-creativity-file) 533 | (find-file tsc-creativity-file) 534 | (user-error "No saved settings exist"))) 535 | 536 | (transient-define-prefix tsc-persistent-settings () 537 | "A prefix demonstrating file-based ad-hoc persistence." 538 | :refresh-suffixes t 539 | ;; Note the sharpquote (#') used to distinguish a symbol from just a function in 540 | ;; the :info class. Info can understand a variable or a function as its value. 541 | ["Creativity" 542 | (:info #'tsc--creativity-display :format " %d") 543 | ("d" tsc-creativity-subjective-update :transient t 544 | :description tsc--creativity-subjective-describe) 545 | ("o" tsc-creativity-objective-update :transient t 546 | :description tsc--creativity-objective-describe)] 547 | ["Persistence" 548 | ("s" "save" tsc-creativity-save :transient t) 549 | ("l" "load" tsc-creativity-load :transient t 550 | :inapt-if-not (lambda () (file-exists-p tsc-creativity-file))) 551 | ("v" "visit" tsc-creativity-visit-settings :transient t 552 | :inapt-if-not (lambda () (file-exists-p tsc-creativity-file)))]) 553 | 554 | ;; infix defined with a macro 555 | (transient-define-argument tsc--exclusive-switches () 556 | "This is a specialized infix for only selecting one of several values." 557 | :class 'transient-switches 558 | :argument-format "--%s-snowcone" 559 | :argument-regexp "\\(--\\(grape\\|orange\\|cherry\\|lime\\)-snowcone\\)" 560 | :choices '("grape" "orange" "cherry" "lime")) 561 | 562 | (transient-define-prefix tsc-basic-infixes () 563 | "Prefix that just shows off many typical infix types." 564 | ["Infixes" 565 | 566 | ;; from macro 567 | ("-e" "exclusive switches" tsc--exclusive-switches) 568 | 569 | ;; shorthand definitions 570 | ("-b" "switch with shortarg" ("-w" "--switch-short")) 571 | ;; note :short-arg != :key 572 | 573 | ("-s" "switch" "--switch") 574 | ( "n" "no dash switch" "still works") 575 | ("-a" "argument" "--argument=" :prompt "Let's argue because: ") 576 | 577 | ;; a bit of inline EIEIO in our shorthand 578 | ("-n" "never empty" "--non-null=" :always-read t :allow-empty nil 579 | :init-value (lambda (obj) (oset obj value "better-than-nothing"))) 580 | 581 | ("-c" "choices" "--choice=" :choices (foo bar baz))] 582 | 583 | ["Show Args" 584 | ("s" "show arguments" tsc-suffix-print-args)]) 585 | 586 | ;; (tsc-basic-infixes) 587 | 588 | (defvar tsc--position '(0 0) "A transient prefix location.") 589 | 590 | (transient-define-infix tsc--pos-infix () 591 | "A location, key, or command symbol." 592 | :class 'transient-lisp-variable 593 | :transient t 594 | :prompt "An expression such as (0 0), \"p\", nil, 'tsc--msg-pos: " 595 | :variable 'tsc--position) 596 | 597 | (transient-define-suffix tsc--msg-pos () 598 | "Message the element at location." 599 | :transient 'transient--do-call 600 | (interactive) 601 | ;; lisp variables are not sent in the usual (transient-args) list. 602 | ;; Just read `tsc--position' directly. 603 | (let ((suffix (transient-get-suffix 604 | transient-current-command tsc--position))) 605 | (message "%s" (oref suffix description)))) 606 | 607 | (transient-define-prefix tsc-lisp-variable () 608 | "A prefix that updates and uses a lisp variable." 609 | ["Location Printing" 610 | [("p" "position" tsc--pos-infix)] 611 | [("m" "message" tsc--msg-pos)]]) 612 | 613 | ;; (tsc-lisp-variable) 614 | 615 | (transient-define-suffix tsc--read-prefix-scope () 616 | "Read the scope of the prefix." 617 | :transient 'transient--do-call 618 | (interactive) 619 | (let ((scope (transient-scope))) 620 | (message "scope: %s" scope))) 621 | 622 | (transient-define-suffix tsc--double-scope-re-enter () 623 | "Re-enter the current prefix with double the scope." 624 | ;; :transient 'transient--do-replace ; builds up the stack 625 | :transient 'transient--do-exit 626 | (interactive) 627 | (let ((scope (transient-scope))) 628 | (if (numberp scope) 629 | (transient-setup transient-current-command 630 | nil nil :scope (* scope 2)) 631 | (message 632 | (propertize 633 | (format "scope was non-numeric! %s" scope) 'face 'warning)) 634 | (transient-setup transient-current-command)))) 635 | 636 | (transient-define-suffix tsc--update-scope-with-prefix-re-enter (new-scope) 637 | "Re-enter the prefix with double the scope." 638 | ;; :transient 'transient--do-replace ; builds up the stack 639 | :transient 'transient--do-exit ; do not build up the stack 640 | (interactive "P") 641 | (message "universal arg: %s" new-scope) 642 | (transient-setup transient-current-command nil nil :scope new-scope)) 643 | 644 | (transient-define-prefix tsc-scope (scope) 645 | "Prefix demonstrating use of scope." 646 | 647 | [:description 648 | (lambda () (format "Scope: %s" (transient-scope))) 649 | [("r" "read scope" tsc--read-prefix-scope) 650 | ("d" "double scope" tsc--double-scope-re-enter) 651 | ("o" "update scope (use prefix argument)" 652 | tsc--update-scope-with-prefix-re-enter)]] 653 | (interactive "P") 654 | (transient-setup 'tsc-scope nil nil :scope scope)) 655 | 656 | ;; Setting an interactive argument for `eval-last-sexp' is a 657 | ;; little different 658 | ;; (let ((current-prefix-arg 4)) (call-interactively 'tsc-scope)) 659 | 660 | ;; (tsc-scope) 661 | ;; Then press "C-u 4 o" to update the scope 662 | ;; Then d to double 663 | ;; Then r to read 664 | ;; ... and so on 665 | ;; C-g to exit 666 | 667 | (transient-define-suffix tsc-suffix-eat-snowcone (args) 668 | "Eat the snowcone! 669 | This command can be called from it's parent, `tsc-snowcone-eater' or independently." 670 | :transient t 671 | ;; you can use the interactive form of a command to obtain a default value 672 | ;; from the user etc if the one obtained from the parent is invalid. 673 | (interactive (list (transient-args 'tsc-snowcone-eater))) 674 | 675 | ;; `transient-arg-value' can (with varying success) pick out individual 676 | ;; values from the results of `transient-args'. 677 | 678 | (let ((topping (transient-arg-value "--topping=" args)) 679 | (flavor (transient-arg-value "--flavor=" args))) 680 | (message "I ate a %s flavored snowcone with %s on top!" flavor topping))) 681 | 682 | (transient-define-prefix tsc-snowcone-eater () 683 | "Prefix demonstrating set & save infix persistence." 684 | 685 | ;; This prefix has a default value that tsc-suffix-eat-snowcone can see 686 | ;; even before the prefix has been called. 687 | :value '("--topping=fruit" "--flavor=cherry") 688 | 689 | ;; always-read is used below so that you don't save nil values to history 690 | ["Arguments" 691 | ("-t" "topping" "--topping=" 692 | :choices ("ice cream" "fruit" "whipped cream" "mochi") 693 | :always-read t) 694 | ("-f" "flavor" "--flavor=" 695 | :choices ("grape" "orange" "cherry" "lime") 696 | :always-read t)] 697 | 698 | ;; Definitely check out the =C-x= menu 699 | ["C-x Menu Behaviors" 700 | ("S" "save snowcone settings" 701 | (lambda () (interactive) (message "saved!") (transient-save)) 702 | :transient t) 703 | ("R" "reset snowcone settings" 704 | (lambda () (interactive) (message "reset!") (transient-reset)) 705 | :transient t)] 706 | 707 | ["Actions" 708 | ("m" "message arguments" tsc-suffix-print-args) 709 | ("e" "eat snowcone" tsc-suffix-eat-snowcone)]) 710 | 711 | ;; First call will use the transient's default value 712 | ;; M-x tsc-suffix-eat-snowcone or `eval-last-sexp' below 713 | ;; (call-interactively 'tsc-suffix-eat-snowcone) 714 | ;; (tsc-snowcone-eater) 715 | ;; Eat some snowcones with different flavors 716 | ;; ... 717 | ;; ... 718 | ;; ... 719 | ;; Now save the value and exit the transient. 720 | ;; When you call the suffix independently, it can still read the saved values! 721 | ;; M-x tsc-suffix-eat-snowcone or `eval-last-sexp' below 722 | ;; (call-interactively 'tsc-suffix-eat-snowcone) 723 | 724 | (transient-define-prefix tsc-ping () 725 | "Prefix demonstrating history sharing." 726 | 727 | :history-key 'highly-unique-name 728 | 729 | ["Ping" 730 | ("-g" "game" "--game=") 731 | ("p" "ping the pong" tsc-pong) 732 | ("a" "print args" tsc-suffix-print-args :transient nil)]) 733 | 734 | (transient-define-prefix tsc-pong () 735 | "Prefix demonstrating history sharing." 736 | 737 | :history-key 'highly-unique-name 738 | 739 | ["Pong" 740 | ("-g" "game" "--game=") 741 | ("p" "pong the ping" tsc-ping) 742 | ("a" "print args" tsc-suffix-print-args :transient nil)]) 743 | 744 | ;; (tsc-ping) 745 | ;; Okay here's where it gets weird 746 | ;; 1. Set the value of game to something and remember it 747 | ;; 2. Press a to print the args 748 | ;; 3. Re-open tsc-ping. 749 | ;; 4. C-x p to load the previous history, see the old value? 750 | ;; 5. p to switch to the tsc-pong transient 751 | ;; 6. C-x p to load the previous history, see the old value from tsc-ping??? 752 | ;; 7. Note that tsc-pong uses the same history as tsc-ping! 753 | 754 | (transient-define-prefix tsc-goldfish () 755 | "A prefix that cannot remember anything." 756 | ["Goldfish" 757 | ("-r" "rememeber" "--i-remember=" 758 | :unsavable t ; infix isn't saved 759 | :always-read t ; infix always asks for new value 760 | ;; overriding the method to provide a starting value 761 | :init-value (lambda (obj) (oset obj value "nothing"))) 762 | ("a" "print args" tsc-suffix-print-args :transient nil)]) 763 | 764 | ;; (tsc-goldfish) 765 | 766 | (transient-define-suffix tsc-suffix-remember-and-wave () 767 | "Wave, and force the prefix to set it's saveable infix values." 768 | (interactive) 769 | 770 | ;; (transient-reset) ; forget 771 | (transient-set) ; save for this session 772 | ;; If you combine reset save with reset, you get a reset for future 773 | ;; sessions only. 774 | ;; (transient-save) ; save for this and future sessions 775 | ;; (transient-reset-value some-other-prefix-object) 776 | 777 | (message "Waves at user at: %s. You will never be forgotten." (current-time-string))) 778 | 779 | (transient-define-prefix tsc-elephant () 780 | "A prefix that always remembers its infixes." 781 | ["Elephant" 782 | ("-r" "rememeber" "--i-remember=" 783 | :always-read t) 784 | ("w" "remember and wave" tsc-suffix-remember-and-wave) 785 | ("a" "print args (skips remembering)" tsc-suffix-print-args 786 | :transient nil)]) 787 | 788 | ;; (tsc-elephant) 789 | 790 | (transient-define-prefix tsc-default-values () 791 | "A prefix with a default value." 792 | 793 | :value '("--toggle" "--value=5") 794 | 795 | ["Arguments" 796 | ("t" "toggle" "--toggle") 797 | ("v" "value" "--value=" :prompt "an integer: ")] 798 | 799 | ["Show Args" 800 | ("s" "show arguments" tsc-suffix-print-args)]) 801 | 802 | ;; (tsc-default-values) 803 | 804 | (transient-define-prefix tsc-enforcing-inputs () 805 | "A prefix with enforced input type." 806 | 807 | ["Arguments" 808 | ("v" "value" "--value=" :prompt "an integer: " :reader transient-read-number-N+)] 809 | 810 | ["Show Args" 811 | ("s" "show arguments" tsc-suffix-print-args)]) 812 | 813 | ;; (tsc-enforcing-inputs) 814 | 815 | (transient-define-prefix tsc-switches-and-arguments (arg) 816 | "A prefix with switch and argument examples." 817 | [["Arguments" 818 | ("-s" "switch" "--switch") 819 | ("-a" "argument" "--argument=") 820 | ("t" "toggle" "--toggle") 821 | ("v" "value" "--value=")] 822 | 823 | ["More Arguments" 824 | ("-f" "argument with forced class" "--forced-class " 825 | :class transient-option) 826 | ("I" "argument with inline" ("-i" "--inline-shortarg=")) 827 | ("S" "inline shortarg switch" ("-n" "--inline-shortarg-switch"))]] 828 | 829 | ["Commands" 830 | ("w" "wave some" tsc-suffix-wave) 831 | ("s" "show arguments" tsc-suffix-print-args)]) 832 | ;; use to `tsc-suffix-print-args' to analyze the switch values 833 | 834 | ;; (tsc-switches-and-arguments) 835 | 836 | (transient-define-infix tsc--random-init-infix () 837 | "Switch on and off." 838 | :argument "--switch" 839 | :shortarg "-s" ; will be used for :key when key is not set 840 | :description "switch" 841 | :init-value (lambda (obj) 842 | (oset obj value 843 | (eq 0 (random 2))))) ; write t with 50% probability 844 | 845 | (transient-define-prefix tsc-maybe-on () 846 | "A prefix with a randomly intializing switch." 847 | ["Arguments" 848 | (tsc--random-init-infix)] 849 | ["Show Args" 850 | ("s" "show arguments" tsc-suffix-print-args)]) 851 | 852 | ;; (tsc-maybe-on) 853 | ;; (tsc-maybe-on) 854 | ;; ... 855 | ;; Run the command a few times to see the random initialization of 856 | ;; `tsc--random-init-infix' 857 | ;; It will only take more than ten tries for one in a thousand users. 858 | ;; Good luck. 859 | 860 | (transient-define-argument tsc--animals-argument () 861 | "Animal picker." 862 | :argument "--animals=" 863 | ;; :multi-value t 864 | ;; :multi-value t means multiple options can be selected at once, such as: 865 | ;; --animals=fox,otter,kitten etc 866 | :class 'transient-option 867 | :choices '("fox" "kitten" "peregrine" "otter")) 868 | 869 | (transient-define-prefix tsc-animal-choices () 870 | "Prefix demonstrating selecting animals from choices." 871 | ["Arguments" 872 | ("-a" "--animals=" tsc--animals-argument)] 873 | ["Show Args" 874 | ("s" "show arguments" tsc-suffix-print-args)]) 875 | 876 | ;; (tsc-animal-choices) 877 | 878 | (transient-define-argument tsc--snowcone-flavor () 879 | :description "Flavor of snowcone." 880 | :class 'transient-switches 881 | :key "f" 882 | :argument-format "--%s-snowcone" 883 | :argument-regexp "\\(--\\(grape\\|orange\\|cherry\\|lime\\)-snowcone\\)" 884 | :choices '("grape" "orange" "cherry" "lime")) 885 | 886 | (transient-define-prefix tsc-exclusive-switches () 887 | "Prefix demonstrating exclusive switches." 888 | :value '("--orange-snowcone") 889 | 890 | ["Arguments" 891 | (tsc--snowcone-flavor)] 892 | ["Show Args" 893 | ("s" "show arguments" tsc-suffix-print-args)]) 894 | 895 | ;; (tsc-exclusive-switches) 896 | 897 | (transient-define-prefix tsc-incompatible () 898 | "Prefix demonstrating incompatible switches." 899 | ;; update your transient version if you experience #129 / #155 900 | :incompatible '(("--switch" "--value=") 901 | ("--switch" "--toggle" "--flip") 902 | ("--argument=" "--value=" "--special-arg=")) 903 | 904 | ["Arguments" 905 | ("-s" "switch" "--switch") 906 | ("-t" "toggle" "--toggle") 907 | ("-f" "flip" "--flip") 908 | 909 | ("-a" "argument" "--argument=") 910 | ("v" "value" "--value=") 911 | ("C-a" "special arg" "--special-arg=")] 912 | 913 | ["Show Args" 914 | ("s" "show arguments" tsc-suffix-print-args)]) 915 | 916 | ;; (tsc-incompatible) 917 | 918 | (defun tsc--animal-choices (_complete-me _predicate flag) 919 | "Programmed completion for animal choice. 920 | _COMPLETE-ME: whatever the user has typed so far 921 | _PREDICATE: function you should use to filter candidates (only nil seen so far) 922 | FLAG: request for metadata (which can be disrespected)" 923 | 924 | ;; if you want to respect metadata requests, here's what the form might 925 | ;; look like, but no behavior was observed. 926 | (if (eq flag 'metadata) 927 | '(metadata . '((annotation-function . (lambda (c) "an annotation")))) 928 | 929 | ;; when not handling a metadata request from completions, use some 930 | ;; logic to generate the choices, possibly based on input or some time 931 | ;; / context sensitive process. FLAG will be `t' when these are 932 | ;; reqeusted. 933 | (if (eq 0 (random 2)) 934 | '("fox" "kitten" "otter") 935 | '("ant" "peregrine" "zebra")))) 936 | 937 | (transient-define-prefix tsc-choices-with-completions () 938 | "Prefix with completions for choices." 939 | ["Arguments" 940 | ("-a" "Animal" "--animal=" 941 | :always-read t ; don't allow unsetting, just read a new value 942 | :choices tsc--animal-choices)] 943 | ["Show Args" 944 | ("s" "show arguments" tsc-suffix-print-args)]) 945 | 946 | ;; (tsc-choices-with-completions) 947 | 948 | (defun tsc--quit-cowsay () 949 | "Kill the cowsay buffer and exit." 950 | (interactive) 951 | (kill-buffer "*cowsay*")) 952 | 953 | (defun tsc--cowsay-buffer-exists-p () 954 | "Visibility predicate." 955 | (not (equal (get-buffer "*cowsay*") nil))) 956 | 957 | (transient-define-suffix tsc--cowsay-clear-buffer (&optional buffer) 958 | "Delete the *cowsay* buffer. Optional BUFFER name." 959 | :transient 'transient--do-call 960 | :if 'tsc--cowsay-buffer-exists-p 961 | (interactive) ; todo look at "b" interactive code 962 | 963 | (save-excursion 964 | (let ((buffer (or buffer "*cowsay*"))) 965 | (set-buffer buffer) 966 | (delete-region 1 (+ 1 (buffer-size)))))) 967 | 968 | (transient-define-suffix tsc--cowsay (&optional args) 969 | "Run cowsay." 970 | (interactive (list (transient-args transient-current-command))) 971 | (let* ((buffer "*cowsay*") 972 | ;; TODO ugly 973 | (cowmsg (if args (transient-arg-value "--message=" args) nil)) 974 | (cowmsg (if cowmsg (list cowmsg) nil)) 975 | (args (if args 976 | (seq-filter 977 | (lambda (s) (not (string-prefix-p "--message=" s))) args) 978 | nil)) 979 | (args (if args 980 | (if cowmsg 981 | (append args cowmsg) 982 | args) 983 | cowmsg))) 984 | 985 | (when (tsc--cowsay-buffer-exists-p) 986 | (tsc--cowsay-clear-buffer)) 987 | (apply #'call-process "cowsay" nil buffer nil args) 988 | (switch-to-buffer buffer))) 989 | 990 | (transient-define-prefix tsc-cowsay () 991 | "Say things with animals!" 992 | ;; only one kind of eyes is meaningful at a time 993 | :incompatible '(("-b" "-g" "-p" "-s" "-t" "-w" "-y")) 994 | 995 | ["Message" 996 | ("m" "message" "--message=" :always-read t)] 997 | ;; always-read, so clear by entering empty string 998 | [["Built-in Eyes" 999 | ("b" "borg" "-b") 1000 | ("g" "greedy" "-g") 1001 | ("p" "paranoid" "-p") 1002 | ("s" "stoned" "-s") 1003 | ("t" "tired" "-t") 1004 | ("w" "wired" "-w") 1005 | ("y" "youthful" "-y")] 1006 | ["Actions" 1007 | ("c" "cowsay" tsc--cowsay :transient transient--do-call) 1008 | "" 1009 | ("d" "delete buffer" tsc--cowsay-clear-buffer) 1010 | ("q" "quit" tsc--quit-cowsay)]]) 1011 | 1012 | ;; (tsc-cowsay) 1013 | 1014 | (transient-define-prefix tsc-visibility-predicates () 1015 | "Prefix with visibility predicates. 1016 | Try opening this prefix in buffers with modes deriving from different 1017 | abstract major modes." 1018 | ["Empty Groups Not Displayed" 1019 | ;; in org mode for example, this group doesn't appear. 1020 | ("we" "wave elisp" tsc-suffix-wave :if-mode emacs-lisp-mode) 1021 | ("wc" "wave in C" tsc-suffix-wave :if-mode cc-mode)] 1022 | 1023 | ["Lists of Modes" 1024 | ("wm" "wave multiply" tsc-suffix-wave :if-mode (dired-mode gnus-mode))] 1025 | 1026 | [["Function Predicates" 1027 | ;; note, after toggling, the transient needs to be re-displayed for the 1028 | ;; predicate to take effect 1029 | ("tb" "toggle busy" tsc--toggle-busy :transient t) 1030 | ("bw" "wave busily" tsc-suffix-wave :if tsc--busy-p)] 1031 | 1032 | ["Programming Actions" 1033 | :if-derived prog-mode 1034 | ("pw" "wave programishly" tsc-suffix-wave) 1035 | ("pe" "wave in elisp" tsc-suffix-wave :if emacs-lisp-mode)] 1036 | ["Special Mode Actions" 1037 | :if-derived special-mode 1038 | ("sw" "wave specially" tsc-suffix-wave) 1039 | ("sd" "wave dired" tsc-suffix-wave :if-mode dired-mode)] 1040 | ["Text Mode Actions" 1041 | :if-derived text-mode 1042 | ("tw" "wave textually" tsc-suffix-wave) 1043 | ("to" "wave org-modeishly" tsc-suffix-wave :if-mode org-mode)]]) 1044 | 1045 | ;; (tsc-visibility-predicates) 1046 | 1047 | (defun tsc--switch-on-p () 1048 | (transient-arg-value 1049 | "--switch" 1050 | (transient-args transient-current-command))) 1051 | 1052 | (transient-define-prefix tsc-inapt () 1053 | "Prefix that configures child with inapt predicates." 1054 | :refresh-suffixes t ; important for updating inapt! (1) 1055 | ["Options" 1056 | ("-s" "switch" "--switch" 1057 | ;; we want to see the most recent value in `transient-args' (2) 1058 | :transient transient--do-call)] 1059 | 1060 | ["Appropriate Suffixes" 1061 | ("s" "switched" tsc--wave-switchedly 1062 | :transient t 1063 | :inapt-if-not tsc--switch-on-p) 1064 | ("u" "unswitched" tsc--wave-unswitchedly 1065 | :transient t 1066 | :inapt-if tsc--switch-on-p)] 1067 | 1068 | ["Appropiate Group" 1069 | :inapt-if-not tsc--switch-on-p 1070 | ("q" "query" tsc--wave-inquisitively) 1071 | ("w" "write" tsc--wave-writingly)]) 1072 | 1073 | ;; (tsc-inapt) 1074 | 1075 | (transient-define-prefix tsc-levels-and-visibility () 1076 | "Prefix with visibility levels for hiding rarely used commands." 1077 | 1078 | [["Setting the Current Level" 1079 | ;; this binding is normally not displayed. The value of 1080 | ;; `transient-show-common-commands' controls this by default. 1081 | ("C-x l" "set level" transient-set-level) 1082 | ("s" "show level" tsc-suffix-show-level)] 1083 | 1084 | [2 "Per Group" ;; 1 is the default default-child-level 1085 | ("ws" "wave surely" tsc--wave-surely) 1086 | (3"wn" "wave normally" tsc--wave-normally) 1087 | (5"wb" "wave non-essentially" tsc--wave-non-essentially)] 1088 | 1089 | [3 "Per Group Somewhat Useful" 1090 | ("wd" "wave definitely" tsc--wave-definitely)] 1091 | 1092 | [6 "Groups hide visible children" 1093 | (1 "wh" "wave hidden" tsc--wave-hidden)] 1094 | 1095 | [5 "Per Group Rarely Useful" 1096 | ("we" "wave eventually" tsc--wave-eventually)]]) 1097 | 1098 | ;; (tsc-levels-and-visibility) 1099 | 1100 | (transient-define-prefix tsc-generated-child () 1101 | "Prefix that uses `setup-children' to generate single child." 1102 | 1103 | ["Replace this child" 1104 | ;; Let's override the group's method 1105 | :setup-children 1106 | (lambda (_) ; we don't care about the stupid suffix 1107 | 1108 | ;; remember to return a list 1109 | (list (transient-parse-suffix 1110 | 'transient--prefix 1111 | '("r" "replacement" (lambda () 1112 | (interactive) 1113 | (message "okay!")))))) 1114 | 1115 | ;; This child will not be visible when you run the example because it is 1116 | ;; replaced dynamically when the transient is set up 1117 | ("s" "haha stupid suffix" (lambda () 1118 | (interactive) 1119 | (message "You should replace me!")))]) 1120 | 1121 | ;; (tsc-generated-child) 1122 | 1123 | (transient-define-prefix tsc-generated-group () 1124 | "Prefix that uses `setup-children' to generate a group." 1125 | 1126 | ["Replace this child" 1127 | ;; Let's override the group's method 1128 | :setup-children 1129 | (lambda (_) ; we don't care about the stupid suffix 1130 | 1131 | ;; the result of parsing here will be a group 1132 | (transient-parse-suffixes 1133 | 'transient--prefix 1134 | ["Group Name" ("r" "replacement" (lambda () 1135 | (interactive) 1136 | (message "okay!")))])) 1137 | 1138 | ;; This child will not be visible when you run the example because it is 1139 | ;; replaced dynamically when the transient is set up 1140 | ("s" "haha stupid suffix" (lambda () 1141 | (interactive) 1142 | (message "You should replace me!")))]) 1143 | 1144 | ;; (tsc-generated-group) 1145 | 1146 | (defun tsc--self-modifying-add-command (command-symbol sequence) 1147 | (interactive "CSelect a command: \nMkey sequence: ") 1148 | 1149 | ;; Generate an infix that will call the command and add it to the 1150 | ;; second group (index 1 at the 0th position) 1151 | (transient-insert-suffix 1152 | 'tsc-self-modifying 1153 | '(0 1 0) ; set the child in `tsc-inception' for help with this argument 1154 | (list sequence (format "Call %s" command-symbol) command-symbol :transient t)) 1155 | 1156 | ;; we must re-enter the transient to force the layout update 1157 | (transient-setup 'tsc-self-modifying)) 1158 | 1159 | (transient-define-prefix tsc-self-modifying () 1160 | "Prefix that uses `transient-insert-suffix' to add commands to itself." 1161 | 1162 | [["Add New Commands" 1163 | ("a" "add command" tsc--self-modifying-add-command)] 1164 | ["User Defined" 1165 | ""]]) ; blank line suffix creates an insertion point 1166 | 1167 | ;; (tsc-self-modifying) 1168 | 1169 | ;; The children we will be picking can be of several forms. The 1170 | ;; transient--layout symbol property of a prefix is a vector of vectors, 1171 | ;; lists, and strings. It's not the actual eieio types or we would use 1172 | ;; `transient-format-description' to just ask them for the descriptions. 1173 | (defun tsc--layout-child-desc (layout-child) 1174 | "Get the description from LAYOUT-CHILD. 1175 | LAYOUT-CHILD is a transient layout vector or list." 1176 | (let ((description 1177 | (cond 1178 | ((vectorp layout-child) 1179 | (or (plist-get (aref layout-child 2) :description) 1180 | "")) ; group 1181 | ((stringp layout-child) layout-child) ; plain-text child 1182 | ((listp layout-child) 1183 | (plist-get (elt layout-child 2) :description)) ; suffix 1184 | (t 1185 | (message 1186 | (propertize "You traversed into a child's list elements!" 1187 | 'face 'warning)) 1188 | (format "(child's interior) element: %s" layout-child))))) 1189 | (cond 1190 | ;; The description is sometimes a callable function with no arguments, 1191 | ;; so let's call it in that case. Note, the description may be 1192 | ;; designed for one point in the transient's lifecycle but we could 1193 | ;; call it in a different one, causing its behavior to change. 1194 | ((functionp description) (apply description)) 1195 | (t description)))) 1196 | 1197 | ;; We repeat the read using a lisp expression from `read-from-minibuffer' to 1198 | ;; get the LOC key for `transient-get-suffix' until we get a valid result. 1199 | ;; This ensures we don't store an invalid LOC. 1200 | (defun tsc-child-infix--reader (prompt initial-input history) 1201 | "Read a location and check that it exists within the current transient. 1202 | PROMPT, INITIAL-INPUT, and HISTORY are forwarded to `read-from-minibuffer'." 1203 | (let ((command (oref transient--prefix command)) 1204 | (success nil)) 1205 | (while (not success) 1206 | (let* ((loc (read (read-from-minibuffer 1207 | prompt initial-input nil nil history))) 1208 | (child (ignore-errors (transient-get-suffix command loc)))) 1209 | (if child (setq success loc) 1210 | (message (propertize 1211 | (format 1212 | "Location could not be found in prefix %s" 1213 | command) 1214 | 'face 'error)) 1215 | (sit-for 3)))) 1216 | success)) 1217 | 1218 | ;; Inherit from variable abstract class 1219 | (defclass tsc-child-infix (transient-variable) 1220 | ((value-object :initarg value-object :initform nil) 1221 | ;; this is a new slot for storing the hydrated value. we re-use the 1222 | ;; value infrastructure for storing the serialization-friendly value, 1223 | ;; which is basically a suffix addres or id. 1224 | 1225 | (reader :initform #'tsc-child-infix--reader) 1226 | (prompt :initform 1227 | "Location, a key \"c\",\ suffix-command-symbol like\ tsc--wave-normally or coordinates like (0 2 0): "))) 1228 | 1229 | ;; We have to define this on non-abstract infix classes. See 1230 | ;; `transient-init-value' in transient source. The method on 1231 | ;; `transient-argument' class was used to make this example, but it 1232 | ;; does support a lot of behaviors. In short, the prefix has a value 1233 | ;; and you rehydrate the infix by looking into the prefix's value to 1234 | ;; find the suffix value. Because our stored value is basically a 1235 | ;; serialization, we rehydrate it to be sure it's a valid value. 1236 | ;; Remember to handle values you can't rehydrate. 1237 | (cl-defmethod transient-init-value ((obj tsc-child-infix)) 1238 | "Set the `value' and `value-object' slots using the prefix's value." 1239 | 1240 | ;; in the prefix declaration, the initial description is a reliable key 1241 | (let ((variable (oref obj description))) 1242 | (oset obj variable variable) 1243 | 1244 | ;; rehydrate the value if the prefix has one for this infix 1245 | (when-let* ((prefix-value (oref transient--prefix value)) 1246 | ;; (argument (and (slot-boundp obj 'argument) 1247 | ;; (oref obj argument))) 1248 | (value (cdr (assoc variable prefix-value))) 1249 | ;; rehydrate 1250 | (value-object (transient-get-suffix 1251 | (oref transient--prefix command) value))) 1252 | (oset obj value value) 1253 | (oset obj value-object value-object)))) 1254 | 1255 | (cl-defmethod transient-infix-set ((obj tsc-child-infix) value) 1256 | "Update `value' slot to VALUE. 1257 | Update `value-object' slot to the value corresponding to VALUE." 1258 | (let* ((command (oref transient--prefix command)) 1259 | (child (ignore-errors (transient-get-suffix command value)))) 1260 | (oset obj value-object child) 1261 | (oset obj value (if child value nil)))) ; TODO a bit ugly 1262 | 1263 | ;; If you are making a suffix that needs history, you need to define 1264 | ;; this method. The example here almost identical to the method 1265 | ;; defined for `transient-option', 1266 | (cl-defmethod transient-infix-value ((obj tsc-child-infix)) 1267 | "Return our actual value for rehydration later." 1268 | 1269 | ;; Note, returning a cons for the value is very flexible and will 1270 | ;; work with homoiconicity in persistence. 1271 | (cons (oref obj variable) (oref obj value))) 1272 | 1273 | ;; Show user's a useful representation of your ugly value 1274 | (cl-defmethod transient-format-value ((obj tsc-child-infix)) 1275 | "All transient children have some description we can display. 1276 | Show either the child's description or a default if no child is selected." 1277 | (if-let* ((value (and (slot-boundp obj 'value) (oref obj value))) 1278 | (value-object (and (slot-boundp obj 'value-object) 1279 | (oref obj value-object)))) 1280 | (propertize 1281 | (format "(%s)" (tsc--layout-child-desc value-object)) 1282 | 'face 'transient-value) 1283 | (propertize "¯\\_(ツ)_/¯" 'face 'transient-inactive-value))) 1284 | 1285 | ;; Now that we have our class defined, we can create an infix the usual 1286 | ;; way, just specifying our class 1287 | (transient-define-infix tsc--inception-child-infix () 1288 | :class tsc-child-infix) 1289 | 1290 | ;; All set! This transient just tests our or new toy. 1291 | (transient-define-prefix tsc-inception () 1292 | "Prefix that picks a suffix from its own layout." 1293 | 1294 | [["Pick a suffix" 1295 | ("-s" "just a switch" "--switch") ; makes history value structure apparent 1296 | ("c" "child" tsc--inception-child-infix)] 1297 | 1298 | ["Some suffixes" 1299 | ("s" "wave surely" tsc--wave-surely) 1300 | ("d" "wave definitely" tsc--wave-definitely) 1301 | ("e" "wave eventually" tsc--wave-eventually) 1302 | ("C" "call & exit normally" tsc--wave-normally :transient nil)] 1303 | 1304 | ["Read variables" 1305 | ("r" "read args" tsc-suffix-print-args )]]) 1306 | 1307 | ;; (tsc-inception) 1308 | ;; 1309 | ;; Try setting the infix to "e" (yes, include quotes) 1310 | ;; Try: (1 2) 1311 | ;; Try: tsc--wave-normally 1312 | ;; 1313 | ;; Observe that the LOC you enter is displayed using the description at that 1314 | ;; point 1315 | ;; 1316 | ;; Set the infix and re-open it with C-x s, C-g, and M-x tsc-inception 1317 | ;; Observe that the set value persists across invocations 1318 | ;; 1319 | ;; Save the infix, with C-x C-s, re-evaluate the prefix, and open the 1320 | ;; prefix again. 1321 | ;; 1322 | ;; Try flipping through history, C-x n, C-x p 1323 | ;; Now do think of doing things like this with org ids, magit-sections, 1324 | ;; buffers etc. 1325 | 1326 | (transient-define-suffix tsc--inception-update-description () 1327 | "Update the description of of the selected child." 1328 | (interactive) 1329 | (let* ((args (transient-args transient-current-command)) 1330 | (description (transient-arg-value "--description=" args)) 1331 | ;; This is the part where we read the other infix. It's 1332 | ;; similar to how we find the value during rehydration, but 1333 | ;; hard-coding the infix's argument, "child", which is used 1334 | ;; in its `transient-infix-value' method. 1335 | (loc (cdr (assoc "child" args))) 1336 | (layout-child (transient-get-suffix 'tsc-inception-update loc))) 1337 | 1338 | ;; Once again, do different bodies based on what we found at the 1339 | ;; layout locition. This complexity is beacuse of the data we 1340 | ;; are operating on, not the transient methods we needed to 1341 | ;; implement. 1342 | (cond 1343 | ((or (listp layout-child) ; child 1344 | (vectorp layout-child) ; group 1345 | (stringp layout-child)) ; string child 1346 | (if (stringp layout-child) ; plain-text child 1347 | (transient-replace-suffix 'tsc-inception-update loc description) 1348 | 1349 | (plist-put (elt layout-child 2) :description description))) 1350 | (t (message 1351 | (propertize 1352 | (format "Don't know how to modify whatever is at: %s" loc) 1353 | 'face 'warning)))) 1354 | 1355 | ;; re-enter the transient manually to display the modified layout 1356 | (transient-setup transient-current-command))) 1357 | 1358 | (transient-define-prefix tsc-inception-update () 1359 | "Prefix that picks and updates its own suffix." 1360 | 1361 | [["Pick a suffix" 1362 | ("c" "child" tsc--inception-child-infix :argument "child")] 1363 | 1364 | ["Update the description!" 1365 | ("-d" "description" "--description=") 1366 | ("u" "update" tsc--inception-update-description 1367 | :transient transient--do-exit)] 1368 | 1369 | ["Some suffixes" 1370 | ("s" "wave surely" tsc--wave-surely) 1371 | ("d" "wave definitely" tsc--wave-definitely) 1372 | ("e" "wave eventually" tsc--wave-eventually) 1373 | ("C" "call & exit normally" tsc--wave-normally :transient nil)] 1374 | 1375 | ["Read variables" 1376 | ("r" "read args" tsc-suffix-print-args )]]) 1377 | 1378 | ;; (tsc-inception-update) 1379 | ;; 1380 | ;; 1. Press 'c' to start picking a suffix. For example, enter the string "e" 1381 | ;; 2. Press 'C-x s' to set the values of this transient for the future 1382 | ;; 3. Then set the description, anything, no quotes 1383 | ;; 4. Then press 'u' the suffix's you picked with the new description! 1384 | ;; 1385 | ;; Using a transient to modify a transient (⊃。•́‿•̀。)⊃━✿✿✿✿✿✿ 1386 | ;; 1387 | ;; Observe that the set values are persisted across invocations. 1388 | ;; Saving also works. This makes it easier to set the description 1389 | ;; multiple times in succession. The Payoff when building larger 1390 | ;; applications like magit rapidly adds up. 1391 | 1392 | (transient-define-prefix tsc-showcase () 1393 | "A launcher for a currated selection of examples. 1394 | While most of the prefixes have their :transient slot set to t, it's not 1395 | possible to return from all of them, especially if they demonstrate flow 1396 | control such as replacing or exiting." 1397 | 1398 | [["Layouts" 1399 | ("ls" "stacked" tsc-layout-stacked :transient t) 1400 | ("lc" "columns" tsc-layout-columns :transient t) 1401 | ("lt" "stacked columns" tsc-layout-stacked-columns :transient t) 1402 | ("lg" "grid" tsc-layout-the-grid :transient t) 1403 | ("lp" "spaced out" tsc-layout-spaced-out :transient t) 1404 | ("le" "explicit class" tsc-layout-explicit-classes :transient t) 1405 | ("ld" "descriptions" tsc-layout-descriptions :transient t) 1406 | ;; padded description to sc 1407 | ("lD" "dynamic descriptions " 1408 | tsc-layout-dynamic-descriptions :transient t)] 1409 | 1410 | ["Nesting & Flow Control" 1411 | ("fs" "stay transient" tsc-stay-transient :transient t) 1412 | ("fb" "binding sub-prefix" tsc-simple-parent :transient t) 1413 | ("fr" "sub-prefix with return" tsc-simple-parent-with-return :transient t) 1414 | ("fm" "manual setup in suffix" tsc-parent-with-setup-suffix :transient t) 1415 | ("fi" "mixing interactive" tsc-interactive :transient t) 1416 | ("fe" "early return" tsc-simple-messager :transient t)]] 1417 | 1418 | ["State Management" 1419 | ["Transient State & Peristence" 1420 | ("sb" "a bunch of infixes" tsc-basic-infixes :transient t) 1421 | ("sc" "using scope (accepts prefix arg)" tsc-scope :transient t) 1422 | ("sn" "set & save / snowcones" tsc-snowcone-eater :transient t) 1423 | ("sp" "history key / ping-pong" tsc-ping :transient t) 1424 | ("sg" "always forget / goldfish" tsc-goldfish :transient t) 1425 | ("se" "always remember / elephant" tsc-elephant :transient t) 1426 | ("sd" "default values" tsc-default-values :transient t) 1427 | ("sf" "enforcing inputs" tsc-enforcing-inputs :transient t) 1428 | ("sl" "lisp variables" tsc-lisp-variable :transient t)] 1429 | ["CLI arguments" 1430 | ("cb" "basic arguments" tsc-switches-and-arguments :transient t) 1431 | ("cm" "random-init infix" tsc-maybe-on :transient t) 1432 | ("cc" "basic choices" tsc-animal-choices :transient t) 1433 | ("ce" "exclusive switches" tsc-exclusive-switches :transient t) 1434 | ("ci" "incompatible switches" tsc-incompatible :transient t) 1435 | ("co" "completions for choices" tsc-choices-with-completions :transient t) 1436 | ("cc" "cowsay cli wrapper" tsc-cowsay :transient t)] 1437 | ["Ad-Hoc Vanilla Elisp" ; padded right in layouts 1438 | ("ev" "display & update defvar" tsc-defvar-settings) 1439 | ("el" "buffer local values" tsc-buffer-local) 1440 | ("ef" "file based persistence" tsc-persistent-settings)]] 1441 | 1442 | [["Visibility" 1443 | ;; padded description to sc 1444 | ("vp" "predicates " 1445 | tsc-visibility-predicates :transient t) 1446 | ("vi" "inapt (not suitable)" tsc-inapt :transient t) 1447 | ("vl" "levels" tsc-levels-and-visibility :transient t)] 1448 | 1449 | ["Advanced" 1450 | ("ac" "generated child" tsc-generated-child :transient t) 1451 | ("ag" "generated group" tsc-generated-group :transient t) 1452 | ("as" "self-modifying" tsc-self-modifying :transient t) 1453 | ("ai" "custom infixes" tsc-inception :transient t) 1454 | ("au" "custom infixes & update" tsc-inception-update :transient t)]]) 1455 | 1456 | (provide 'transient-showcase) 1457 | ;;; transient-showcase.el ends here 1458 | --------------------------------------------------------------------------------