Subject: bug#44804: 28.0.50; loading EBDB using use-package is throwing error

From: Pankaj Jangid <[email-masked]>
Date: Mon, 23 Nov 2020 08:29:59 +0530

Eric Abrahamsen <[email-masked]> writes:

>> Error (use-package): Failed to parse package ebdb: Wrong type argument:
>> listp, require Disable showing Disable logging
>>
>> My configuration is:
>>
>> (use-package ebdb
>>   :ensure t
>>   :config
>>   (setq ebdb-mua-pop-up nil)
>>   :hook
>>   (emacs-startup . (progn
>> 		     (require 'ebdb-gnus)
>> 		     (require 'ebdb-message))))
>
> I've never used use-package so I'm not sure how much help I'm going to
> be here. But looking at its documentation, I wonder if it wouldn't make
> more sense to do this:
>
> (use-package ebdb-gnus
> 	     :ensure t
> 	     :config
> 	     (setq ebdb-mua-pop-up nil)
> 	     :hook gnus-startup)
>
> (use-package ebdb-message
> 	     :ensure t
> 	     :hook gnus-startup)

Not actually. Basically use-package's argument is the package name that
we usually see in the `M-x package-list-packages'. The `:ensure t'
option is to make sure that the package is installed if it is not
already installed. `:init' is executed before loading and `:config' is
executed after loading of the package. So ideally this should work:

(use-package ebdb
  :ensure t                ; this will make sure ebdb is installed
  :config                  ; this will be executed after ebdb is loaded
  (require 'ebdb-gnus)
  (require 'ebdb-message))

But this increases load time. Hence the startup hook. So I would rather
use this when `use-package' will be part of core emacs:

(use-package ebdb
  :ensure t
  :config
  (use-package 'ebdb-gnus  ; no `:ensure t' here, installed with ebdb
    :hook emacs-startup)
  (use-package 'ebdb-message
    :hook emacs-startup))

> EBDB is set up to load everything you need if you just require the
> relevant MUA packages, so this should do it. All other likely entry
> points to EBDB should be autoloaded already. I don't know what :ensure
> does, but I left it in there.

explained above.

>
> Having these statements on the `emacs-startup-hook' seems like you're
> not gaining anything by using use-package. You might as well just
> (require 'ebdb-gnus) at the top-level of your init.

actually when we use `:hook' in use-package it implies `:defer t'. This
saves some startup time.

Without `use-package', my setup is working perfectly fine. But
eventually, people will report this bug.

(add-hook 'emacs-startup-hook
	  (lambda ()
	    (progn
	      (defvar ebdb-mua-pop-up nil)
	      (require 'ebdb-gnus)
	      (require 'ebdb-message))))

BTW your snippet is also giving same error,

;; Error (use-package): Failed to parse package 'ebdb-gnus: Wrong type
   argument: symbolp, 'ebdb-gnus Disable showing Disable logging
;; Error (use-package): Failed to parse package 'ebdb-message: Wrong type
   argument: symbolp, 'ebdb-message Disable showing Disable logging