1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 18:41:25 -08:00

Tweak multi-line expressions in pp--format-function

* lisp/emacs-lisp/pp.el (pp--format-function): Fix up multi-line
expressions.
This commit is contained in:
Lars Ingebrigtsen 2021-11-04 23:16:47 +01:00
parent cb9f3e1158
commit 4cf7af5a2a
2 changed files with 20 additions and 3 deletions

View file

@ -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)

View file

@ -40,7 +40,8 @@ Name: code-formats3
(let ((a 1)
(b 2))
(zot-zot-zot-zot-zot-zot 1 2 (funcall
bar-bar-bar-bar-bar-bar-bar-bar-bar-bar 2))))
bar-bar-bar-bar-bar-bar-bar-bar-bar-bar
2))))
=-=-=
@ -103,3 +104,13 @@ Name: code-formats9
(interactive)
1)
=-=-=
Name: code-formats10
=-=
(funcall foo (concat "zot" (if (length> site 0) site
"bar")
"+"
(string-replace " " "+" query)))
=-=-=