* bug#14187: [PATCH] Pretty-print long values in custom variables
[not found] <20130411190713.GA16559@pacific.linksys.moosehall>
@ 2013-04-11 19:13 ` Adam Spiers
2013-04-12 1:55 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2013-04-11 19:13 UTC (permalink / raw)
To: 14187
* cus-edit.el (custom-save-variables): When a custom value is over 60
characters long, insert it using indent-pp-sexp so that the value is
more legible through being split over multiple lines. This is
particularly useful when `custom-file' is tracked by a version control
system, since then the diffs become much more manageable.
---
lisp/cus-edit.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index d19e2de..8a018cb 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4529,7 +4529,15 @@ This function does not save the buffer."
(princ " '(")
(prin1 symbol)
(princ " ")
- (prin1 (car value))
+ (let ((val (prin1-to-string (car value))))
+ (if (< (length val) 60)
+ (insert val)
+ (newline-and-indent)
+ (let ((beginning-of-val (point)))
+ (insert val)
+ (save-excursion
+ (goto-char beginning-of-val)
+ (indent-pp-sexp 1)))))
(when (or now requests comment)
(princ " ")
(prin1 now)
--
1.8.2.1.347.gbef22ca
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-08 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20130411190713.GA16559@pacific.linksys.moosehall>
2013-04-11 19:13 ` bug#14187: [PATCH] Pretty-print long values in custom variables Adam Spiers
2013-04-12 1:55 ` Stefan Monnier
2013-05-08 6:59 ` Glenn Morris
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).