扩展给出的答案:也处理评论,当没有找到更多列表时发送“nil”。交互调用时,消息结果。
(defun ar-up-list (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 ((orig (point))
(pps (syntax-ppss))
erg)
(and (nth 8 pps) (goto-char (nth 8 pps)))
(ignore-errors (up-list arg))
(and (< orig (point)) (setq erg (point)))
(when (interactive-p) (message "%s" erg))
erg))
它是补充:
(defun ar-down-list (arg)
"Move forward down one level of parentheses.
With ARG, do this that many times.
A negative argument means move backward but still go down a level. "
(interactive "p")
(let ((orig (point))
(pps (syntax-ppss))
erg)
(and (nth 8 pps) (goto-char (nth 8 pps)))
(ignore-errors (down-list arg))
(and (< orig (point)) (setq erg (point)))
(when (interactive-p) (message "%s" erg))
erg))