* lisp/tempo.el (tempo-find-match-string): Simplify

This commit is contained in:
Stefan Monnier 2023-09-08 19:24:53 -04:00
parent 2e907f6df7
commit 740a1e8f33

View file

@ -643,16 +643,10 @@ If `tempo-dirty-collection' is nil, the old collection is reused."
FINDER is a function or a string. Returns (STRING . POS), or nil
if no reasonable string is found."
(cond ((stringp finder)
(let (successful)
(save-excursion
(or (setq successful (re-search-backward finder nil t))
0))
(if successful
(cons (buffer-substring (match-beginning 1)
(match-end 1)) ; This seems to be a
; bug in emacs
(match-beginning 1))
nil)))
(if (save-excursion (re-search-backward finder nil t))
(cons (match-string 1) ; This seems to be a bug in Emacs (?)
(match-beginning 1))
nil))
(t
(funcall finder))))