diff options
-rw-r--r-- | paredit.el | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -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) |