summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-10-27 22:53:39 -0400
committerKyle Meyer <kyle@kyleam.com>2014-10-27 22:53:39 -0400
commitcf9a6d521fa62c7a299a1644ce966df440e8c307 (patch)
tree613be1f7883306c3913a614df5711d82351c80d1 /lisp
parent8183d9da994b3b17c209b2de9e8e118e06f5833a (diff)
downloademacs.d-cf9a6d521fa62c7a299a1644ce966df440e8c307.tar.gz
Rewrite doi-at-point (again)
Changes in 300cdc4 don't seem to work in Gnus article buffer.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-bib.el10
1 files changed, 5 insertions, 5 deletions
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)