chenyanming / calibredb.el

Emacs calibre client - An Ebook Management Solution in Emacs.
GNU General Public License v3.0
319 stars 16 forks source link

error: (void-variable calibredb-root-dir) after updating #28

Closed ram535 closed 3 years ago

ram535 commented 3 years ago

Everything was working fine before the update.

I got this error after updating the package.

  Error (use-package): calibredb/:catch: Symbol’s value as variable is void: calibredb-root-dir

This is the output of emacs -degub-init.

Debugger entered--Lisp error: (void-variable calibredb-root-dir)
  (expand-file-name "metadata.db" calibredb-root-dir)
  eval((expand-file-name "metadata.db" calibredb-root-dir))
  custom-initialize-reset(calibredb-db-dir (funcall #'#f(compiled-function () #<bytecode 0x1e0000171e91>)))
  custom-declare-variable(calibredb-db-dir (funcall #'#f(compiled-function () #<bytecode 0x1e0000171e91>)) "Location of \"metadata.db\" in your calibre library." :type file :group calibredb)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\210\3131?\0\300\314!\210\300\315..." [require s dash cl-lib cl-macs sql hl-line transient sendmail dired thingatpt (error) helm ivy all-the-icons icons-in-terminal custom-declare-group calibredb nil "calibredb group" :group custom-declare-variable calibredb-db-dir funcall function #f(compiled-function () #<bytecode 0x1e0000171e91>) "Location of \"metadata.db\" in your calibre library." :type file calibredb-ref-default-bibliography #f(compiled-function () #<bytecode 0x1e0000171e91>) "BibTex file for current library."] 8)
  require(calibredb-core)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\207" [require calibredb-core calibredb-faces calibredb-search calibredb-show calibredb-helm calibredb-ivy calibredb-utils calibredb-annotation calibredb-transient calibredb-library] 2)
  require(calibredb nil t)
  (not (require 'calibredb nil t))
  (if (not (require 'calibredb nil t)) (display-warning 'use-package (format "Cannot load %s" 'calibredb) :error))
  (progn (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-author-width 0 nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-id-width 0 nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-comment-width 0 nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(sql-sqlite-program "~/bin/sqlite/sqlite3" nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-root-dir "~/Documents/books" nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir) nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-program "/usr/bin/calibredb" nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-library-alist '(("~/Documents/books") ("~/Documents/articles")) nil nil "Customized with use-package calibredb"))) (condition-case err (autoload 'calibredb "calibredb") ((debug error) (funcall use-package--warning72 :init err))) (if (not (require 'calibredb nil t)) (display-warning 'use-package (format "Cannot load %s" 'calibredb) :error)))
  (condition-case err (progn (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-author-width 0 nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-id-width 0 nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-comment-width 0 nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(sql-sqlite-program "~/bin/sqlite/sqlite3" nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-root-dir "~/Documents/books" nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir) nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-program "/usr/bin/calibredb" nil nil "Customized with use-package calibredb"))) (let ((custom--inhibit-theme-enable nil)) (custom-theme-set-variables 'use-package '(calibredb-library-alist '(... ...) nil nil "Customized with use-package calibredb"))) (condition-case err (autoload 'calibredb "calibredb") ((debug error) (funcall use-package--warning72 :init err))) (if (not (require 'calibredb nil t)) (display-warning 'use-package (format "Cannot load %s" 'calibredb) :error))) ((debug error) (funcall use-package--warning72 :catch err)))
  eval-buffer(#<buffer  *load*> nil "/home/last/.emacs.d/init.el" nil t)  ; Reading at buffer position 36251
  load-with-code-conversion("/home/last/.emacs.d/init.el" "/home/last/.emacs.d/init.el" t t)
  load("/home/last/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x286c35a82587f07>) #f(compiled-function () #<bytecode 0x81a386fa1b19353>) t)
  command-line()
  normal-top-level()

Emacs version.

  GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10) of 2020-03-09

My configuration.

(use-package calibredb
  :custom
  (calibredb-author-width 0)
  (calibredb-id-width 0)
  (calibredb-comment-width 0)
  (sql-sqlite-program "~/bin/sqlite/sqlite3")
  (calibredb-root-dir "~/Documents/books")
  (calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
  (calibredb-program "/usr/bin/calibredb")
  (calibredb-library-alist '(("~/Documents/books")
                                  ("~/Documents/articles")))
:init
  (autoload 'calibredb "calibredb"))
chenyanming commented 3 years ago

Are you using Master or Develop branch?

chenyanming commented 3 years ago

When is your last update?

chenyanming commented 3 years ago

Try to use :config rather than :custom,

(use-package calibredb
  :defer t
  :init
  (autoload 'calibredb "calibredb")
  :config
  (setq calibredb-root-dir "~/OneDrive/Org/Doc/Calibre")
  (setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
  (setq calibredb-library-alist '(("~/OneDrive/Org/Doc/Calibre")
                                  ("~/Documents/Books Library")
                                  ("~/Documents/LIB1")
                                  ("/Volumes/ShareDrive/Documents/Library/"))))
ram535 commented 3 years ago

I replaced the code as you suggested and everything works fine now.

(use-package calibredb
  :init
  (autoload 'calibredb "calibredb")
  :config
  (setq calibredb-author-width 0)
  (setq calibredb-id-width 0)
  (setq calibredb-comment-width 0)
  (setq sql-sqlite-program "~/bin/sqlite/sqlite3")
  (setq calibredb-root-dir "~/Documents/books")
  (setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
  (setq calibredb-program "/usr/bin/calibredb")
  (setq calibredb-library-alist '(("~/Documents/books")
                                  ("~/Documents/articles"))))

I wonder why it did not work with the :custom keyword.

chenyanming commented 3 years ago

In new updates, calibredb-db-dir will be automatically set by calibredb-root-dir during initialization, so that users don't need to set calibredb-db-dir by themself. However, if use :custom, may overwrite this feature.