Skip to content

org-ref gives "Wrong type argument: listp, 771" #1121

Open
@sprig

Description

@sprig

Hi,
Thanks for org-ref!

Running org-ref in an org buffer in emacs 29.2 gives the above messages. I traced the code and found the error originating in this function from org-ref:

;;** bad citations, labels, refs and files in orgfile
;;  These are used i
(defvar bibtex-files)
(defvar bibtex-file-path)
(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
         (bibtex-files (cl-loop for f in (org-ref-find-bibliography)
				if (file-exists-p f)
				collect (file-truename f)))
         (bibtex-file-path (mapconcat
                            (lambda (x)
                              (file-name-directory (file-truename x)))
                            bibtex-files ":"))
         (bibtex-keys (mapcar (lambda (x) (car x))
                              (bibtex-global-key-alist)))
         (bad-citations '()))

    (org-element-map (org-ref-parse-buffer) 'link
      (lambda (link)
        (let ((plist (nth 1 link)))
          (when (assoc (plist-get plist :type) org-ref-cite-types)
	    (when (not (string= "*" (plist-get plist :path)))
	      (cl-loop for ref in (plist-get (org-ref-parse-cite-path (plist-get plist :path)) :references)
		       do
		       (when (not (member (plist-get ref :key) bibtex-keys))
			 (goto-char (org-element-property :begin link))
			 (re-search-forward (plist-get ref :key))
			 (push (cons (plist-get ref :key) (point-marker)) bad-citations)))))))
      ;; add with-affiliates to get cites in caption
      nil nil nil t)
    (goto-char cp)
    bad-citations))

Specifically in this sexp:

         (mapcar (lambda (x) (car x))
                              (bibtex-global-key-alist))

It seems that the result from (bibtex-global-key-alist) is some function reference, rather than an alist.

Result: #f(compiled-function (string pred action) #<bytecode 0x1dfcf93f30d2e84b>)

Seems like a bug in bibtex, although I'm not sure - other functionality seems to work correctly, e.g. org-ref-insert-link. On the other hand, it seems that the only places this function is used inside bibtex is in bibtex-completion-at-point-function as well as bibtex-read-key which I assume helm overrides.

Any idea what's going on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions