Richard Stallman <[EMAIL PROTECTED]> writes:
> Calling `up-list' inside a string gives this error:
> up-list: Scan error: "Unbalanced parentheses", 14, 19
>
> These commands do not know that they are starting from inside a string.
>
> It may now be possible to make them understand that, using
> syntax-ppss. If someone wants to start implementing this, please go
> ahead; it could be installed in a later release.
Thank you for pointing that out.
Using this, it was very easy to get the function I wanted.
(defun up-list-forward (arg)
"Move forward out of one level of parentheses.
With arg, do this that many times.
A negative argument means move backward but still to a less deep spot."
(interactive "p")
(let ((pos (point)))
(if (< arg 0)
;; backward
(while (and pos (/= arg 0))
(setq pos (cadr (syntax-ppss pos)))
(incf arg))
;; forward
(while (and pos (/= arg 0))
(when (setq pos (cadr (syntax-ppss pos)))
(setq pos (scan-sexps pos 1)) ; move to end of sexp
(decf arg))))
(if pos
(goto-char pos)
(error "Reached top level"))))
_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug