tmalsburg/helm-bibtex

org-ref-helm-bibtex-insert-citation results in wrong type argument

Closed this issue · 3 comments

Hi everybody
This seems to be helm-bibtex related because calling the same function via org-ref-cite-insert-helm yields no error.

The symptom:

Call helm-bibtex, "Insert citation" --> citation gets inserted correctly, but minibuffer gives error message:

"Wrong type argument: char-or-string-p, nil"

Here is the backtrace:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
bibtex-completion-insert-citation(("white90"))
helm-bibtex-insert-citation("white90")
helm-execute-selection-action-1()
helm-execute-selection-action()
helm-internal((((name . "BibTeX entries") (header-name . #f(compiled-function (name) #<bytecode -0x23cf81210898ece>)) (candidates . helm-bibtex-candidates) (keymap keymap (f12 . #f(compiled-function () ... #<bytecode 0x1f4023ab11f280>)) (f11 . #f(compiled-function () ... #<bytecode 0x1f4023ab10e280>)) (f10 . #f(compiled-function () ... #<bytecode 0x1f4023ab16d280>)) (f9 . #f(compiled-function () ... #<bytecode 0x1f4023ab17c280>)) (f8 . #f(compiled-function () ... #<bytecode 0x1f4023ab1fb280>)) (f7 . #f(compiled-function () ... #<bytecode 0x1f4023ab1ea280>)) (f6 . #f(compiled-function () ... #<bytecode 0x1f4023ab129280>)) (f5 . #f(compiled-function () ... #<bytecode 0x1f4023ab138280>)) (f4 . #f(compiled-function () ... #<bytecode 0x1f4023ab257280>)) (f3 . #f(compiled-function () ... #<bytecode 0x1f4023ab246280>)) (f2 . #f(compiled-function () ... #<bytecode 0x1f4023ab3c5280>)) (menu-bar keymap (help-menu keymap ...)) (help keymap (109 . helm-help)) (23 . helm-helm-yank-text-at-point-with-subkeys) (f1 . #f(compiled-function () ... #<bytecode 0x1f4023ab3d4280>)) (8 keymap (109 . helm-help) (104 . undefined) (8 . undefined) (99 . helm-customize-group) (4 . helm-enable-or-switch-to-debug)) (20 . helm-toggle-resplit-and-swap-windows) (C-tab . undefined) (67108897 . helm-toggle-suspend-update) (3 keymap (57 . #f(compiled-function () ... #<bytecode -0x467a7f369771575>)) (56 . #f(compiled-function () ... #<bytecode -0x467a7f369472575>)) (55 . #f(compiled-function () ... #<bytecode -0x467a7f369463575>)) (54 . #f(compiled-function () ... #<bytecode -0x467a7f369444575>)) (53 . #f(compiled-function () ... #<bytecode -0x467a7f369455575>)) (52 . #f(compiled-function () ... #<bytecode -0x467a7f369436575>)) (51 . #f(compiled-function () ... #<bytecode -0x467a7f369427575>)) (50 . #f(compiled-function () ... #<bytecode -0x467a7f3694d8575>)) (49 . #f(compiled-function () ... #<bytecode -0x467a7f3694c9575>)) (110 . helm-helm-run-cycle-resume-with-subkeys) (108 . helm-display-line-numbers-mode) (62 . helm-toggle-truncate-line) (21 . helm-refresh) (6 . helm-follow-mode) (9 . helm-insert-or-copy) (11 . helm-kill-selection-and-quit) (25 . helm-yank-selection) (37 . helm-exchange-minibuffer-and-header-line) (95 . helm-toggle-full-frame) (45 . helm-swap-windows)) (67108987 . helm-enlarge-window) (67108989 . helm-narrow-window) (19 . undefined) (24 keymap (57 . #f(compiled-function () ... #<bytecode -0x467aab7b0531575>)) (56 . #f(compiled-function () ... #<bytecode -0x467aab7b04b2575>)) (55 . #f(compiled-function () ... #<bytecode -0x467aab7b04a3575>)) (54 . #f(compiled-function () ... #<bytecode -0x467aab7b0484575>)) (53 . #f(compiled-function () ... #<bytecode -0x467aab7b0495575>)) (52 . #f(compiled-function () ... #<bytecode -0x467aab7b04f6575>)) (51 . #f(compiled-function () ... #<bytecode -0x467aab7b04e7575>)) (50 . #f(compiled-function () ... #<bytecode -0x467aab7b0418575>)) (49 . #f(compiled-function () ... #<bytecode -0x467aab7b0409575>)) (2 . helm-resume-list-buffers-after-quit) (98 . helm-resume-previous-session-after-quit) (6 . helm-quit-and-find-file)) (11 . helm-delete-minibuffer-contents) (67108896 . helm-toggle-visible-mark-forward) (0 . helm-toggle-visible-mark) (C-M-up . helm-scroll-other-window-down) (C-M-down . helm-scroll-other-window) (M-prior . helm-scroll-other-window-down) (M-next . helm-scroll-other-window) (12 . helm-recenter-top-bottom-other-window) (left . helm-previous-source) (right . helm-next-source) (15 . helm-next-source) (10 . helm-execute-persistent-action) ...) (action ("Insert citation" . helm-bibtex-insert-citation) ("Open PDF, URL or DOI" . helm-bibtex-open-any) ("Edit notes" . helm-bibtex-edit-notes) ("Show entry" . helm-bibtex-show-entry)) (requires-pattern . 0) (filtered-candidate-transformer helm-bibtex-candidates-formatter helm-fuzzy-highlight-matches) (match helm-mm-exact-match helm-mm-match) (redisplay . identity) (header-line . #("C-j: Open PDF, URL or DOI (keeping ses..." 0 3 (font-lock-face help-key-binding face help-key-binding))) (multimatch . t) (group . helm)) ((name . "Fallback options") (match (lambda (_candidate) t)) (candidates . bibtex-completion-fallback-candidates) (no-matchplugin) (nohighlight) (action lambda (candidate) (bibtex-completion-fallback-action candidate helm-pattern)))) nil nil nil #f(compiled-function () #<bytecode 0x8014681c137949f>) "helm bibtex" nil nil nil)
apply(helm-internal ((((name . "BibTeX entries") (header-name . #f(compiled-function (name) #<bytecode -0x23cf81210898ece>)) (candidates . helm-bibtex-candidates) (keymap keymap (f12 . #f(compiled-function () ... #<bytecode 0x1f4023ab11f280>)) (f11 . #f(compiled-function () ... #<bytecode 0x1f4023ab10e280>)) (f10 . #f(compiled-function () ... #<bytecode 0x1f4023ab16d280>)) (f9 . #f(compiled-function () ... #<bytecode 0x1f4023ab17c280>)) (f8 . #f(compiled-function () ... #<bytecode 0x1f4023ab1fb280>)) (f7 . #f(compiled-function () ... #<bytecode 0x1f4023ab1ea280>)) (f6 . #f(compiled-function () ... #<bytecode 0x1f4023ab129280>)) (f5 . #f(compiled-function () ... #<bytecode 0x1f4023ab138280>)) (f4 . #f(compiled-function () ... #<bytecode 0x1f4023ab257280>)) (f3 . #f(compiled-function () ... #<bytecode 0x1f4023ab246280>)) (f2 . #f(compiled-function () ... #<bytecode 0x1f4023ab3c5280>)) (menu-bar keymap ...) (help keymap ...) (23 . helm-helm-yank-text-at-point-with-subkeys) (f1 . #f(compiled-function () ... #<bytecode 0x1f4023ab3d4280>)) (8 keymap ... ... ... ... ...) (20 . helm-toggle-resplit-and-swap-windows) (C-tab . undefined) (67108897 . helm-toggle-suspend-update) (3 keymap ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (67108987 . helm-enlarge-window) (67108989 . helm-narrow-window) (19 . undefined) (24 keymap ... ... ... ... ... ... ... ... ... ... ... ...) (11 . helm-delete-minibuffer-contents) (67108896 . helm-toggle-visible-mark-forward) (0 . helm-toggle-visible-mark) (C-M-up . helm-scroll-other-window-down) (C-M-down . helm-scroll-other-window) (M-prior . helm-scroll-other-window-down) (M-next . helm-scroll-other-window) (12 . helm-recenter-top-bottom-other-window) (left . helm-previous-source) (right . helm-next-source) (15 . helm-next-source) (10 . helm-execute-persistent-action) ...) (action ("Insert citation" . helm-bibtex-insert-citation) ("Open PDF, URL or DOI" . helm-bibtex-open-any) ("Edit notes" . helm-bibtex-edit-notes) ("Show entry" . helm-bibtex-show-entry)) (requires-pattern . 0) (filtered-candidate-transformer helm-bibtex-candidates-formatter helm-fuzzy-highlight-matches) (match helm-mm-exact-match helm-mm-match) (redisplay . identity) (header-line . #("C-j: Open PDF, URL or DOI (keeping ses..." 0 3 ...)) (multimatch . t) (group . helm)) ((name . "Fallback options") (match (lambda ... t)) (candidates . bibtex-completion-fallback-candidates) (no-matchplugin) (nohighlight) (action lambda (candidate) (bibtex-completion-fallback-action candidate helm-pattern)))) nil nil nil #f(compiled-function () #<bytecode 0x8014681c137949f>) "helm bibtex" nil nil nil))
helm((((name . "BibTeX entries") (header-name . #f(compiled-function (name) #<bytecode -0x23cf81210898ece>)) (candidates . helm-bibtex-candidates) (keymap keymap (f12 . #f(compiled-function () ... #<bytecode 0x1f4023ab11f280>)) (f11 . #f(compiled-function () ... #<bytecode 0x1f4023ab10e280>)) (f10 . #f(compiled-function () ... #<bytecode 0x1f4023ab16d280>)) (f9 . #f(compiled-function () ... #<bytecode 0x1f4023ab17c280>)) (f8 . #f(compiled-function () ... #<bytecode 0x1f4023ab1fb280>)) (f7 . #f(compiled-function () ... #<bytecode 0x1f4023ab1ea280>)) (f6 . #f(compiled-function () ... #<bytecode 0x1f4023ab129280>)) (f5 . #f(compiled-function () ... #<bytecode 0x1f4023ab138280>)) (f4 . #f(compiled-function () ... #<bytecode 0x1f4023ab257280>)) (f3 . #f(compiled-function () ... #<bytecode 0x1f4023ab246280>)) (f2 . #f(compiled-function () ... #<bytecode 0x1f4023ab3c5280>)) (menu-bar keymap (help-menu keymap ...)) (help keymap (109 . helm-help)) (23 . helm-helm-yank-text-at-point-with-subkeys) (f1 . #f(compiled-function () ... #<bytecode 0x1f4023ab3d4280>)) (8 keymap (109 . helm-help) (104 . undefined) (8 . undefined) (99 . helm-customize-group) (4 . helm-enable-or-switch-to-debug)) (20 . helm-toggle-resplit-and-swap-windows) (C-tab . undefined) (67108897 . helm-toggle-suspend-update) (3 keymap (57 . #f(compiled-function () ... #<bytecode -0x467a7f369771575>)) (56 . #f(compiled-function () ... #<bytecode -0x467a7f369472575>)) (55 . #f(compiled-function () ... #<bytecode -0x467a7f369463575>)) (54 . #f(compiled-function () ... #<bytecode -0x467a7f369444575>)) (53 . #f(compiled-function () ... #<bytecode -0x467a7f369455575>)) (52 . #f(compiled-function () ... #<bytecode -0x467a7f369436575>)) (51 . #f(compiled-function () ... #<bytecode -0x467a7f369427575>)) (50 . #f(compiled-function () ... #<bytecode -0x467a7f3694d8575>)) (49 . #f(compiled-function () ... #<bytecode -0x467a7f3694c9575>)) (110 . helm-helm-run-cycle-resume-with-subkeys) (108 . helm-display-line-numbers-mode) (62 . helm-toggle-truncate-line) (21 . helm-refresh) (6 . helm-follow-mode) (9 . helm-insert-or-copy) (11 . helm-kill-selection-and-quit) (25 . helm-yank-selection) (37 . helm-exchange-minibuffer-and-header-line) (95 . helm-toggle-full-frame) (45 . helm-swap-windows)) (67108987 . helm-enlarge-window) (67108989 . helm-narrow-window) (19 . undefined) (24 keymap (57 . #f(compiled-function () ... #<bytecode -0x467aab7b0531575>)) (56 . #f(compiled-function () ... #<bytecode -0x467aab7b04b2575>)) (55 . #f(compiled-function () ... #<bytecode -0x467aab7b04a3575>)) (54 . #f(compiled-function () ... #<bytecode -0x467aab7b0484575>)) (53 . #f(compiled-function () ... #<bytecode -0x467aab7b0495575>)) (52 . #f(compiled-function () ... #<bytecode -0x467aab7b04f6575>)) (51 . #f(compiled-function () ... #<bytecode -0x467aab7b04e7575>)) (50 . #f(compiled-function () ... #<bytecode -0x467aab7b0418575>)) (49 . #f(compiled-function () ... #<bytecode -0x467aab7b0409575>)) (2 . helm-resume-list-buffers-after-quit) (98 . helm-resume-previous-session-after-quit) (6 . helm-quit-and-find-file)) (11 . helm-delete-minibuffer-contents) (67108896 . helm-toggle-visible-mark-forward) (0 . helm-toggle-visible-mark) (C-M-up . helm-scroll-other-window-down) (C-M-down . helm-scroll-other-window) (M-prior . helm-scroll-other-window-down) (M-next . helm-scroll-other-window) (12 . helm-recenter-top-bottom-other-window) (left . helm-previous-source) (right . helm-next-source) (15 . helm-next-source) (10 . helm-execute-persistent-action) ...) (action ("Insert citation" . helm-bibtex-insert-citation) ("Open PDF, URL or DOI" . helm-bibtex-open-any) ("Edit notes" . helm-bibtex-edit-notes) ("Show entry" . helm-bibtex-show-entry)) (requires-pattern . 0) (filtered-candidate-transformer helm-bibtex-candidates-formatter helm-fuzzy-highlight-matches) (match helm-mm-exact-match helm-mm-match) (redisplay . identity) (header-line . #("C-j: Open PDF, URL or DOI (keeping ses..." 0 3 (font-lock-face help-key-binding face help-key-binding))) (multimatch . t) (group . helm)) ((name . "Fallback options") (match (lambda (_candidate) t)) (candidates . bibtex-completion-fallback-candidates) (no-matchplugin) (nohighlight) (action lambda (candidate) (bibtex-completion-fallback-action candidate helm-pattern)))) nil nil nil #f(compiled-function () #<bytecode 0x8014681c137949f>) "helm bibtex" nil nil nil)
apply(helm ((((name . "BibTeX entries") (header-name . #f(compiled-function (name) #<bytecode -0x23cf81210898ece>)) (candidates . helm-bibtex-candidates) (keymap keymap (f12 . #f(compiled-function () ... #<bytecode 0x1f4023ab11f280>)) (f11 . #f(compiled-function () ... #<bytecode 0x1f4023ab10e280>)) (f10 . #f(compiled-function () ... #<bytecode 0x1f4023ab16d280>)) (f9 . #f(compiled-function () ... #<bytecode 0x1f4023ab17c280>)) (f8 . #f(compiled-function () ... #<bytecode 0x1f4023ab1fb280>)) (f7 . #f(compiled-function () ... #<bytecode 0x1f4023ab1ea280>)) (f6 . #f(compiled-function () ... #<bytecode 0x1f4023ab129280>)) (f5 . #f(compiled-function () ... #<bytecode 0x1f4023ab138280>)) (f4 . #f(compiled-function () ... #<bytecode 0x1f4023ab257280>)) (f3 . #f(compiled-function () ... #<bytecode 0x1f4023ab246280>)) (f2 . #f(compiled-function () ... #<bytecode 0x1f4023ab3c5280>)) (menu-bar keymap ...) (help keymap ...) (23 . helm-helm-yank-text-at-point-with-subkeys) (f1 . #f(compiled-function () ... #<bytecode 0x1f4023ab3d4280>)) (8 keymap ... ... ... ... ...) (20 . helm-toggle-resplit-and-swap-windows) (C-tab . undefined) (67108897 . helm-toggle-suspend-update) (3 keymap ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (67108987 . helm-enlarge-window) (67108989 . helm-narrow-window) (19 . undefined) (24 keymap ... ... ... ... ... ... ... ... ... ... ... ...) (11 . helm-delete-minibuffer-contents) (67108896 . helm-toggle-visible-mark-forward) (0 . helm-toggle-visible-mark) (C-M-up . helm-scroll-other-window-down) (C-M-down . helm-scroll-other-window) (M-prior . helm-scroll-other-window-down) (M-next . helm-scroll-other-window) (12 . helm-recenter-top-bottom-other-window) (left . helm-previous-source) (right . helm-next-source) (15 . helm-next-source) (10 . helm-execute-persistent-action) ...) (action ("Insert citation" . helm-bibtex-insert-citation) ("Open PDF, URL or DOI" . helm-bibtex-open-any) ("Edit notes" . helm-bibtex-edit-notes) ("Show entry" . helm-bibtex-show-entry)) (requires-pattern . 0) (filtered-candidate-transformer helm-bibtex-candidates-formatter helm-fuzzy-highlight-matches) (match helm-mm-exact-match helm-mm-match) (redisplay . identity) (header-line . #("C-j: Open PDF, URL or DOI (keeping ses..." 0 3 ...)) (multimatch . t) (group . helm)) ((name . "Fallback options") (match (lambda ... t)) (candidates . bibtex-completion-fallback-candidates) (no-matchplugin) (nohighlight) (action lambda (candidate) (bibtex-completion-fallback-action candidate helm-pattern)))) nil nil nil #f(compiled-function () #<bytecode 0x8014681c137949f>) "helm bibtex" nil nil nil))
helm(:sources ((... ... ... ... ... ... ... ... ... ... ... ...) (... ... ... ... ... ...)) :full-frame t :buffer "helm bibtex" :input nil :preselect #f(compiled-function () #<bytecode 0x8014681c137949f>) :candidate-number-limit 500 :bibtex-candidates (("Buddhismus, China, G..." ... ... ... ... ... ...) ("⌘ Buddhismus, China,..." ... ... ... ... ... ... ...) ("⌘ Pali, Singhalesisc..." ... ... ... ... ... ... ...) ("white87 The Value of..." ... ... ... ... ... ... ...) ("white85 Historicism,..." ... ... ... ... ... ... ...) ("deeg08 Mongolische G..." ... ... ... ... ... ... ... ... ... ...) ("Buddhismus, Japan 19..." ... ... ... ... ... ...) ("Buddhismus 2005 Hans..." ... ... ... ... ... ...) ("Häresie 1983 Toward ..." ... ... ... ... ... ...) ("Religionswissenschaf..." ... ... ... ... ... ...) ("⌘ Buddhismus, Südind..." ... ... ... ... ... ... ...) ("Forthcoming Unüberse..." ... ... ... ... ...) ("peer zander23 Glaube..." ... ... ... ... ... ... ... ... ...) ("Religionswissenschaf..." ... ... ... ... ... ...) ("⌘ Sri-Lanka, Histori..." ... ... ... ... ... ... ...) ("miyaji13 Buddhist Na..." ... ... ... ... ... ... ... ...) ("froehlich05 Vajrapāṇ..." ... ... ... ... ... ... ... ...) ("1998 Tibet, China, G..." ... ... ... ... ... ...) ("2006 Buddhism and Vi..." ... ... ... ... ...) ("Tamilen, SchwarzeMad..." ... ... ... ... ... ...) ...) :bibtex-local-bib nil)
helm-bibtex(nil)
funcall-interactively(helm-bibtex nil)
call-interactively(helm-bibtex nil nil)
command-execute(helm-bibtex)

Here is my config (some variables defined twice, I'm just messing with my config file at the moment; lib-paths is a variable defined elsewhere)

(use-package org-ref
:ensure t)
(setq bibtex-completion-bibliography "/home/sven/aktuell/library/biblio.bib"
bibtex-completion-notes-path "/home/sven/aktuell/library/RoamNotes/"
bibtex-completion-pdf-field "file"
bibtex-completion-additional-search-fields '(keywords)
bibtex-completion-library-path lib-paths
bibtex-completion-notes-template-multiple-files
(concat
"#+TITLE: ${title}\n"
"#+ROAM_KEY: cite:${=key=}\n"
"* TODO Notes\n"
":PROPERTIES:\n"
":Custom_ID: ${=key=}\n"
":NOTER_DOCUMENT: %(orb-process-file-field "${=key=}")\n"
":AUTHOR: ${author-abbrev}\n"
":JOURNAL: ${journaltitle}\n"
":DATE: ${date}\n"
":YEAR: ${year}\n"
":DOI: ${doi}\n"
":URL: ${url}\n"
":END:\n\n"))

(require 'org-ref)
(require 'org-ref-helm)
(define-key org-mode-map (kbd "C-c Z") 'org-ref-cite-insert-helm)

(use-package helm-bibtex
:ensure t
:bind ("C-c z" . helm-bibtex))

(setq bibtex-completion-bibliography "/home/sven/aktuell/library/biblio.bib"
bibtex-completion-notes-path "/home/sven/aktuell/library/RoamNotes/"
bibtex-completion-pdf-field "file"
bibtex-completion-additional-search-fields '(keywords)
bibtex-completion-library-path lib-paths
bibtex-completion-notes-template-multiple-files
(concat
"#+TITLE: ${title}\n"
"#+ROAM_KEY: cite:${=key=}\n"
"* TODO Notes\n"
":PROPERTIES:\n"
":Custom_ID: ${=key=}\n"
":NOTER_DOCUMENT: %(orb-process-file-field "${=key=}")\n"
":AUTHOR: ${author-abbrev}\n"
":JOURNAL: ${journaltitle}\n"
":DATE: ${date}\n"
":YEAR: ${year}\n"
":DOI: ${doi}\n"
":URL: ${url}\n"
":END:\n\n"))

(setq bibtex-completion-format-citation-functions
'((org-mode . org-ref-helm-bibtex-insert-citation)
(latex-mode . bibtex-completion-format-citation-cite)
(markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
(default . bibtex-completion-format-citation-default)))

Perhaps I'm missing something but org-ref-helm-bibtex-insert-citation is not part of this package. I'd ask the org-ref devs about this.

True. That's why I hesitated to post the question here. On the other hand, the function is working in the org-ref context. Only the interplay with helm-bibtex causes the error. So John Kitchen will probably send me back here.

It's no big deal. Since the problem does not seem to occur to other users and even I can work and live with it. The cause may be my configuration anyway. I will try with a minimal init file and see what happens. If the error still occurs, I'll report to the org-mode list. If nothing helps I have to get back here. If I find a solution, I'll also post it here so that the thread can be closed.

Ah, okay. Unfortunately, I don't know anything about the inner workings of org-ref and I won't have time to look into this. Perhaps you can use the helm-bibtex function for org-cite and adapt it to org-ref syntax? Sorry, that's the best suggestion that I can give at that point.