[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit fc78011 121/224: Tweak `paredit-check-region' and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit fc78011 121/224: Tweak `paredit-check-region' and `paredit-region-ok-p'. |
Date: |
Sat, 7 Aug 2021 09:22:32 -0400 (EDT) |
branch: elpa/paredit
commit fc78011c32e601d8a1c91a317382a1e7a1b24024
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Tweak `paredit-check-region' and `paredit-region-ok-p'.
Ignore-this: c75566b3db4425b39ca633d55c6d400e
In `paredit-check-region', call `paredit-region-ok-p' to discern
whether the region is OK before narrowing and calling `check-parens'
to report any errors. This avoids unwanted point motion if the
region is OK, or if it isn't, lets `check-parens' move the point to
the part where the region is not OK.
Write docstrings for the two routines.
darcs-hash:20110411180300-00fcc-674d77c0c9566bcfb8ef7cfe88a50de34a373853
---
paredit.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/paredit.el b/paredit.el
index 2f27690..3a05af6 100644
--- a/paredit.el
+++ b/paredit.el
@@ -2582,11 +2582,19 @@ If no parse state is supplied, compute one from the
beginning of the
(error "Invalid context for command `%s'." command)))
(defun paredit-check-region (start end)
- (save-restriction
- (narrow-to-region start end)
- (check-parens)))
+ "Signal an error if text between `start' and `end' is unbalanced."
+ ;; `narrow-to-region' will move the point, so avoid calling it if we
+ ;; don't need to. We don't want to use `save-excursion' because we
+ ;; want the point to move if `check-parens' reports an error.
+ (if (not (paredit-region-ok-p start end))
+ (save-restriction
+ (narrow-to-region start end)
+ (check-parens))))
(defun paredit-region-ok-p (start end)
+ "Return true iff the region between `start' and `end' is balanced.
+This is independent of context -- it doesn't check what state the
+ text at `start' is in."
(save-excursion
(paredit-handle-sexp-errors
(progn
- [nongnu] elpa/paredit d9ecc6d 094/224: Handle scan errors in `paredit-scan-sexps-hack'., (continued)
- [nongnu] elpa/paredit d9ecc6d 094/224: Handle scan errors in `paredit-scan-sexps-hack'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 6c14694 113/224: Use `call-interactively' rather than `funcall' in `paredit-test'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 9cac6fa 106/224: Specify that paredit should work in XEmacs 21.5.28 or later., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0bb4b62 110/224: Check for expected errors in `paredit-close-FOO'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3c48233 122/224: Fix checks on deletion of comment boundaries., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 620c3a2 116/224: Break page in test.el before indentation regression tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d681e3c 111/224: Check for expected errors in `paredit-forward-delete'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5dc93f9 114/224: Omit redundant `paredit-forward-delete' test., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0cd0011 109/224: Implement expected errors in test suite., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8ee8f13 118/224: Fix `paredit-insert-pair' when buffer ends with no-newline comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit fc78011 121/224: Tweak `paredit-check-region' and `paredit-region-ok-p'.,
ELPA Syncer <=
- [nongnu] elpa/paredit 621be23 124/224: Add some tests for recent changes to deletion and killing commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit fac925d 125/224: Tweak safe region deletion., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8d87576 129/224: Fix logic in checking region deletion across comment boundaries., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 4723fb3 132/224: Add and fix some tests for `(' and `)' while in a character literal., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5558fd0 137/224: Make `paredit-in-char-p' work recursively., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 88a5cf7 139/224: Be explicit about Transient Mark Mode in `paredit-wrap-*' tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d80a9db 141/224: Fail early in `paredit-convolute-sexp'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2ec6000 145/224: Fix error message in `paredit-test'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 6f2677b 148/224: Tweak `paredit-convolute-sexp' a little and add some tests for it., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d54ea28 149/224: Add a trivial shell script to generate paredit.html., ELPA Syncer, 2021/08/07