From 948e1e722bbc4315a947d4924216a841df67e3e9 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 21 May 2025 14:59:14 +0200 Subject: [PATCH] update tp --- .../tp-autoloads.el | 0 .../tp-pkg.el | 6 +++--- .../tp.el | 21 ++++++++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) rename elpa/{tp-20241031.729 => tp-20250206.812}/tp-autoloads.el (100%) rename elpa/{tp-20241031.729 => tp-20250206.812}/tp-pkg.el (75%) rename elpa/{tp-20241031.729 => tp-20250206.812}/tp.el (96%) diff --git a/elpa/tp-20241031.729/tp-autoloads.el b/elpa/tp-20250206.812/tp-autoloads.el similarity index 100% rename from elpa/tp-20241031.729/tp-autoloads.el rename to elpa/tp-20250206.812/tp-autoloads.el diff --git a/elpa/tp-20241031.729/tp-pkg.el b/elpa/tp-20250206.812/tp-pkg.el similarity index 75% rename from elpa/tp-20241031.729/tp-pkg.el rename to elpa/tp-20250206.812/tp-pkg.el index 705a81f0..ac5dc18d 100644 --- a/elpa/tp-20241031.729/tp-pkg.el +++ b/elpa/tp-20250206.812/tp-pkg.el @@ -1,11 +1,11 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "tp" "20241031.729" +(define-package "tp" "20250206.812" "Utilities for transient menus that POST to an API." '((emacs "28.1") (transient "0.5.0")) :url "https://codeberg.org/martianh/tp.el" - :commit "df6490d86f24fff22f5ea4f7d887fc60caed1163" - :revdesc "df6490d86f24" + :commit "cce2dfe0ec2b5c070cb13a7bdf95695eeb6e3caf" + :revdesc "cce2dfe0ec2b" :keywords '("convenience" "api" "requests") :authors '(("Marty Hiatt" . "mousebot@disroot.org")) :maintainers '(("Marty Hiatt" . "mousebot@disroot.org"))) diff --git a/elpa/tp-20241031.729/tp.el b/elpa/tp-20250206.812/tp.el similarity index 96% rename from elpa/tp-20241031.729/tp.el rename to elpa/tp-20250206.812/tp.el index 9fcc52b1..ec275223 100644 --- a/elpa/tp-20241031.729/tp.el +++ b/elpa/tp-20250206.812/tp.el @@ -2,8 +2,8 @@ ;; Author: Marty Hiatt ;; Copyright (C) 2024 Marty Hiatt -;; Package-Version: 20241031.729 -;; Package-Revision: df6490d86f24 +;; Package-Version: 20250206.812 +;; Package-Revision: cce2dfe0ec2b ;; Package-Requires: ((emacs "28.1") (transient "0.5.0")) ;; Keywords: convenience, api, requests ;; URL: https://codeberg.org/martianh/tp.el @@ -252,6 +252,12 @@ We implement this as an option because we need to be able to explicitly send true/false values to the server, whereas transient ignores false/nil values.") +(defclass tp-cycle (tp-bool) + () + "A class to cycle through options. +Like `tp-bool', but supports arbitrary multiple options. +Values to send will not be JSON booleans, but plain strings.") + ;;; TRANSIENT METHODS ;; for `tp-bool' we define our own infix option that displays ;; [true|false] like exclusive switches. activating the infix @@ -339,9 +345,18 @@ The value currently on the server should be underlined." (car choices) (cadr (member val choices))))) ;; return JSON bool: - ;; FIXME: breaks using `tp-bool' for cycling other items! (car (rassoc str tp-json-bool-alist)))) +(cl-defmethod transient-infix-read ((obj tp-cycle)) + "Cycle through the possible values of OBJ." + (let* ((cons (transient-infix-value obj)) + (val (cdr cons)) + (choices (tp--get-choices obj))) + (if (or (not val) ;; handle nil value + (equal val (car (last choices)))) + (car choices) + (cadr (member val choices))))) + ;; FIXME: see the `transient-infix-read' method's docstring: ;; we should preserve history, follow it. maybe just mod it. (cl-defmethod transient-infix-read ((obj tp-option-str)) -- 2.47.3