[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 6918d89 108/224: Don't indent while the buffer is
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 6918d89 108/224: Don't indent while the buffer is in intermediate broken states. |
Date: |
Sat, 7 Aug 2021 09:22:29 -0400 (EDT) |
branch: elpa/paredit
commit 6918d89538657a9d31efdb1f51465df65bb4bb7f
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Don't indent while the buffer is in intermediate broken states.
Ignore-this: eb090de24ae6a8502605aefee51420a4
Emacs may have indentation methods that rely on the buffer's being
balanced.
The change to `paredit-forward-barf-sexp' is OK because when
`paredit-forward-and-indent' calls `indent-region', the point will be
on the same line as the closing delimiter, so it will get indented
correctly.
Add regression tests.
darcs-hash:20110409182523-00fcc-5ed49a704f12afa1fb9353eb8dcd5d97e963964c
---
paredit.el | 25 +++++++++++++------------
test.el | 17 +++++++++++++++++
2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/paredit.el b/paredit.el
index f9654be..5fef46d 100644
--- a/paredit.el
+++ b/paredit.el
@@ -2206,17 +2206,18 @@ If in a string, move the opening double-quote forward
by one
(up-list) ; Up to the end of the list to
(let ((close (char-before))) ; save and delete the closing
(backward-delete-char 1) ; delimiter.
- (catch 'return ; Go to the end of the desired
- (while t ; S-expression, going up a
- (paredit-handle-sexp-errors ; list if it's not in this,
- (progn (paredit-forward-and-indent)
- (throw 'return nil))
- (up-list)
- (setq close ; adjusting for mixed
- (prog1 (char-before) ; delimiters as necessary,
- (backward-delete-char 1)
- (insert close))))))
- (insert close))) ; to insert that delimiter.
+ (let ((start (point)))
+ (catch 'return ; Go to the end of the desired
+ (while t ; S-expression, going up a
+ (paredit-handle-sexp-errors ; list if it's not in this,
+ (progn (forward-sexp) (throw 'return nil))
+ (up-list)
+ (setq close ; adjusting for mixed
+ (prog1 (char-before) ; delimiters as necessary,
+ (backward-delete-char 1)
+ (insert close))))))
+ (insert close) ; to insert that delimiter.
+ (indent-region start (point) nil))))
(defun paredit-forward-slurp-into-string ()
(goto-char (1+ (cdr (paredit-string-start+end-points))))
@@ -2245,7 +2246,7 @@ Automatically reindent the newly barfed S-expression with
respect to
(cond ((bobp)
(error "Barfing all subexpressions with no open-paren?"))
((paredit-in-comment-p) ; Don't put the close-paren in
- (newline-and-indent))) ; a comment.
+ (newline))) ; a comment.
(insert close))
;; Reindent all of the newly barfed S-expressions.
(paredit-forward-and-indent)))
diff --git a/test.el b/test.el
index 987048a..ddb61c8 100644
--- a/test.el
+++ b/test.el
@@ -183,4 +183,21 @@ Four arguments: the paredit command, the text of the buffer
;; (";;|foo(" ";|foo(" error)
))
+(defun paredit-canary-indent-method (state indent-point normal-indent)
+ (check-parens)
+ nil)
+
+(put 'paredit-canary 'scheme-indent-function 'paredit-canary-indent-method)
+
+;;; Check for regressions the indentation behaviour of forward slurping
+;;; and barfing.
+
+(paredit-test 'paredit-forward-slurp-sexp
+ '(("(paredit-canary|)\n(lose)"
+ "(paredit-canary|\n (lose))")))
+
+(paredit-test 'paredit-forward-barf-sexp
+ '(("(paredit-canary| ;\n (lose))")
+ ("(paredit-canary| ;\n)\n(lose)")))
+
;++ Killing commands...ugh...
- [nongnu] elpa/paredit 929e547 038/224: Fix some opening remarks about enabling paredit mode., (continued)
- [nongnu] elpa/paredit 929e547 038/224: Fix some opening remarks about enabling paredit mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 90c7eda 042/224: Revive `paredit-semicolon', with better behaviour., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit a26a9a7 075/224: Permit joining adjacent lists without intervening whitespace., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit f27c480 070/224: Implement `paredit-override-check-parens-function'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 67caf7e 071/224: Eliminate fboundp check for `check-parens' in `paredit-check-region'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit ae53a2c 077/224: Show point in `paredit-semicolon' example., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 26a3ddb 085/224: Add `paredit-doublequote' examples at end of string and in comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 33463ae 102/224: Third argument to `indent-region' is not optional in GNU Emacs 21., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit c91bc2f 099/224: Fix bug in change to check structure in backward-delete of comment end., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 7e3b3f0 096/224: In `paredit-recenter-on-sexp', handle S-expressions larger than screen., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 6918d89 108/224: Don't indent while the buffer is in intermediate broken states.,
ELPA Syncer <=
- [nongnu] elpa/paredit adfccc5 123/224: Check `paredit-kill' in a comment more carefully., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 23afafc 128/224: Add some trivial tests for region deletion/killing commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2e61740 134/224: Fix docstring of `paredit-check-region-for-delete'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit eb138b5 135/224: Replace `paredit-wrap-sexp' tests by `paredit-wrap-round' &c. tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit a795774 143/224: Set `show-trailing-whitespace' to nil when running tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit f349cc5 003/224: Changes for version 7., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit f588dcb 007/224: Changes for version 11., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit a04d9b6 010/224: Changes for version 14, introducing fancy comment handling., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 342fee5 017/224: Changes for version 21., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 1bb9831 002/224: Changes for versions 2--6., ELPA Syncer, 2021/08/07