summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/smie.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/smie.el')
-rw-r--r--lisp/emacs-lisp/smie.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index e35cb4a8fc2..32dcb2ed744 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -709,11 +709,13 @@ Possible return values:
(condition-case err
(progn (funcall next-sexp 1) nil)
(scan-error
- (let ((pos (nth 2 err)))
+ (let ((epos (nth 2 err)))
+ (goto-char pos)
(throw 'return
- (list t pos
+ (list t epos
(buffer-substring-no-properties
- pos (+ pos (if (< (point) pos) -1 1))))))))
+ epos
+ (+ epos (if (< (point) epos) -1 1))))))))
(if (eq pos (point))
;; We did not move, so let's abort the loop.
(throw 'return (list t (point))))))