5
在下面defun定義 ...Emacs lisp - 如何嘗試/ catch處理錯誤?
(defun re-backward-match-group (rexp &optional n)
"Grab the previous matches of regexp and return the contents of
the n match group (first group match if no n arg is specified)"
(save-excursion
(unless n
(setq n 1))
(when (numberp n)
(when (re-search-backward-lax-whitespace rexp)
(when (= (+ 2 (* n 2)) (length (match-data)))
(match-string-no-properties n))))))
如果沒有找到匹配,錯誤是由re-search-backward-lax-whitespace
拋出我怎麼會趕上錯誤並返回零或""
?
好,謝謝@Barmar – ocodo