X-Git-Url: https://git.donarmstrong.com/?p=org-ref.git;a=blobdiff_plain;f=org-ref.org;h=c59d8d10b60b79c78f03b16d84479a6a6767af02;hp=e4fc35b1315a3c2fd0ac7d6ffe73b25669252057;hb=1640b223fedc30e829bea58d949881d27894b572;hpb=2f9fe18ffe8259b04340de034032eceda6516ec7 diff --git a/org-ref.org b/org-ref.org index e4fc35b..c59d8d1 100644 --- a/org-ref.org +++ b/org-ref.org @@ -2047,7 +2047,6 @@ And at the end of the document put \makeglossaries. #+END_SRC - * Utilities ** create simple text citation from bibtex entry @@ -2677,9 +2676,7 @@ Sometimes it may be helpful to manually change the order of citations. These fun #+END_SRC ** Lightweight messages about links -To get a lighter weight message about the label, ref and cite links, we define a function that gives us the minibuffer message, without the menu. We add it to a hook that updates after every command, including cursor movements. - -ref:test citep:test label:rett +To get a lighter weight message about the label, ref and cite links, we define a function that gives us the minibuffer message, without the menu. We run this in an idle timer. #+BEGIN_SRC emacs-lisp :tangle org-ref.el (defun org-ref-get-label-context (label) @@ -2738,34 +2735,35 @@ ref:test citep:test label:rett (defun org-ref-link-message () "Print a minibuffer message about the link that point is on." (interactive) - (let* ((object (org-element-context)) - (type (org-element-property :type object))) - (save-excursion - (cond - ;; cite links - ((-contains? org-ref-cite-types type) - (message (org-ref-get-citation-string-at-point))) - - ;; message some context about the label we are referring to - ((string= type "ref") - (message (org-ref-get-label-context - (org-element-property :path object)))) - - ((string= type "eqref") - (message (org-ref-get-label-context - (org-element-property :path object)))) - - ;; message the count - ((string= type "label") - (let ((count (org-ref-count-labels + (when (eq major-mode 'org-mode) + (let* ((object (org-element-context)) + (type (org-element-property :type object))) + (save-excursion + (cond + ;; cite links + ((-contains? org-ref-cite-types type) + (message (org-ref-get-citation-string-at-point))) + + ;; message some context about the label we are referring to + ((string= type "ref") + (message (org-ref-get-label-context + (org-element-property :path object)))) + + ((string= type "eqref") + (message (org-ref-get-label-context (org-element-property :path object)))) - ;; get plurality on occurrence correct - (message (concat - (number-to-string count) - " occurence" - (when (or (= count 0) - (> count 1)) - "s"))))))))) + + ;; message the count + ((string= type "label") + (let ((count (org-ref-count-labels + (org-element-property :path object)))) + ;; get plurality on occurrence correct + (message (concat + (number-to-string count) + " occurence" + (when (or (= count 0) + (> count 1)) + "s")))))))))) #+END_SRC * Aliases @@ -2821,7 +2819,7 @@ Technically, this function should return a string that is inserted by helm. This (-contains? org-ref-cite-types (org-element-property :type object))) - (message-box "in a link") + ;;(message-box "in a link") (goto-char (org-element-property :end object)) ;; sometimes there are spaces at the end of the link ;; this code moves point pack until no spaces are there @@ -2836,14 +2834,14 @@ Technically, this function should return a string that is inserted by helm. This (-contains? org-ref-cite-types (org-element-property :type (org-element-context))))) - (message-box "at end of a link") + ;;(message-box "at end of a link") ;; (goto-char (org-element-property :end object)) (while (looking-back " ") (backward-char)) (insert (concat "," (mapconcat 'identity keys ",")))) ;; insert fresh link (t - (message-box "fresh link") + ;;(message-box "fresh link") (insert (concat (if helm-current-prefix-arg (helm :sources `((name . "link types") @@ -2865,6 +2863,11 @@ Technically, this function should return a string that is inserted by helm. This (helm-bibtex))) (require 'helm-bibtex) + +(mapc (lambda (x) (add-to-list 'helm-bibtex-fallback-options x t)) + '(("Crossref" . "http://search.crossref.org/?q=%s") + ("Scopus" . "http://www.scopus.com/scopus/search/submit/xadvanced.url?searchfield=TITLE-ABS-KEY(%s)") + ("Open Web of Science" . (lambda () (browse-url "http://apps.webofknowledge.com"))))) #+END_SRC ** A helm click menu