-
Notifications
You must be signed in to change notification settings - Fork 44
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
magit-todo-keywords incompatible with use-package :custom #24
Comments
Thanks. I don't know what's going on there. It's hard to say whether it's a bug in this or in However, when we move the regexp creation to the scan invocations, this probably won't matter anymore. So I'd suggest leaving this until that change is made. |
Sounds good. |
This should be "fixed" in this branch: #27 |
Still happening in master f7c2b2d. It appears that The |
There are a lot of variables at play here.
I guess I need to move the logic from the custom setter for I don't know about the other custom variables. |
This is what the README of 'use-package' says about
It should call |
Here's what this: (use-package magit-todos
:custom ((magit-todos-depth 25)
(magit-todos-keywords '("TODO")))) expands to: (progn
(defvar use-package--warning93
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'magit-todos keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(progn
(customize-set-variable 'magit-todos-depth 25 "Customized with use-package magit-todos")
(customize-set-variable 'magit-todos-keywords
'("TODO")
"Customized with use-package magit-todos")
(if
(not
(require 'magit-todos nil t))
(display-warning 'use-package
(format "Cannot load %s" 'magit-todos)
:error)))
(error
(funcall use-package--warning93 :catch err)))) As you can see, it
Looking at the docstring for However, it seems strange to me that this would be the case, because it seems like something that should have been considered when |
Indeed, putting those calls to (progn
(defvar use-package--warning93
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'magit-todos keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(progn
(with-eval-after-load 'magit-todos
(customize-set-variable 'magit-todos-depth 25 "Customized with use-package magit-todos")
(customize-set-variable 'magit-todos-keywords
'("TODO")
"Customized with use-package magit-todos"))
(if
(not
(require 'magit-todos nil t))
(display-warning 'use-package
(format "Cannot load %s" 'magit-todos)
:error)))
(error
(funcall use-package--warning93 :catch err)))) After doing that in an Emacs instance in which So this appears to be a bug in |
Filed as jwiegley/use-package#702 |
Is it really necessary to have dependent variables updated in the defcustom? If possible it would be preferable if this was done on the fly when a change is detected in magit-todos-keywords (by checking the value used when the dependent variable(s) were last updated). This way customize-set-variable is not required, setq will work in an use-package :init section, which is I think what most people expect. |
These are defined with
The |
You are right, all the :init setq's that I've looked in my init.el are for defcustom vars, defvars I have in :config. I suppose I should fix the defcustoms to be 100% correct. It appears that defcustom side-effect code isn't very common, otherwise I think I would have had more issues. |
I think you're right; I don't often see it myself. It's not often necessary. But it is there when you need it. |
With the following minimal setup:
Trying to run
M-x magit-status
for the first time after Emacs restarts resulted in error: "user-error: Please add some keywords". Re-eval the above snippet fixes it.In comparison, using
custom-set-variables
within:config
just works:The text was updated successfully, but these errors were encountered: