[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit c0a9160 041/224: Make `paredit-newline' keep inval
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit c0a9160 041/224: Make `paredit-newline' keep invalid structure inside comments. |
Date: |
Sat, 7 Aug 2021 09:22:15 -0400 (EDT) |
branch: elpa/paredit
commit c0a916070586689a4b29fe0537b2af59a581e2b4
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Make `paredit-newline' keep invalid structure inside comments.
Ignore-this: 914cf744a9baefd2fe545a4dcedcb6e6
darcs-hash:20100917202803-00fcc-ccf81a80dc2bcb44576e674bea314d5c6cfcf3de
---
paredit.el | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/paredit.el b/paredit.el
index ce8ea88..848312d 100644
--- a/paredit.el
+++ b/paredit.el
@@ -962,25 +962,40 @@ If not in a string, act as `paredit-doublequote'; if no
prefix argument
(insert char) ; (Is there a better way to
nil)) ; express the rubout char?
; ?\^? works, but ugh...)
-
-;;; The placement of these functions in this file is totally random.
-
+
(defun paredit-newline ()
"Insert a newline and indent it.
This is like `newline-and-indent', but it not only indents the line
that the point is on but also the S-expression following the point,
if there is one.
Move forward one character first if on an escaped character.
-If in a string, just insert a literal newline."
+If in a string, just insert a literal newline.
+If in a comment and if followed by invalid structure, call
+ `indent-new-comment-line' to keep the invalid structure in a
+ comment."
(interactive)
- (if (paredit-in-string-p)
- (newline)
- (if (and (not (paredit-in-comment-p)) (paredit-in-char-p))
- (forward-char))
- (newline-and-indent)
- ;; Indent the following S-expression, but don't signal an error if
- ;; there's only a closing delimiter after the point.
- (paredit-ignore-sexp-errors (indent-sexp))))
+ (cond ((paredit-in-string-p)
+ (newline))
+ ((paredit-in-comment-p)
+ (if (paredit-handle-sexp-errors
+ ;; Check for anything that would break structure in
+ ;; the comment.
+ (save-restriction
+ (narrow-to-region (point) (point-at-eol))
+ (save-excursion
+ (while (< (point) (point-max))
+ (forward-sexp)))
+ t)
+ nil)
+ (progn (newline-and-indent) (indent-sexp))
+ (indent-new-comment-line)))
+ (t
+ (if (paredit-in-char-p)
+ (forward-char))
+ (newline-and-indent)
+ ;; Indent the following S-expression, but don't signal an
+ ;; error if there's only a closing delimiter after the point.
+ (paredit-ignore-sexp-errors (indent-sexp)))))
(defun paredit-reindent-defun (&optional argument)
"Reindent the definition that the point is on.
- [nongnu] elpa/paredit 27548db 220/224: Disable minibuffer message delays in tests., (continued)
- [nongnu] elpa/paredit 27548db 220/224: Disable minibuffer message delays in tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b1c332a 218/224: Bump copyright year., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 09658a4 221/224: Trailing newline., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit dc60d93 029/224: Document the effect of a prefix argument to the `paredit-mode' command., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 190797e 030/224: Add warning to documentation of prefix arguments to `paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 41a0a34 033/224: Omit unused variable `orig' in `paredit-move-past-close-and-reindent'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 04e6f50 035/224: Put space between closing delimiters and opening double quotes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 70d40b5 040/224: Refine scope of reindentation after raise, splice, and insert-comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 896c165 039/224: Implement variable `paredit-space-for-delimiter-predicates'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e23adec 036/224: Omit vestigial debug message in `paredit-backward-slurp-into-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit c0a9160 041/224: Make `paredit-newline' keep invalid structure inside comments.,
ELPA Syncer <=
- [nongnu] elpa/paredit 05b2cad 043/224: Generalize `paredit-kill' to work inside any string-like object., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e380e42 048/224: Implement `paredit-{for, back}ward-{up, down}'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3ce96a4 050/224: Fix format arguments in `paredit-check-region-state-comment'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 73c481a 061/224: Simplify and clarify implementation of `paredit-backslash'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b51f220 055/224: In `paredit-newline', ignore parse errors during `indent-sexp'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0011090 066/224: Fix bounds checking in `paredit-find-next-string-start'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit bd0e5ba 072/224: Don't mask errors during `buffer-string' in `paredit-unescape-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b7f234a 067/224: Preserve column in `paredit-reindent-defun'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2a94a48 103/224: Set `indent-tabs-mode' and `current-column' in `paredit-test'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e06ab40 063/224: Spell `paredit-recenter-on-sexp' to match convention in Emacs., ELPA Syncer, 2021/08/07