[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 328298fb7d 021/366: transient--pp-to-file: Ne
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 328298fb7d 021/366: transient--pp-to-file: New function |
Date: |
Tue, 25 Jan 2022 18:54:22 -0500 (EST) |
branch: externals/transient
commit 328298fb7d160a10edce9f3dd10af827a1f866a5
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient--pp-to-file: New function
Bind `print-level' and `print-length' to nil to ensure nothing
is abbreviated.
Use the new function in all the `transient-save-*' functions,
fixing #15.
---
lisp/transient.el | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 05d4baf6a4..c58349a7bf 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -279,6 +279,14 @@ See info node `(transient)Enabling and Disabling
Suffixes'."
(insert-file-contents file)
(read (current-buffer))))))
+(defun transient--pp-to-file (object file)
+ (make-directory (file-name-directory file) t)
+ (setq object (cl-sort object #'string< :key #'car))
+ (with-temp-file file
+ (let ((print-level nil)
+ (print-length nil))
+ (pp object (current-buffer)))))
+
(defvar transient-values
(transient--read-file-contents transient-values-file)
"Values of transient commands.
@@ -286,10 +294,7 @@ The value of this variable persists between Emacs sessions
and you usually should not change it manually.")
(defun transient-save-values ()
- (make-directory (file-name-directory transient-values-file) t)
- (setq transient-values (cl-sort transient-values #'string< :key #'car))
- (with-temp-file transient-values-file
- (insert (pp-to-string transient-values))))
+ (transient--pp-to-file transient-values transient-values-file))
(defvar transient-levels
(transient--read-file-contents transient-levels-file)
@@ -298,10 +303,7 @@ The value of this variable persists between Emacs sessions
and you usually should not change it manually.")
(defun transient-save-levels ()
- (make-directory (file-name-directory transient-levels-file) t)
- (setq transient-levels (cl-sort transient-levels #'string< :key #'car))
- (with-temp-file transient-levels-file
- (insert (pp-to-string transient-levels))))
+ (transient--pp-to-file transient-levels transient-levels-file))
(defvar transient-history
(transient--read-file-contents transient-history-file)
@@ -311,15 +313,13 @@ The value of this variable persists between Emacs sessions
should not change it manually.")
(defun transient-save-history ()
- (make-directory (file-name-directory transient-history-file) t)
(setq transient-history
(cl-sort (mapcar (pcase-lambda (`(,key . ,val))
(cons key (-take transient-history-limit
(delete-dups val))))
transient-history)
#'string< :key #'car))
- (with-temp-file transient-history-file
- (insert (pp-to-string transient-history))))
+ (transient--pp-to-file transient-history transient-history-file))
(defun transient-maybe-save-history ()
"Save the value of `transient-history'.
- [elpa] externals/transient 8219c0ba1d 003/366: read-from-minibuffer: Bugfix, (continued)
- [elpa] externals/transient 8219c0ba1d 003/366: read-from-minibuffer: Bugfix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 33f538a0bb 001/366: Release version 0.1.0, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 44fa23c379 004/366: transient--pre-exit: Add debug statement, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 0758efa1db 015/366: transient--show: Remove trailing whitespace, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9183fe1ed2 006/366: Do not use cl-typep, which is broken for objects on Emacs 25, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient be13cd4616 008/366: readme: Fix screenshot url, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient ca18bb66d2 012/366: transient--show: Bind lv-use-separator to t, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2f011c9f19 013/366: transient--show-brief: Don't call kbd twice per key, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient db815604b3 025/366: Mention that infixes are suffixes, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient cc54574005 017/366: manual: Prevent evaluation of code blocks, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 328298fb7d 021/366: transient--pp-to-file: New function,
Jonas Bernoulli <=
- [elpa] externals/transient 796f896507 026/366: Add a changelog, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 1fa3896986 016/366: manual: Call ox-texinfo+-update-copyright-years while exporting, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient f0213e0543 032/366: Add commands to scroll transient window, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2fed1b4f90 036/366: Change transient-show's key binding, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 6a9b8a6bd4 037/366: Bind transient-scroll-{up, down} explicitly, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 5f0ec7d08c 039/366: transient-predicate-map: Bind digit-argument, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient ebe9d9d354 046/366: transient-{set, save}-value: New generic functions, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient eade425ec6 044/366: transient-init-value: Define catch all method using cl-defgeneric, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 93c9a7ecfc 052/366: transient--history-init: Fix doc-string pasto, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient f2314ba2a4 059/366: transient-infix-set: Silence byte-compiler, Jonas Bernoulli, 2022/01/25