emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/paredit 4d3ad1e 069/224: Simplify definition of `paredit-c


From: ELPA Syncer
Subject: [nongnu] elpa/paredit 4d3ad1e 069/224: Simplify definition of `paredit-count-sexps-forward'.
Date: Sat, 7 Aug 2021 09:22:21 -0400 (EDT)

branch: elpa/paredit
commit 4d3ad1edcbd29358ac343a0e5fbe137e4fdf90fd
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>

    Simplify definition of `paredit-count-sexps-forward'.
    
    Ignore-this: 76e5c8178ddc5dede762dc101e526095
    
    Use the atrocious idiom (while (setq tmp ...) ...)...
    
    darcs-hash:20110320184537-00fcc-ad46fdaac5b45670aa781cd61c105e1ee6ade7f5
---
 paredit.el | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/paredit.el b/paredit.el
index 3c89c50..726fd09 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1865,19 +1865,11 @@ By default OPEN and CLOSE are round delimiters."
 
 (defun paredit-count-sexps-forward ()
   (save-excursion
-    (let ((n 0))
-      (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)))))
+    (let ((n 0) (p nil))                ;hurk
+      (paredit-ignore-sexp-errors
+        (while (setq p (scan-sexps (point) +1))
+          (goto-char p)
+          (setq n (+ n 1))))
       n)))
 
 (defun paredit-yank-pop (&optional argument)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]