comparison 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
comparison
equal deleted inserted replaced
109818:0710ff9a8063 109819:7a3c2a989900
140 This command assumes point is not in a string or comment." 140 This command assumes point is not in a string or comment."
141 (interactive "^p") 141 (interactive "^p")
142 (or arg (setq arg 1)) 142 (or arg (setq arg 1))
143 (let ((inc (if (> arg 0) 1 -1))) 143 (let ((inc (if (> arg 0) 1 -1)))
144 (while (/= arg 0) 144 (while (/= arg 0)
145 (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))) 145 (if forward-sexp-function
146 (condition-case err
147 (while (let ((pos (point)))
148 (forward-sexp inc)
149 (/= (point) pos)))
150 (scan-error (goto-char (nth 2 err))))
151 (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))))
146 (setq arg (- arg inc))))) 152 (setq arg (- arg inc)))))
147 153
148 (defun kill-sexp (&optional arg) 154 (defun kill-sexp (&optional arg)
149 "Kill the sexp (balanced expression) following point. 155 "Kill the sexp (balanced expression) following point.
150 With ARG, kill that many sexps after point. 156 With ARG, kill that many sexps after point.