use-package icon indicating copy to clipboard operation
use-package copied to clipboard

Error (use-package): helm-bibtex/:config: Wrong number of arguments: (3 . 4), 2

Open hongyi-zhao opened this issue 2 years ago • 0 comments

On Ubuntu 20.04.2 LTS, I use the following use-package configuration for helm-bibtex:

;https://lucidmanager.org/productivity/emacs-bibtex-mode/
(setq bib-files-directory (directory-files-recursively
                             (concat (getenv "HOME") "/texmf/bibtex/bib/local") "^[A-Za-z].+.bib$")
      ;pdf-files-directory (concat (getenv "HOME") "/pdf")
      ;bib-notes-directory (concat (getenv "HOME") "/notes")
      )

(use-package helm-bibtex
  :demand t
  :config
  (require 'helm-config)
  (setq bibtex-completion-bibliography bib-files-directory
        ;bibtex-completion-library-path pdf-files-directory
        ;bibtex-completion-notes-path bib-notes-directory
        bibtex-completion-pdf-field "File"
        ;https://github.com/tmalsburg/helm-bibtex#insert-latex-cite-commands
        bibtex-completion-cite-prompt-for-optional-arguments nil)
  :bind
  (("<menu>" . helm-command-prefix)
   :map helm-command-map
   ("b" . helm-bibtex)
   ("B" . helm-bibtex-with-local-bibliography)
   ("n" . helm-bibtex-with-notes)
   ("<menu>" . helm-resume))
   
   :config
   ;https://github.com/tmalsburg/helm-bibtex#application-used-for-opening-pdfs
   (defun bibtex-completion-open-pdf-external (keys &optional fallback-action)
     (let ((bibtex-completion-pdf-open-function
         (lambda (fpath) (start-process "evince" "*helm-bibtex-evince*" "/usr/bin/evince" fpath))))
      (bibtex-completion-open-pdf keys fallback-action)))

     (helm-bibtex-helmify-action bibtex-completion-open-pdf-external helm-bibtex-open-pdf-external)

    (helm-add-action-to-source
         'helm-bibtex
         '(("P" helm-bibtex-open-pdf-external "Open PDF file in external viewer (if present)")))  

    ;https://github.com/tmalsburg/helm-bibtex#browser-used-for-opening-urls-and-dois 
    (setq bibtex-completion-browser-function
      (lambda (url _) (start-process "firefox" "*firefox*" "firefox" url))) 
  

    ;https://github.com/tmalsburg/helm-bibtex#predefined-searches
    (defun helm-bibtex-my-publications (&optional arg)
      "Search BibTeX entries authored by “Jane Doe”.
        With a prefix ARG, the cache is invalidated and the bibliography reread."
      (interactive "P")
      (helm-bibtex arg nil "Jane Doe"))

    ;; Bind this search function to Ctrl-x p:
    (global-set-key (kbd "C-x p") 'helm-bibtex-my-publications))

The above configuration will trigger the following error, but if I remove the :demand t directive, the problem will disappear:

Error (use-package): helm-bibtex/:config: Wrong number of arguments: (3 . 4), 2 Disable showing Disable logging

See here for some relevant discussion. Any hints for this problem?

Regards, HY

hongyi-zhao avatar Aug 24 '21 03:08 hongyi-zhao