-
Notifications
You must be signed in to change notification settings - Fork 31
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
Bug with Emacs 29 setopt does not correctly honor modus defcustom types #118
Comments
I have encounted this issue with practically everything I have tested. Does this issue happen if you try to modify those variables through the Custom user interface? |
I use only programmatic elisp for better control and easier version controlling. There might be a simple adjustment to allow the custom infrastructure to work with modus-themes-completion. In the end, setopt just warns but still does what you tell it. |
From: shipmints ***@***.***>
Date: Fri, 18 Oct 2024 14:13:31 -0700
I use only programmatic elisp for better control and easier version
controlling.
Same here.
There might be a simple adjustment to allow the custom infrastructure
to work with modus-themes-completion. In the end, setopt just warns
but still does what you tell it.
I only ever use 'setq', which has no magic to it. Though I wonder when
is the type checking supposed to happen. I am trying this now and it
does not give me any error:
(custom-set-variables
'(modus-themes-to-toggle "hello"))
Meanwhile, the :type of that user option does not allow a string or
non-nil value:
:type `(choice
(const :tag "No toggle" nil)
(list :tag "Pick two themes to toggle between"
(choice :tag "Theme one of two"
,@(mapcar (lambda (theme)
(list 'const theme))
modus-themes-items))
(choice :tag "Theme two of two"
,@(mapcar (lambda (theme)
(list 'const theme))
modus-themes-items))))
So I guess those are only meant for the Custom UI.
…--
Protesilaos Stavrou
https://protesilaos.com
|
According to the info manual for
It would be nice if a warning were given for a value that doesn't match the expected type, but I guess that isn't implemented yet. Might be worth mentioning on emacs-devel. |
Debated at length https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73098 |
I think you might have meant
The question for your modus users, Prot, is that since you have setters on your options, should they have a way to call the same function manually after running their setq's? |
From: shipmints ***@***.***>
Date: Sat, 19 Oct 2024 07:49:31 -0700
> I am trying this now and it does not give me any error:
> (custom-set-variables '(modus-themes-to-toggle "hello")) Meanwhile,
> the :type of that user option does not allow a string or non-nil
> value: :type `(choice (const :tag "No toggle" nil) (list :tag "Pick
> two themes to toggle between" (choice :tag "Theme one of two"
> ,@(mapcar (lambda (theme) (list 'const theme)) modus-themes-items))
> (choice :tag "Theme two of two" ,@(mapcar (lambda (theme) (list
> 'const theme)) modus-themes-items)))) So I guess those are only meant
> for the Custom UI.
I think you might have meant ```(customize-set-variable``` which I
believe uses the full customize mechanical infrastructure.
I thought custom-set-variables was a wrapper for this. If I recall
correctly, it is what is appended to one's init file by default if they
use the Custom interface.
```setopt``` is implemented on top of the customize type checking
infrastructure but I do not know how robust that is vs. a set of
convenience helpers to drive the customize GUI.
The question for your modus users, Prot, is that since you have
setters on your options, should they have a way to call the same
function manually after running their setq's?
The :set we have now reloads the current theme when the user option
modus-themes-custom-auto-reload is non-nil (the default). Do you think
we need an interactive function to do this? Or maybe you have something
else in mind?
With setq we do not run any function behind the scenes. For me, this is
the desired behaviour: I do not want to reload the theme each time I set
a variable (I may plan to set many of those, or do some test with one of
the helper functions, for example).
…--
Protesilaos Stavrou
https://protesilaos.com
|
If the only purpose of the setters is to force theme reloading, then I'd say not needed programmatically. |
From: shipmints ***@***.***>
Date: Sat, 19 Oct 2024 08:23:52 -0700
If the only purpose of the setters is to force theme reloading, then
I'd say not needed programmatically.
Fine.
On this note, I now think we do not need the :set for all those user
options. It only makes sense for those that will produce a visual change
when the theme is loaded again. So modus-themes-to-toggle does not need
it, for example, but modus-themes-bold-constructs does.
What do you think?
…--
Protesilaos Stavrou
https://protesilaos.com
|
If a setter has no practical value for a particular user-settable option, I'd say remove it. Leaving it in might cause people who read the code itself (vs. just the documentation) to believe they need to do something special vs. merely setq. I've adopted the habit of reading the code for every user option so I can see precisely what's going on/intended vs. documentation. I would have been fooled by an erroneous setter. |
From: shipmints ***@***.***>
Date: Sun, 20 Oct 2024 05:28:51 -0700
If a setter has no practical value for a particular user-settable
option, I'd say remove it.
Good!
Leaving it in might cause people who read the code itself (vs. just
the documentation) to believe they need to do something special vs.
merely setq.
I agree.
I've adopted the habit of reading the code for every user option so I
can see precisely what's going on/intended vs. documentation. I would
have been fooled by an erroneous setter.
I tend to do the same. And use 'setq' because I have never encountered a
case where the :set not running actually breaks the package.
…--
Protesilaos Stavrou
https://protesilaos.com
|
Our :set function is designed to reload the theme, with the intent to apply whatever change to the visuals. But this is not relevant for user options that have no direct effect on the appearance of the themes. This is done as part of a discussion with shipmints in issue 118: <#118>.
I just removed some of the |
Not sure if this is an issue with modus defcustom definitions or with the implementation of setopt itself. This is FYI as more people might start using setopt and you do briefly mention setopt in the modus documentation. If setopt is broken, it might be good to report a bug before Emacs 30 goes to press. Or this could just be my misunderstanding.
Emacs 29.3, and the most recent ELPA modus-themes-20240905...
The literal example from the docstring works
Amended with level 3 works
But breaks with
overline
addedSimilarly, this works
But breaks when
text-also
addedThe text was updated successfully, but these errors were encountered: