[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient d1caef5192 198/366: Add new `init-value' infi
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient d1caef5192 198/366: Add new `init-value' infix slot |
Date: |
Tue, 25 Jan 2022 18:54:40 -0500 (EST) |
branch: externals/transient
commit d1caef51923fd53d2cea2f3e2f1f5d61eaf09ac9
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Add new `init-value' infix slot
If this value bound then it is called with the object as only
argument instead of the primary `transient-init-value' method
of the object class.
Re #96.
---
docs/transient.org | 9 +++++++--
docs/transient.texi | 11 +++++++++--
lisp/transient.el | 8 ++++++++
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/docs/transient.org b/docs/transient.org
index d7736b5bd0..bfbed9ab59 100644
--- a/docs/transient.org
+++ b/docs/transient.org
@@ -8,7 +8,7 @@
#+TEXINFO_DIR_CATEGORY: Emacs
#+TEXINFO_DIR_TITLE: Transient: (transient).
#+TEXINFO_DIR_DESC: Transient Commands
-#+SUBTITLE: for version 0.2.0 (v0.2.0-45-g313eee0f+1)
+#+SUBTITLE: for version 0.2.0 (v0.2.0-46-g1b9929ec+1)
#+TEXINFO_DEFFN: t
#+OPTIONS: H:4 num:4 toc:2
@@ -37,7 +37,7 @@ Calling a suffix command usually causes the transient to be
exited
but suffix commands can also be configured to not exit the transient.
#+TEXINFO: @noindent
-This manual is for Transient version 0.2.0 (v0.2.0-45-g313eee0f+1).
+This manual is for Transient version 0.2.0 (v0.2.0-46-g1b9929ec+1).
#+BEGIN_QUOTE
Copyright (C) 2018-2020 Jonas Bernoulli <jonas@bernoul.li>
@@ -1593,6 +1593,11 @@ They are defined here anyway to allow sharing certain
methods.
- ~value~ The value. Should not be accessed directly.
+- ~init-value~ Function that is responsable for setting the object's
+ value. If bound, then this is called with the object as the only
+ argument. Usually this is not bound, in which case the object's
+ primary ~transient-init-value~ method is called instead.
+
- ~unsavable~ Whether the value of the suffix is not saved as part of
the prefixes.
diff --git a/docs/transient.texi b/docs/transient.texi
index b692001b69..6b487f803a 100644
--- a/docs/transient.texi
+++ b/docs/transient.texi
@@ -31,7 +31,7 @@ General Public License for more details.
@finalout
@titlepage
@title Transient User and Developer Manual
-@subtitle for version 0.2.0 (v0.2.0-45-g313eee0f+1)
+@subtitle for version 0.2.0 (v0.2.0-46-g1b9929ec+1)
@author Jonas Bernoulli
@page
@vskip 0pt plus 1filll
@@ -65,7 +65,7 @@ Calling a suffix command usually causes the transient to be
exited
but suffix commands can also be configured to not exit the transient.
@noindent
-This manual is for Transient version 0.2.0 (v0.2.0-45-g313eee0f+1).
+This manual is for Transient version 0.2.0 (v0.2.0-46-g1b9929ec+1).
@quotation
Copyright (C) 2018-2020 Jonas Bernoulli <jonas@@bernoul.li>
@@ -1973,6 +1973,13 @@ They are defined here anyway to allow sharing certain
methods.
@code{value} The value. Should not be accessed directly.
+@item
+@code{init-value} Function that is responsable for setting the object's
+value. If bound, then this is called with the object as the only
+argument. Usually this is not bound, in which case the object's
+primary @code{transient-init-value} method is called instead.
+
+
@item
@code{unsavable} Whether the value of the suffix is not saved as part of
the prefixes.
diff --git a/lisp/transient.el b/lisp/transient.el
index a5959286b3..63dc78f538 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -650,6 +650,7 @@ slot is non-nil."
(argument :initarg :argument)
(shortarg :initarg :shortarg)
(value :initform nil)
+ (init-value :initarg :init-value)
(unsavable :initarg :unsavable :initform nil)
(multi-value :initarg :multi-value :initform nil)
(always-read :initarg :always-read :initform nil)
@@ -2312,6 +2313,13 @@ abstract `transient-infix' class must implement this
function.
Non-infix suffix commands usually don't have a value."
nil)
+(cl-defmethod transient-init-value :around ((obj transient-infix))
+ "If bound, then call OBJ's `init-value' function.
+Otherwise call the primary method according to objects class."
+ (if (slot-boundp obj 'init-value)
+ (funcall (oref obj init-value) obj)
+ (cl-call-next-method obj)))
+
(cl-defmethod transient-init-value ((obj transient-prefix))
(if (slot-boundp obj 'value)
(oref obj value)
- [elpa] externals/transient 35c9d2b541 155/366: Use recommended form of GPLv3 permissions statement, (continued)
- [elpa] externals/transient 35c9d2b541 155/366: Use recommended form of GPLv3 permissions statement, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 88d935c7cb 164/366: transient-display-buffer-action: inhibit-same-window by default, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient c1df3b2121 170/366: Ensure we use symbols in a few more places, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient b768a30199 174/366: transient--suffix-symbol: Verify that optimized path can be used, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 3bfde52f3a 175/366: Support dimming inapt commands, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2243650b95 183/366: transient--emergency-exit: Signal the error, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient f5d81ef0ed 186/366: transient-lisp-variable: New class, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 96cec8e16e 187/366: manual: Use a favicon in html export, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2a79b61664 192/366: transient--emergency-exit: Always signal the error, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 55bad19507 194/366: transient--pp-to-file: Bugfix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient d1caef5192 198/366: Add new `init-value' infix slot,
Jonas Bernoulli <=
- [elpa] externals/transient 990eb0a292 201/366: Don't bind "M-<key>" to any common commands, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient c8d0a17eba 207/366: transient--init-prefix: New function, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 3c5ac3a989 208/366: transient--init-suffixes: New function, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 517fe3b15e 209/366: transient--flatten-suffixes: New function, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 1a1b2cc611 210/366: transient-args: Use new internal functions, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient b12528f6e1 216/366: transient--with-emergency-exit: Avoid re-signaling when debugging, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient d472295678 219/366: Set initial dummy value for Package-Version, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient f88dbc4331 212/366: transient-suffix-object: Support all suffixes, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4a2b7fdf75 220/366: Add .elpaignore, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 90e640fe8f 225/366: Bump copyright years, Jonas Bernoulli, 2022/01/25