[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 135c940 068/224: Count carefully at end of buffer
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 135c940 068/224: Count carefully at end of buffer in `paredit-count-sexps-forward'. |
Date: |
Sat, 7 Aug 2021 09:22:21 -0400 (EDT) |
branch: elpa/paredit
commit 135c94043eee6a97a94a41b0fa2cb79677165c41
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Count carefully at end of buffer in `paredit-count-sexps-forward'.
Ignore-this: 710e264ca330414cfb55c295d0ed5f46
Fixes `C-u M-(' at the top level when there is whitespace at the end
of the buffer: the closing delimiter should go at the end of the last
S-expression, not at the end of the buffer after the whitespace.
Thanks to Eitan Postavsky for the report.
darcs-hash:20110320183854-00fcc-7162d40b9111aed39ca72a913393af8bb2425025
---
paredit.el | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/paredit.el b/paredit.el
index 637dd72..3c89c50 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1866,10 +1866,18 @@ By default OPEN and CLOSE are round delimiters."
(defun paredit-count-sexps-forward ()
(save-excursion
(let ((n 0))
- (paredit-ignore-sexp-errors
- (while (not (eobp))
- (forward-sexp)
- (setq n (+ n 1))))
+ (catch 'exit
+ (paredit-ignore-sexp-errors
+ (while (not (eobp))
+ (let ((start (point)))
+ (forward-sexp)
+ ;; Don't count whitespace at the end of the buffer as
+ ;; another S-expression.
+ (if (and (eobp)
+ (save-excursion (backward-sexp)
+ (or (bobp) (< (point) start))))
+ (throw 'exit nil)))
+ (setq n (+ n 1)))))
n)))
(defun paredit-yank-pop (&optional argument)
- [nongnu] elpa/paredit b1362db 223/224: Work around new quirk in emacs --eval., (continued)
- [nongnu] elpa/paredit b1362db 223/224: Work around new quirk in emacs --eval., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8be6d99 001/224: Initial revision., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit eff9084 006/224: Changes for version 10., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 1821854 008/224: Changes for version 12., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b033174 015/224: Changes for version 19., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit ff2cbab 018/224: Bump version number: 21 -> 22 beta., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 27a4b80 020/224: Fix indentation in definition of `paredit-initialize-comment-dwim'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit cd079c4 026/224: Bump copyright year., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 25e444c 056/224: Omit optional argument `yank-handler' in `paredit-kill-region'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 125b8b6 097/224: Fix docstring for `paredit-test-failure-function' in test.el., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 135c940 068/224: Count carefully at end of buffer in `paredit-count-sexps-forward'.,
ELPA Syncer <=
- [nongnu] elpa/paredit 26ddb8a 076/224: Show point in `paredit-open-square' example., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit de2dc8e 127/224: Add some trivial tests for `paredit-wrap-sexp'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2463273 130/224: Add tests for region deletion across comment boundaries., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d1b562b 133/224: Fix `paredit-backslash' within a character literal., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 239e065 136/224: Expand `paredit-kill' tests a little., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 9780ff5 150/224: Add CREDITS file from 2011-05-08. Needs some additions since then., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e01d5d9 151/224: Add `megane' from a slightly newer list of credits, 2011-08-30., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 72b1fc7 152/224: Bump copyright year to 2013., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2186c7e 155/224: Update URI references: nix paredit-23.el, add Git repository., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 427d8e1 160/224: Add a pile of `paredit-backward-barf-sexp' tests., ELPA Syncer, 2021/08/07