Skip to content

Instantly share code, notes, and snippets.

@divinenephron
Last active August 29, 2015 14:15
Show Gist options
  • Save divinenephron/32b29f1a75bd103e7037 to your computer and use it in GitHub Desktop.
Save divinenephron/32b29f1a75bd103e7037 to your computer and use it in GitHub Desktop.
org-ref issue #7
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
looking-at(nil)
bibtex-parse-entry(t)
(let* ((--cl-var-- (bibtex-parse-entry t)) (value nil) (key nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (push (cons (downcase key) value) --cl-var--) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--))
(catch (quote --cl-block-nil--) (let* ((--cl-var-- (bibtex-parse-entry t)) (value nil) (key nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (push (cons (downcase key) value) --cl-var--) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))
(cl--block-wrapper (catch (quote --cl-block-nil--) (let* ((--cl-var-- (bibtex-parse-entry t)) (value nil) (key nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (push (cons (downcase key) value) --cl-var--) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--))))
(cl-block nil (let* ((--cl-var-- (bibtex-parse-entry t)) (value nil) (key nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq value (car --cl-var--) key (pop value)) (push (cons (downcase key) value) --cl-var--) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))
(loop for (key . value) in (bibtex-parse-entry t) collect (cons (downcase key) value))
(let* ((cb (current-buffer)) (bibtex-expand-strings t) (entry (loop for (key . value) in (bibtex-parse-entry t) collect (cons (downcase key) value))) (title (replace-regexp-in-string "\n\\| \\| +" " " (reftex-get-bib-field "title" entry))) (year (reftex-get-bib-field "year" entry)) (author (replace-regexp-in-string "\n\\| \\| +" " " (reftex-get-bib-field "author" entry))) (key (reftex-get-bib-field "=key=" entry)) (journal (reftex-get-bib-field "journal" entry)) (volume (reftex-get-bib-field "volume" entry)) (pages (reftex-get-bib-field "pages" entry)) (doi (reftex-get-bib-field "doi" entry)) (url (reftex-get-bib-field "url" entry))) (format "%s, \"%s\", %s, %s:%s (%s)" author title journal volume pages year))
org-ref-bib-citation()
(progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation))
(unwind-protect (progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
(let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
(save-excursion (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
(if bibfile (save-excursion (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) "!!! No entry found !!!")
(let* ((results (org-ref-get-bibtex-key-and-file)) (key (car results)) (bibfile (cdr results))) (if bibfile (save-excursion (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents bibfile) (bibtex-search-entry key) (org-ref-bib-citation)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) "!!! No entry found !!!"))
org-ref-get-citation-string-at-point()
(message (org-ref-get-citation-string-at-point))
(cond ((-contains\? org-ref-cite-types type) (message (org-ref-get-citation-string-at-point))) ((string= type "ref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "eqref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "label") (let ((count (org-ref-count-labels (org-element-property :path object)))) (message (concat (number-to-string count) " occurence" (if (or (= count 0) (> count 1)) (progn "s")))))) ((string= type "custom-id") (save-excursion (org-open-link-from-string (format "[[#%s]]" (org-element-property :path object))) (message "%s" (org-get-heading)))) ((string= type "bibliography") (let* ((bibfile) (object (org-element-context)) (link-string (org-element-property :path object)) (link-string-beginning) (link-string-end)) (save-excursion (goto-char (org-element-property :begin object)) (search-forward link-string nil nil 1) (setq link-string-beginning (match-beginning 0)) (setq link-string-end (match-end 0))) (if (> link-string-beginning (point)) (progn (goto-char link-string-beginning))) (save-excursion (if (search-forward "," link-string-end 1 1) (setq key-end (- (match-end 0) 1)) (setq key-end (point)))) (save-excursion (if (search-backward "," link-string-beginning 1 1) (setq key-beginning (+ (match-beginning 0) 1)) (setq key-beginning (point)))) (setq bibfile (org-ref-strip-string (buffer-substring key-beginning key-end))) (if (file-exists-p bibfile) (message "%s exists." bibfile) (message "!!! %s NOT FOUND !!!" bibfile)))))
(save-excursion (cond ((-contains\? org-ref-cite-types type) (message (org-ref-get-citation-string-at-point))) ((string= type "ref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "eqref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "label") (let ((count (org-ref-count-labels (org-element-property :path object)))) (message (concat (number-to-string count) " occurence" (if (or ... ...) (progn "s")))))) ((string= type "custom-id") (save-excursion (org-open-link-from-string (format "[[#%s]]" (org-element-property :path object))) (message "%s" (org-get-heading)))) ((string= type "bibliography") (let* ((bibfile) (object (org-element-context)) (link-string (org-element-property :path object)) (link-string-beginning) (link-string-end)) (save-excursion (goto-char (org-element-property :begin object)) (search-forward link-string nil nil 1) (setq link-string-beginning (match-beginning 0)) (setq link-string-end (match-end 0))) (if (> link-string-beginning (point)) (progn (goto-char link-string-beginning))) (save-excursion (if (search-forward "," link-string-end 1 1) (setq key-end (- ... 1)) (setq key-end (point)))) (save-excursion (if (search-backward "," link-string-beginning 1 1) (setq key-beginning (+ ... 1)) (setq key-beginning (point)))) (setq bibfile (org-ref-strip-string (buffer-substring key-beginning key-end))) (if (file-exists-p bibfile) (message "%s exists." bibfile) (message "!!! %s NOT FOUND !!!" bibfile))))))
(let* ((object (org-element-context)) (type (org-element-property :type object))) (save-excursion (cond ((-contains\? org-ref-cite-types type) (message (org-ref-get-citation-string-at-point))) ((string= type "ref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "eqref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "label") (let ((count (org-ref-count-labels ...))) (message (concat (number-to-string count) " occurence" (if ... ...))))) ((string= type "custom-id") (save-excursion (org-open-link-from-string (format "[[#%s]]" (org-element-property :path object))) (message "%s" (org-get-heading)))) ((string= type "bibliography") (let* ((bibfile) (object (org-element-context)) (link-string (org-element-property :path object)) (link-string-beginning) (link-string-end)) (save-excursion (goto-char (org-element-property :begin object)) (search-forward link-string nil nil 1) (setq link-string-beginning (match-beginning 0)) (setq link-string-end (match-end 0))) (if (> link-string-beginning (point)) (progn (goto-char link-string-beginning))) (save-excursion (if (search-forward "," link-string-end 1 1) (setq key-end ...) (setq key-end ...))) (save-excursion (if (search-backward "," link-string-beginning 1 1) (setq key-beginning ...) (setq key-beginning ...))) (setq bibfile (org-ref-strip-string (buffer-substring key-beginning key-end))) (if (file-exists-p bibfile) (message "%s exists." bibfile) (message "!!! %s NOT FOUND !!!" bibfile)))))))
(progn (let* ((object (org-element-context)) (type (org-element-property :type object))) (save-excursion (cond ((-contains\? org-ref-cite-types type) (message (org-ref-get-citation-string-at-point))) ((string= type "ref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "eqref") (message "%scount: %s" (org-ref-get-label-context (org-element-property :path object)) (org-ref-count-labels (org-element-property :path object)))) ((string= type "label") (let ((count ...)) (message (concat ... " occurence" ...)))) ((string= type "custom-id") (save-excursion (org-open-link-from-string (format "[[#%s]]" ...)) (message "%s" (org-get-heading)))) ((string= type "bibliography") (let* ((bibfile) (object ...) (link-string ...) (link-string-beginning) (link-string-end)) (save-excursion (goto-char ...) (search-forward link-string nil nil 1) (setq link-string-beginning ...) (setq link-string-end ...)) (if (> link-string-beginning ...) (progn ...)) (save-excursion (if ... ... ...)) (save-excursion (if ... ... ...)) (setq bibfile (org-ref-strip-string ...)) (if (file-exists-p bibfile) (message "%s exists." bibfile) (message "!!! %s NOT FOUND !!!" bibfile))))))))
(if (eq major-mode (quote org-mode)) (progn (let* ((object (org-element-context)) (type (org-element-property :type object))) (save-excursion (cond ((-contains\? org-ref-cite-types type) (message (org-ref-get-citation-string-at-point))) ((string= type "ref") (message "%scount: %s" (org-ref-get-label-context ...) (org-ref-count-labels ...))) ((string= type "eqref") (message "%scount: %s" (org-ref-get-label-context ...) (org-ref-count-labels ...))) ((string= type "label") (let (...) (message ...))) ((string= type "custom-id") (save-excursion (org-open-link-from-string ...) (message "%s" ...))) ((string= type "bibliography") (let* (... ... ... ... ...) (save-excursion ... ... ... ...) (if ... ...) (save-excursion ...) (save-excursion ...) (setq bibfile ...) (if ... ... ...))))))))
org-ref-link-message()
apply(org-ref-link-message nil)
byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
timer-event-handler([t 0 0 500000 t org-ref-link-message nil idle 0])
(source gnu)
(source melpa)
(depends-on "bind-key")
(depends-on "cask")
(depends-on "helm")
(depends-on "helm-bibtex")
(depends-on "ebib")
(depends-on "s")
(depends-on "f")
(depends-on "hydra")
(depends-on "org-ref" :git "https://github.com/jkitchin/org-ref.git" :files ("*"))
;; To reproduce org-ref issue #7:
;; export EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
;; git clone https://gist.github.com/32b29f1a75bd103e7037.git org-ref-issue-7
;; cd org-ref-issue-7
;; cask install
;; cask exec $EMACS -Q -l init.el test.org
;; Then:
;; TAB
;; C-n
;; C-n
;; C-c C-o
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")
(require 'cask)
(cask-initialize)
(setq org-ref-path (file-name-directory (locate-library "org-ref.org")))
;; Load org-ref
(let ((default-directory org-ref-path))
(org-babel-load-file (expand-file-name "org-ref.org" org-ref-path)))
(add-to-list 'org-ref-default-bibliography (expand-file-name "./test.bib"))
-*- mode:bibtex; bibtex-dialect: biblatex -*-
@book{abelson:1996,
edition = 2,
title = {Structure and Interpretation of Computer Programs},
publisher = {{MIT} Press},
author = {Abelson, Harold and Sussman, Gerald Jay and Sussman,
Julie},
year = 1996,
}

SICP

parencite:abelson:1996

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment