-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defines and functions seem to have no effect at all #792
Comments
your Emacs could find |
Thanks but I already do have that in my config. |
I'm running into the same issue: (eval-when-compile
(require 'use-package))
(use-package eglot
:functions eglot-managed-p
:config
(eglot-managed-p)) I see (eval-when-compile
(require 'use-package))
(use-package eglot
:functions eglot-managed-p-doesnt-exist
:config
(eglot-managed-p-doesnt-exist)) This code doesn't emit any warnings. I'm not sure why this is happening. |
Can you please try macro-expanding those use-package declarations, to see what the code it's expanded to is doing? That may make the problem and the solution clear. |
(setq use-package-expand-minimally t)
(macroexpand '(use-package eglot
:functions eglot-managed-p
:config
(eglot-managed-p))) Output: (progn
(require 'eglot nil nil)
(eglot-managed-p)
t) The other example essentially goes to the same thing, I'm not sure why it's not showing this warning: (progn
(require 'eglot nil nil)
(eglot-managed-p-doesnt-exist)
t) Also, here's how it looks without (progn
(defvar use-package--warning81
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'eglot keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(if
(not
(require 'eglot nil t))
(display-warning 'use-package
(format "Cannot load %s" 'eglot)
:error)
(condition-case-unless-debug err
(progn
(eglot-managed-p)
t)
(error
(funcall use-package--warning81 :config err))))
(error
(funcall use-package--warning81 :catch err)))) |
When byte-compiling the file, it should declare the function: (let ((byte-compile-current-file t))
(macroexpand '(use-package eglot
:functions eglot-managed-p
:config
(eglot-managed-p))))
(progn
(eval-and-compile
(declare-function eglot-managed-p "eglot")
(eval-when-compile
(with-demoted-errors "Cannot load eglot: %S" nil
(unless
(featurep 'eglot)
(load "eglot" nil t)))))
(require 'eglot nil nil)
(eglot-managed-p)
t) |
Thanks! I think I've figured out where the difference is. It seems the warnings show up with This is the expansion with the variable set to (let ((byte-compile-current-file t)
(use-package-expand-minimally t))
(macroexpand '(use-package eglot
:functions eglot-managed-p
:config
(eglot-managed-p))))
(progn
(eval-and-compile
(declare-function eglot-managed-p "eglot")
(eval-when-compile
(with-demoted-errors "Cannot load eglot: %S" nil
(unless
(featurep 'eglot)
(load "eglot" nil t)))))
(require 'eglot nil nil)
(eglot-managed-p)
t) This is with the variable set to (let ((byte-compile-current-file t)
(use-package-expand-minimally nil))
(macroexpand '(use-package eglot
:functions eglot-managed-p
:config
(eglot-managed-p))))
(progn
(eval-and-compile
(declare-function eglot-managed-p "eglot")
(eval-when-compile
(with-demoted-errors "Cannot load eglot: %S" nil
(unless
(featurep 'eglot)
(load "eglot" nil t)))))
(defvar use-package--warning79
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'eglot keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(if
(not
(require 'eglot nil t))
(display-warning 'use-package
(format "Cannot load %s" 'eglot)
:error)
(condition-case-unless-debug err
(progn
(eglot-managed-p)
t)
(error
(funcall use-package--warning79 :config err))))
(error
(funcall use-package--warning79 :catch err)))) |
That's very interesting, something about the structure of the code that follows changes the reporting behavior here. Good find! |
The text was updated successfully, but these errors were encountered: