diff options
| author | Lars Ingebrigtsen | 2021-11-04 23:32:51 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-04 23:32:51 +0100 |
| commit | a78ac0c5df74be6925f48896fd024f1f6f363c44 (patch) | |
| tree | 480723b46c0467f5b969db0abf0fe2f089dc0fcb | |
| parent | 4cf7af5a2a9aecb067d95b96a5965cc74627e86b (diff) | |
| download | emacs-a78ac0c5df74be6925f48896fd024f1f6f363c44.tar.gz emacs-a78ac0c5df74be6925f48896fd024f1f6f363c44.zip | |
Try harder to keep lines short in pp-emacs-lisp-code
* lisp/emacs-lisp/pp.el (pp--insert): Try harder to keep lines short.
| -rw-r--r-- | lisp/emacs-lisp/pp.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el index df837fa691e..ffaa2aeb93a 100644 --- a/lisp/emacs-lisp/pp.el +++ b/lisp/emacs-lisp/pp.el | |||
| @@ -333,7 +333,17 @@ Ignores leading comment characters." | |||
| 333 | (save-excursion | 333 | (save-excursion |
| 334 | (goto-char start) | 334 | (goto-char start) |
| 335 | (unless (looking-at "[ \t]+$") | 335 | (unless (looking-at "[ \t]+$") |
| 336 | (insert "\n")))))) | 336 | (insert "\n")) |
| 337 | (pp--indent-buffer) | ||
| 338 | (goto-char (point-max)) | ||
| 339 | ;; If we're still too wide, then go up one step and try to | ||
| 340 | ;; insert a newline there. | ||
| 341 | (when (> (current-column) (window-width)) | ||
| 342 | (condition-case () | ||
| 343 | (backward-up-list 1) | ||
| 344 | (:success (when (looking-back " " 2) | ||
| 345 | (insert "\n"))) | ||
| 346 | (error nil))))))) | ||
| 337 | 347 | ||
| 338 | (defun pp--indent-buffer () | 348 | (defun pp--indent-buffer () |
| 339 | (goto-char (point-min)) | 349 | (goto-char (point-min)) |