diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2025-10-05 21:43:30 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2025-10-05 21:43:30 +0200 |
| commit | 6ed97c26add376e3d00d363ab12ece93f0835ef0 (patch) | |
| tree | dae6f651cdcdd805e2eb38a26f64ab64cd10ce4c | |
| parent | c9aa876b4cc679b19c736acc5951f6e640bcbbf2 (diff) | |
Revert "Generate command's docstring based on class's docstring slot"
This reverts commit c9aa876b4cc679b19c736acc5951f6e640bcbbf2.
The planned `magit-section-jumper' class, for which this was added,
did not pan out.
| -rw-r--r-- | lisp/transient.el | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/lisp/transient.el b/lisp/transient.el index 7b1ea53..2fcc4b7 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -794,8 +794,7 @@ If `transient-save-history' is nil, then do nothing." ;;;; Prefix (defclass transient-prefix () - ((docstring :allocation :class :initform nil) - (prototype :initarg :prototype) + ((prototype :initarg :prototype) (command :initarg :command) (level :initarg :level) (init-value :initarg :init-value) @@ -929,7 +928,6 @@ predicate slots or more than one `inapt-if*' slots are non-nil." (defclass transient-suffix (transient-child) ((definition :allocation :class :initform nil) - (docstring :allocation :class :initform nil) (key :initarg :key) (command :initarg :command) (transient :initarg :transient) @@ -1302,39 +1300,21 @@ commands are aliases for." (delq int declare)) (unless (cdr declare) (setq declare nil))) - (when (eq (car-safe class) 'quote) - (setq class (cadr class))) - (setq keys (nreverse keys)) - (when (and (not docstr) class) - (setq docstr (transient--generate-docstring class keys))) (cond ((not args)) (nobody (error "%s: No function body allowed" form)) ((not (eq (car-safe (nth (if declare 1 0) args)) 'interactive)) (error "%s: Interactive form missing" form))) - (list class - keys + (list (if (eq (car-safe class) 'quote) + (cadr class) + class) + (nreverse keys) (nreverse suffixes) docstr (if declare (cons declare args) args) interactive-only)))) -(eval-and-compile ;transient--generate-docstring - (defun transient--generate-docstring (class args) - (and-let* ((class (cl--find-class class)) - (docstr (oref-default class docstring))) - (if (functionp docstr) - (funcall docstr args) - (replace-regexp-in-string - "\\({:[^}]+}\\)" - (lambda (s) - (let ((v (plist-get args (intern (substring s 1 -1))))) - (when (eq (car-safe v) 'quote) - (setq v (cadr v))) - (format "%s" v))) - docstr t t 1))))) - (defun transient--parse-child (prefix spec) (cl-typecase spec (null (error "Invalid transient--parse-child spec: %s" spec)) |
