Last active
April 16, 2024 09:27
-
-
Save tmalsburg/c4e8c9bc9a94a7f9faea21f1c7b2cd0f to your computer and use it in GitHub Desktop.
Revisions
-
tmalsburg revised this gist
Apr 11, 2024 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,20 @@ (require 'url-http) (defun insert-bibtex-from-doi () (interactive) (let* ((doi (string-trim (gui-get-primary-selection))) (url (if (string-prefix-p "https://doi.org/" doi) doi (concat "https://doi.org/" doi))) (url-request-method "GET") (url-mime-accept-string "application/x-bibtex")) (insert (with-current-buffer (url-retrieve-synchronously url t) (goto-char (point-min)) (while (not (looking-at "\n")) (forward-line 1)) (let ((string (buffer-substring-no-properties (point) (point-max)))) (kill-buffer) (decode-coding-string (string-trim string) 'utf-8)))) (bibtex-clean-entry t))) -
tmalsburg revised this gist
Apr 11, 2024 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,10 @@ (url-mime-accept-string "application/x-bibtex")) (insert (with-current-buffer (url-retrieve-synchronously url t) (goto-char (point-min)) (while (not (looking-at "\n")) (forward-line 1)) (let ((string (buffer-substring-no-properties (point) (point-max)))) (kill-buffer) (decode-coding-string (string-trim string) 'utf-8)))) (bibtex-clean-entry t))) -
tmalsburg revised this gist
Apr 10, 2024 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,18 @@ (require 'url-http) (defun tmalsburg-insert-bibtex-from-doi () (interactive) (let* ((doi (string-trim (gui-get-primary-selection))) (url (concat "https://doi.org/" doi)) (url-request-method "GET") (url-mime-accept-string "application/x-bibtex")) (insert (with-current-buffer (url-retrieve-synchronously url t) ;; (re-search-forward "^$" nil t) (goto-char (point-min)) (while (not (looking-at "\n")) (forward-line 1)) (let ((string (buffer-substring-no-properties (point) (point-max)))) (kill-buffer) (string-trim string)))) (bibtex-clean-entry t))) -
tmalsburg revised this gist
Apr 10, 2024 . No changes.There are no files selected for viewing
-
tmalsburg renamed this gist
Apr 10, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ (require 'url-http) (defun insert-bibtex-from-doi () (interactive) (let* ((doi (string-trim (gui-get-primary-selection))) (url (concat "https://doi.org/" doi)) -
tmalsburg created this gist
Apr 10, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ (require 'url-http) (defun tmalsburg-insert-bibtex-from-doi () (interactive) (let* ((doi (string-trim (gui-get-primary-selection))) (url (concat "https://doi.org/" doi)) (url-request-method "GET") (url-mime-accept-string "application/x-bibtex")) (insert (with-current-buffer (url-retrieve-synchronously url t) (goto-char (point-min)) (while (not (looking-at "\n")) (forward-line 1)) (let ((string (buffer-substring-no-properties (point) (point-max)))) (kill-buffer) (string-trim string))))))