orgtre / qpdf.el

A transient Emacs wrapper for qpdf
5 stars 2 forks source link

Issue with loading transient (void-function transient-define-prefix) #1

Closed jgru closed 2 years ago

jgru commented 2 years ago

Dear orgtre,

I have been using your package qpdf.el and really like it. Unfortunately, I receive the following error when loading qpdf.el

Debugger entered--Lisp error: (void-function transient-define-prefix)
  (transient-define-prefix qpdf nil "Transient dispatcher for the qpdf shell command.\nS..." :init-value 'qpdf--set-defaults :transient-non-suffix 'qpdf-transient-non-suffix :incompatible qpdf-incompatible qpdf-prefix-groups)
  straight--activate-package-autoloads((:host github :repo "orgtre/qpdf.el" :package "qpdf.el" :type git :local-repo "qpdf.el"))
  #f(compiled-function () #<bytecode -0x3c3d842388c2d95>)()
  straight--transaction-exec(use-package-\"4cc620bdd6706bfca2b10ccb355b5a73\"-nil-nil :now #f(compiled-function () #<bytecode -0x3c3d842388c2d95>))
  straight-use-package((qpdf.el :host github :repo "orgtre/qpdf.el"))
  load-with-code-conversion("/home/<user>/.emacs.d/init.el" "/home/<user>/.emacs.d/init.el" t t)
  load("/home/<user>/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0x19da930056f1201f>) #f(compiled-function () #<bytecode -0x1f3c6feddc0acb35>) t)
  command-line()
  normal-top-level()

The error can be reproduced with the following minimal configuration file:

(defvar bootstrap-version)
(let ((bootstrap-file
           (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
          (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
        (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
          (goto-char (point-max))
          (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq package-enable-at-startup nil)
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)

;; disable verbose warnings related to native-compilation
(require 'comp nil t)
(when (fboundp 'native-compile)
  (setq native-comp-async-report-warnings-errors nil))

(use-package qpdf.el
  :straight (:host github :repo "orgtre/qpdf.el")
  :commands qpdf)

It looks like that (require 'transient) in l. 11 does somehow not take effect. Adding an explicit (require 'transient)-statement in front of the (use-package...)-statement resolves the error. Do you have an idea what causes this problem here?

Thank you very much for providing and maintaining qpdf.el.

Best regards, jgru

orgtre commented 2 years ago

Thanks for reporting this and great that you found some use for qpdf.el! I can reproduce this and think it is due to things not being autoloaded as they should. I'll push a fix.

jgru commented 2 years ago

Thank you for your quick response and resolving this. Can you elaborate why the autoload-statement needed the variable 'qdpf?

orgtre commented 2 years ago

To be honest, I don't know. I just looked at how it was done in rg.el.