diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-02-04 01:10:32 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-02-04 01:10:32 -0500 |
commit | 9f25c15df0ed5fc984a9c8ae3f54d0377b9f3086 (patch) | |
tree | 8102efded6144fc2b27e5ba6281ab5dd7897135e | |
parent | 4185fcf6bf4f7a22f21846ec97a8c6b5071743cd (diff) | |
download | emacs.d-9f25c15df0ed5fc984a9c8ae3f54d0377b9f3086.tar.gz |
Rewrite doi-at-point
- Require that point is on either actual doi or "doi:".
- Use the regexp to deal with trailing punctuation.
-rw-r--r-- | lisp/init-bib.el | 8 |
1 files changed, 3 insertions, 5 deletions
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) |