2
votes

Org 8.2.10 Emacs 24.4.1

I have a bibtex entry in the scratch buffer, then M-w the entry.

It's in the kill-ring

I then swap to an org-mode buffer and try

M org-bibtex-yank

I receive an error: Wrong type argument: stringp, nil

I've toggled-debug-on-error and the backtrace is below. I have checked that the entry is on the kill-ring - I can yank it to a scratch buffer.

I've set debug-on-entry for org-bibtex-yank, and went a long way down the rabbit hole! I can see the entry in some steps of the debugger, but got lost!

I'd be grateful for any pointers on either the problem, or getting more information that might help.

thanks

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
looking-at(nil)
bibtex-parse-entry()
org-bibtex-read()
org-bibtex-yank()
call-interactively(org-bibtex-yank record nil)
command-execute(org-bibtex-yank record)
execute-extended-command(nil "org-bibtex-yank")
smex-read-and-run(("toggle-debug-on-error" "org-bibtex-yank" "debug-on-entry" "describe-function" "apropos" "set-variable" "package-list-packages" "load-theme" "describe-variable" "bibtex-yank" "eshell" "package-refresh-contents" "yank" "org-mode" "org-bibtex" "flyspell-mode" "server-force-delete" "org-bibtex-read-buffer" "R" "S" "S+" "cd" "dm" "5x5" "S+3" "S+6" "SAS" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "Sqpe" "calc" "diff" "dirs" "ffap" "gnus" ...))
smex()
call-interactively(smex nil nil)
command-execute(smex)
1
I can't reproduce this. Did you select the bibtex entry (highlight it) with the mouse before M-w? When I do that org-bibtex-yank works fine. - John Kitchin
Thanks John. No, I selected it with the keyboard. Mark and point. I'll try with the mouse! - user2162871

1 Answers

1
votes

I know this issue "org-bibtex-yank fails with Wrong type argument: stringp, nil". Especially I can't paste an bibtex-entry from the web and paste it to an Org file via org-bibtex-yank.

My current work around:

  • Open in Emacs buffer for the bibtex mode. May be you use a dummy.bib
  • In bibtex-mode buffer call M-x bibtex-set-dialect
  • Choose either bibtex or biblatex

Now I paste the bibtex-entry to the bib-file and check the behavior: - Mark and copy via M-w a bibentry in the bibtex-mode buffer - Change to your Org file - Use there M-x org-bibtex-yank.

Typically now it works.

The issue seems to be that bibtex-parse-entry requires that bibtex-set-dialect is called before calling it.

Unfortunately you can't do a (simple) file variable in a bibtex file. M-x add-file-local-variable for variable bibtex and value either bibtex or biblatex won't work. As bibtex.el does not support this.

Try in Org file

# Local Variables:
# eval: (bibtex-set-dialect 'biblatex)
# End:

Try in bibtex file

M-x add-file-local-variable

and replace the line

bibtex: biblatex

by

eval: (bibtex-set-dialect 'biblatex)

Or read:

https://tex.stackexchange.com/questions/78455/does-emacs-support-editing-bibliography-files-for-biblatex