From cf9a6d521fa62c7a299a1644ce966df440e8c307 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 27 Oct 2014 22:53:39 -0400 Subject: Rewrite doi-at-point (again) Changes in 300cdc4 don't seem to work in Gnus article buffer. --- lisp/init-bib.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lisp/init-bib.el') diff --git a/lisp/init-bib.el b/lisp/init-bib.el index f254b0a..803b53e 100644 --- a/lisp/init-bib.el +++ b/lisp/init-bib.el @@ -65,10 +65,10 @@ point." (defun km/doi-at-point () "Return DOI at point." (save-excursion - (let ((doi (cadr (get-text-property (point) 'htmlize-link)))) - (when (or (not doi) - (not (string-prefix-p "doi:" doi))) - (user-error "No DOI found at point")) - (replace-regexp-in-string "doi:" "" doi)))) + (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")))) (provide 'init-bib) -- cgit v1.2.3