[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
forward-list
From: |
Andreas Roehler |
Subject: |
forward-list |
Date: |
Tue, 27 Feb 2007 09:48:56 +0100 |
User-agent: |
Thunderbird 1.5.0.4 (X11/20060516) |
`forward-list' at the moment makes trouble if called from
inside a string. Even inside a list you have to `up-list' first.
Tried to write that as a single command, which will do
necessary up-list and out-of-string silently.
Here the result so far:
(defun forward-list-atpt (&optional arg)
"Move forward across one balanced group of parentheses.
With ARG, do it that many times.
Negative arg -N means move backward across N groups of parentheses."
(interactive "p")
(or arg (setq arg 1))
(let ((pos (point))
(uplist-arg (if (< 0 arg)
1
-1))
(akt-open (nth 1 (parse-partial-sexp 1 (point)))))
(if (eq 4 (syntax-class (syntax-after (point))))
(forward-list arg)
(if (in-string-p)
(progn
(goto-char (or (nth 8 (parse-partial-sexp 1 (point))) (point)))
(forward-char -1)
(up-list uplist-arg)
(if (< 0 arg)
(setq arg (1- arg))
(setq arg (1+ arg))))
(when (and (< 0 (abs arg)) (list-atpt))
(up-list uplist-arg)
(if (< 0 arg)
(setq arg (1- arg))
(setq arg (1+ arg)))))
(forward-list arg))))
Any comments and/or suggestions welcome.
__
Andreas Roehler
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- forward-list,
Andreas Roehler <=