summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-04 23:16:47 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-04 23:16:47 +0100
commit4cf7af5a2a9aecb067d95b96a5965cc74627e86b (patch)
treec81cfd27dd32949c48727fc36f2cf8f106de1e0f /lisp/emacs-lisp
parentcb9f3e1158a7b3cf556bdeeb5c4ba5896279a573 (diff)
downloademacs-4cf7af5a2a9aecb067d95b96a5965cc74627e86b.tar.gz
emacs-4cf7af5a2a9aecb067d95b96a5965cc74627e86b.tar.bz2
emacs-4cf7af5a2a9aecb067d95b96a5965cc74627e86b.zip
Tweak multi-line expressions in pp--format-function
* lisp/emacs-lisp/pp.el (pp--format-function): Fix up multi-line expressions.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/pp.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 67a21c53915..df837fa691e 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -267,8 +267,14 @@ Ignores leading comment characters."
;; Get the first entries on the first line.
(if indent
(pp--format-definition sexp indent edebug)
- (while sexp
- (pp--insert " " (pop sexp))))
+ (let ((prev 0))
+ (while sexp
+ (let ((start (point)))
+ ;; Don't put sexps on the same line as a multi-line sexp
+ ;; preceding it.
+ (pp--insert (if (> prev 1) "\n" " ")
+ (pop sexp))
+ (setq prev (count-lines start (point)))))))
(insert ")")))
(defun pp--format-definition (sexp indent edebug)