org-roam / org-roam-bibtex

Org Roam integration with bibliography management software
GNU General Public License v3.0
572 stars 47 forks source link

orb-file-field-extensions is being ignored #164

Closed PhDyellow closed 3 years ago

PhDyellow commented 3 years ago

Describe the bug orb-file-field-extensions is being ignored. I am being asked to choose between a pdf and a html file, even though I have (setq orb-file-field-extensions "pdf") in my config.

To Reproduce Steps to reproduce the behavior:

  1. include (setq orb-file-field-extensions "pdf") in my config file.
  2. Set up a bibtex entry with a ".pdf" and a ".html" file attachment. I am using Zotero to export to bibtex.
  3. Using a template with (orb-process-file-field), create a new note from the helm interface

Expected behavior Because of (setq orb-file-field-extensions "pdf"), the "html" should be ignored, and the pdf file should be chosen without asking.

ORB configuration

  1. Doom emacs: (package! org-roam-bibtex :recipe (:host github :repo "org-roam/org-roam-bibtex"))

  2. ORB options set to non-default values (e.g. orb-templates)

(use-package! org-roam-bibtex
  :after (org-roam)
  :hook (org-roam-mode . org-roam-bibtex-mode)
 :config
  (setq
   orb-preformat-templates t 
  orb-preformat-keywords
  '("=key="  "title" "citekey" "keywords" "url"
    ;"file"
    "author"
    "editor"
    )
   orb-process-file-keyword t
orb-file-field-extensions "pdf"

Environment (please complete the following information):

Screenshots If applicable, add screenshots to help explain your problem.

PhDyellow commented 3 years ago

I did some testing, and found that I could get it to work again by removing the lambda from around when-let in orb-process-file-field, line 144 in orb-core.el introduced in 9ba1506.

from

(setq paths (--filter
                       (lambda ()
                         (when-let ((extension (file-name-extension it)))
                           (member-ignore-case extension extensions)))
                       paths)))

to

          (setq paths
                (--filter
                 (when-let ((extension (file-name-extension it)))
                   (member-ignore-case extension extensions))
                 paths)))
myshevchuk commented 3 years ago

Thanks a lot! No idea why I put that lambda there.