X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=blobdiff_plain;f=doi-utils.org;h=48fe3b613f90d447e2df37d723b7609a732a567e;hp=ada477c515f10d68ad867bc3fb980628cbdf99af;hb=716e4f316ac36aa47d2234e9a626260bb055cd29;hpb=cff970c7d49ebc7b61878dd5ca89b96185fef28f diff --git a/doi-utils.org b/doi-utils.org index ada477c..48fe3b6 100644 --- a/doi-utils.org +++ b/doi-utils.org @@ -915,7 +915,9 @@ The idea here is to perform a query on Crossref, get a helm buffer of candidates (cond ;; If region is active assume we want it ((region-active-p) - (buffer-substring (region-beginning) (region-end))) + (replace-regexp-in-string + "\n" " " + (buffer-substring (region-beginning) (region-end)))) ;; type or paste it in (t nil))) @@ -935,7 +937,9 @@ The idea here is to perform a query on Crossref, get a helm buffer of candidates (setq json-string (buffer-substring url-http-end-of-headers (point-max))) (setq json-data (json-read-from-string json-string))) - (let* ((name (format "Crossref hits for %s" query)) + (let* ((name (format "Crossref hits for %s" + ;; remove carriage returns. they cause problems in helm. + (replace-regexp-in-string "\n" " " query))) (helm-candidates (mapcar (lambda (x) (cons (concat @@ -949,7 +953,7 @@ The idea here is to perform a query on Crossref, get a helm buffer of candidates ;; just return the candidate (action . (("Insert bibtex entry" . (lambda (doi) (doi-utils-add-bibtex-entry-from-doi - (replace-regexp-in-string "^http://dx.doi.org/" "" doi)))) + (replace-regexp-in-string "^http://dx.doi.org/" "" doi) ,bibtex-file))) ("Open url" . (lambda (doi) (browse-url doi)))))))) (helm :sources '(source)))))