diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-10-22 21:16:49 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-10-22 21:16:49 -0400 |
commit | ce4e8aaa32da1f38a00c3c1fed911112f8b48f23 (patch) | |
tree | b00822671a9c9214ba4aa9cc799b2c9f5658de50 /lisp/init-bib.el | |
parent | 41eefb50482b30ec49f5b67df139296db1b7f2d6 (diff) | |
parent | c61c59b28a98573075a968666b897255ac56e67e (diff) | |
download | emacs.d-ce4e8aaa32da1f38a00c3c1fed911112f8b48f23.tar.gz |
Merge branch 'emacs24.4'
Diffstat (limited to 'lisp/init-bib.el')
-rw-r--r-- | lisp/init-bib.el | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lisp/init-bib.el b/lisp/init-bib.el index ae15305..f254b0a 100644 --- a/lisp/init-bib.el +++ b/lisp/init-bib.el @@ -63,16 +63,12 @@ point." (browse-url (org-link-escape-browser (concat org-doi-server-url doi)))) (defun km/doi-at-point () - "Return DOI at point. -This is a hack that uses `(thing-at-point 'url)' and then removes -the leading 'http://'. The DOI format is not verified in any -way." + "Return DOI at point." (save-excursion - (when (equal (thing-at-point 'word) "doi") - (backward-word) - (re-search-forward "doi:[ \t\n]*")) - (--if-let (thing-at-point 'url) - (replace-regexp-in-string "http://" "" it) - (user-error "No DOI found at point")))) + (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)))) (provide 'init-bib) |