From 38e0713734282b6b4e1bc982bcf0f79cd9e3edaa Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Sun, 15 Mar 2015 22:17:17 -0400 Subject: [PATCH 01/16] ignore a few tex files. --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 72f56ac..deab7c4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,7 @@ /org-ref.blg /org-ref.pdf /org-ref.tex +/org-ref.ilg +/org-ref.ind +/org-ref.lof +/org-ref.lot -- 2.39.2 From 3061355eb0479a302b7870223533aca5f2dc3f45 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Sun, 15 Mar 2015 22:17:32 -0400 Subject: [PATCH 02/16] small space change. --- org-ref.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org-ref.el b/org-ref.el index cc3ac5f..ac6422a 100644 --- a/org-ref.el +++ b/org-ref.el @@ -504,7 +504,8 @@ Format according to the type in `org-ref-bibliography-entry-format'." (loop for file in org-ref-bibliography-files do (if (org-ref-key-in-file-p key (file-truename file)) (throw 'result file) - (message "%s not found in %s" key (file-truename file)))))) + (message "%s not found in %s" + key (file-truename file)))))) (with-temp-buffer (insert-file-contents file) -- 2.39.2 From 7a3f814ee1910b8e72b03224acf60b8df6a93dff Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Mon, 16 Mar 2015 08:38:11 -0400 Subject: [PATCH 03/16] add doc about new doi link. --- org-ref.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org-ref.org b/org-ref.org index 04e74b5..7a2ec5c 100644 --- a/org-ref.org +++ b/org-ref.org @@ -212,6 +212,8 @@ This will prompt you for a DOI, and a bibtex file, and then try to get the bibte - doi-utils-add-entry-from-crossref-query This will prompt you for a query string, which is usually the title of an article, or a free-form text citation of an article. Then you will get a helm buffer of matching items, which you can choose from to insert a new bibtex entry into a bibtex file. +This library also redefines the org-mode doi link. Now, when you click on this link you will get a menu of options, e.g. to open a bibtex entry or a pdf if you have it, or to search the doi in some scientific search engines. Try it out doi:10.1021/jp511426q. + ** jmax-bibtex These are functions I use often in bibtex files. -- 2.39.2 From e620af30a93e5424e5c080c8eedeb85ac2af1567 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Mon, 16 Mar 2015 08:42:23 -0400 Subject: [PATCH 04/16] Initial commit of wos.el --- wos.el | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 wos.el diff --git a/wos.el b/wos.el new file mode 100644 index 0000000..e0a321a --- /dev/null +++ b/wos.el @@ -0,0 +1,63 @@ +;;; wos.el --- WEb of Science functions -*- lexical-binding: t; -*- + +;; Copyright (C) 2015 John Kitchin + +;; Author: John Kitchin +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Adds a new org-mode link for a search in Web of Science. + + +;;; Code: +(org-add-link-type + "wos" + (lambda (path) + (browse-url + (format "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary" + (s-join "+" + (split-string path))))) + ;; formatting function. Assume html + (lambda (link desc format) + (format "%s" + (format "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary" + (s-join "+" + (split-string path))) + (format "wos:%s" link) + ))) + + +(defun wos-search () + "Open the word at point or selection in Web of Science." + ;; the url was derived from this page: http://wokinfo.com/webtools/searchbox/ + (interactive) + (browse-url + (format "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary" + (if (region-active-p) + (mapconcat 'identity (split-string + (buffer-substring (region-beginning) + (region-end))) "+") + (thing-at-point 'word))))) + + +(defun wos () + "Open Web of Science search page in a browser." + (interactive) + (browse-url "http://apps.webofknowledge.com")) + +(provide 'wos) +;;; wos.el ends here -- 2.39.2 From bc1db3fdfe710054d81dcb7b988aa683d872721f Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Mon, 16 Mar 2015 08:47:38 -0400 Subject: [PATCH 05/16] rename wos link to wos-search --- wos.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wos.el b/wos.el index e0a321a..ff72a67 100644 --- a/wos.el +++ b/wos.el @@ -25,7 +25,7 @@ ;;; Code: (org-add-link-type - "wos" + "wos-search" (lambda (path) (browse-url (format "http://gateway.webofknowledge.com/gateway/Gateway.cgi?topic=%s&GWVersion=2&SrcApp=WEB&SrcAuth=HSB&DestApp=UA&DestLinkType=GeneralSearchSummary" -- 2.39.2 From 10b2d2d87e4ec05edd0768069e88bcecce096584 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Mon, 16 Mar 2015 08:48:19 -0400 Subject: [PATCH 06/16] add wos documentation --- org-ref.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/org-ref.org b/org-ref.org index 7a2ec5c..297be57 100644 --- a/org-ref.org +++ b/org-ref.org @@ -283,6 +283,18 @@ Or this if you like key-chord: (key-chord-define-global "jj" 'jmax-bibtex-hydra/body) #+END_SRC +** wos +This is a small utility for Web of Science/Knowledge (http://apps.webofknowledge.com). + +#+BEGIN_SRC emacs-lisp +(require 'wos) +#+END_SRC + +- wos :: Convenience function to open WOK in a browser. +- wos-search :: Search WOK with the selected text or word at point + +There is also a new org-mode link that opens a search: [[wos-search:alloy and segregation]] + ** isbn index:isbn -- 2.39.2 From 061265b34f4f68f95a7c8ade91c1a558796c464b Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Mon, 16 Mar 2015 08:48:31 -0400 Subject: [PATCH 07/16] update contents --- README.org | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/README.org b/README.org index b2622eb..3f3489b 100644 --- a/README.org +++ b/README.org @@ -9,19 +9,6 @@ See http://www.youtube.com/watch?v=Zya8SfmCtFA and https://www.youtube.com/watch [[./org-ref.org]] contains all documentation and installation instructions. -[[./doi-utils.org]] contains functions for downloading bibtex entries from a DOI, and redefines the org-mode doi link so it has more functionality. - -[[./jmax-bibtex.el]] contains some utility functions: - -1. jmax-bibtex runs a menu command with actions to run on a bibtex entry including looking up the doi for the entry in a variety of places, e.g. web of science related/citing articles, Google Scholar, Pubmed, and crossref, or opening a PDF associated with the entry. - -2. Bind M-n/M-p to next/previous bibtex entry. - -3. Sentence/title casing the title of a bibtex entry - -4. Function to replace non-ascii characters in bibtex entries - -5. Functions to replace journal names with @string entries, and corresponding short/long names. * Installation We are slowly moving towards getting org-ref in MELPA. Until then, here are some directions that will probably help install org-ref. -- 2.39.2 From 16eda27ba08102b87ab38dd0f52b0b09976beae7 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Mon, 16 Mar 2015 16:27:37 -0400 Subject: [PATCH 08/16] add new function to find bad file links, bad \attachfile{} and attachfile links for the org-ref command. --- org-ref.el | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/org-ref.el b/org-ref.el index ac6422a..4509d2d 100644 --- a/org-ref.el +++ b/org-ref.el @@ -2395,7 +2395,7 @@ Makes a new buffer with clickable links." (kill-buffer "*Missing citations*")) (message "No bad cite links found")))) -;; ** helm interface to bad citations, labels, refs in orgfile +;; ** helm interface to bad citations, labels, refs and files in orgfile (defun org-ref-bad-cite-candidates () "Return a list of conses (key . marker) where key does not exist in the known bibliography files, and marker points to the key." (let* ((cp (point)) ; save to return to later @@ -2482,6 +2482,29 @@ Makes a new buffer with clickable links." (goto-char cp))))) multiple-labels)) +(defun org-ref-bad-file-link-candidates () + "Return list of conses (link . marker) wehre the file in the link does not exist." + (let* ((bad-files '())) + (org-element-map (org-element-parse-buffer) 'link + (lambda (link) + (let ((type (org-element-property :type link))) + (when (or (string= "file" type) + (string= "attachfile" type)) + (unless (file-exists-p (org-element-property :path link)) + (add-to-list 'bad-files + (cons (org-element-property :path link) + (save-excursion + (goto-char + (org-element-property :begin link)) + (point-marker))))))))) + ;; Let us also check \attachfile{fname} + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "\\attachfile{\\(.*\\)}" nil t) + (unless (file-exists-p (match-string 1)) + (add-to-list 'bad-files (cons (match-string 1) (point-marker)))))) + bad-files)) + ;;;###autoload (defun org-ref () "Opens a helm interface to actions for org-ref. @@ -2490,7 +2513,8 @@ Shows bad citations, ref links and labels" (let ((cb (current-buffer)) (bad-citations (org-ref-bad-cite-candidates)) (bad-refs (org-ref-bad-ref-candidates)) - (bad-labels (org-ref-bad-label-candidates))) + (bad-labels (org-ref-bad-label-candidates)) + (bad-files (org-ref-bad-file-link-candidates))) (helm :sources `(((name . "Bad citations") (candidates . ,bad-citations) @@ -2510,6 +2534,12 @@ Shows bad citations, ref links and labels" (switch-to-buffer (marker-buffer marker)) (goto-char marker)))) ;; + ((name . "Bad file links") + (candidates . ,bad-files) + (lambda (marker) + (switch-to-buffer (marker-buffer marker)) + (goto-char marker))) + ;; ((name . "Utilities") (candidates . (("Check buffer again" . org-ref) ("Insert citation" . helm-bibtex) @@ -2534,8 +2564,7 @@ Shows bad citations, ref links and labels" )) (action . (lambda (x) (switch-to-buffer ,cb) - (funcall x)))) - )))) + (funcall x)))))))) ;; ** Find non-ascii charaters (defun org-ref-find-non-ascii-characters () -- 2.39.2 From d25e6dc1a7148a4d8d35c97e5032f68fb3922a01 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Tue, 17 Mar 2015 15:47:02 -0400 Subject: [PATCH 09/16] adjusted cite link re to fix issue #23 https://github.com/jkitchin/org-ref/issues/23 --- org-ref.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org-ref.el b/org-ref.el index ac6422a..fefd831 100644 --- a/org-ref.el +++ b/org-ref.el @@ -326,7 +326,7 @@ You will see a message in the minibuffer when on a cite, ref or label link." (replace-regexp-in-string "\*" "\\\\*" x) ) org-ref-cite-types "\\|") "\\)" - ":\\([a-zA-Z0-9-_:]*,?\\)*")) + ":\\([a-zA-Z0-9-_:\\.]*,?\\)*")) (setq org-ref-label-re -- 2.39.2 From 91014fe9da3996754cf62ffc6177f8813eb38bad Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Tue, 17 Mar 2015 18:45:00 -0400 Subject: [PATCH 10/16] shortened description got rid of lexical variable at the top. I don't think I need it, it was inserted by auto-insert. moved Package-requires up with rest of package info. --- doi-utils.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doi-utils.el b/doi-utils.el index 74c0045..abfa943 100644 --- a/doi-utils.el +++ b/doi-utils.el @@ -1,9 +1,11 @@ -;;; doi-utils.el --- DOI utilities for making bibtex entries and downloading PDFs -*- lexical-binding: t; -*- +;;; doi-utils.el --- DOI utilities for making bibtex entries ;; Copyright (C) 2015 John Kitchin ;; Author: John Kitchin ;; Keywords: convenience +;; Version: 0.1 +;; Package-Requires: ((org-ref)) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -30,8 +32,6 @@ ;; - doi-utils-add-bibtex-entry-from-region to add an entry from a highlighed doi to your default bibliography. ;; - doi-utils-update-bibtex-entry-from-doi with cursor in an entry to update its fields. -;; Package-Requires: ((org-ref)) - (require 'json) ;;; Code: -- 2.39.2 From ca0d4bbfa864ceb371eef35f36987f8f9a7b7679 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Tue, 17 Mar 2015 18:48:05 -0400 Subject: [PATCH 11/16] fix typo in wiley-pdf left over comma from org-block escaping an *. --- doi-utils.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doi-utils.el b/doi-utils.el index abfa943..385785a 100644 --- a/doi-utils.el +++ b/doi-utils.el @@ -116,14 +116,15 @@ (defun doi-utils-get-wiley-pdf-url (redirect-url) - "wileyscience direct hides the pdf url in html. we get it out here" + "Wileyscience direct hides the pdf url in html. +We get it out here by parsing the html." (setq *doi-utils-waiting* t) (url-retrieve redirect-url (lambda (status) - (beginning-of-buffer) + (goto-char (point-min)) (re-search-forward "