From 9f25c15df0ed5fc984a9c8ae3f54d0377b9f3086 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 4 Feb 2015 01:10:32 -0500 Subject: Rewrite doi-at-point - Require that point is on either actual doi or "doi:". - Use the regexp to deal with trailing punctuation. --- lisp/init-bib.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lisp/init-bib.el') diff --git a/lisp/init-bib.el b/lisp/init-bib.el index 3cdd047..a2f5bc8 100644 --- a/lisp/init-bib.el +++ b/lisp/init-bib.el @@ -80,10 +80,8 @@ point. The link is opened using the settings of (defun km/doi-at-point () "Return DOI at point." (save-excursion - (re-search-backward "[ \t\n]" nil t) - (re-search-forward "\\(doi:[ \t\n]*\\)*\\([-./A-z0-9]+\\)[.; \t\n]" nil t) - (--if-let (match-string-no-properties 2) - (s-chop-suffix "." it) - (error "No DOI found")))) + (skip-chars-backward "-.A-z0-9/") + (and (looking-at "\\(doi:[ \t\n]*\\)*\\([-./A-z0-9]+[A-z0-9]\\)\\b") + (match-string-no-properties 2)))) (provide 'init-bib) -- cgit v1.2.3