diff lisp/emacs-lisp/lisp.el @ 109819:7a3c2a989900

* lisp/emacs-lisp/lisp.el (up-list): Obey forward-sexp-function if set.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 17 Aug 2010 22:18:40 +0200
parents 973b5bc5fcfe
children 280c8ae2476d
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el	Tue Aug 17 23:05:50 2010 +0300
+++ b/lisp/emacs-lisp/lisp.el	Tue Aug 17 22:18:40 2010 +0200
@@ -142,7 +142,13 @@
   (or arg (setq arg 1))
   (let ((inc (if (> arg 0) 1 -1)))
     (while (/= arg 0)
-      (goto-char (or (scan-lists (point) inc 1) (buffer-end arg)))
+      (if forward-sexp-function
+          (condition-case err
+              (while (let ((pos (point)))
+                       (forward-sexp inc)
+                       (/= (point) pos)))
+            (scan-error (goto-char (nth 2 err))))
+        (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))))
       (setq arg (- arg inc)))))
 
 (defun kill-sexp (&optional arg)