-
Notifications
You must be signed in to change notification settings - Fork 117
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
Discussion: When do our own defcustom
variables make sense? When are they best avoided?
#337
Comments
Good ideas here. Category 1 could be handled with For the line numbers thing, there is also the possibility to not use any Crafted Emacs configuration and just turn on the global minor mode. Not sure it needs to be it's own package as the forms provided are just helpers in the context that more configuration is better than less and it automates that configuration. The Crafted Windows Prefix Key is a bit more of a challenge to handle without a |
But isn't this an example for users that want to learn Emacs Lisp and how Emacs customization works? And if one has outgrown Crafted Emacs, want to make a configuration from scratch, etc. Will one not just remove things like that from the code one rip out of Crafted Emacs for own use? Personally I don't see them as a problem if you want to go your own way, starting from Crafted Emacs. You probably need to rewrite the code anyways. Isn't it usually what you do when you read configurations that someone else has written? Read and then rip the good parts out? I might missed something though. |
Absolutely! We are just trying to be conscious of the effort to do that. The more "custom" it is, more effort it takes to decouple. Imagine starting with something like Doom and then deciding at some point you'd prefer to use leaf for a package manager and want to simplify some of the other customizations. That's a bit more difficult because of the macros, customization system, etc that comes with Doom. Nothing wrong with that, the Doom project has its own goals which aren't likely to fully align with ours. But in the same kind of way, it might be nice if all a user had to do was to do was stop using a Crafted Emacs Of course, if the person does start completely from scratch after using Crafted Emacs, then the effort to migrate probably can't be measured in that sense. |
I can see the benefits of doing that. ;-)
Yes, but as you wrote, they have another goal all together. So that is why they can get away with a configuration system of their own.
Hm, but is it even feasible to make that work? Is it reasonable or even possible to decouple dependencies so much between
I only saw this as an option when make your own configuration. Probably stuck in the old ways. :-) Anyway, it was just my 5 öre (or 1 krona, as we don't have any öre coins any more) |
I think the As for the line-number thing, maybe it's just me but the entire block seems a bit much for essentially adding/removing hooks to enable/disable line-numbers? (defun crafted-emacs-enable-line-numbers-for-modes (modes)
"Enable line numbers for every mode in MODES."
(mapc (lambda (mode)
(add-hook mode #'display-line-number-mode)) ; probably prefer a wrapper explicitly turning it on
modes))
;; in user config
(crafted-emacs-enable-line-numbers-for-modes '(conf-mode prog-mode)) It would mean derived modes of e.g. However, I might be missing something on that one as I'm using line-numbers in most modes. |
Speaking as someone who is learning Emacs Lisp by exactly this process, I still see the benefits of being cautious with more variables. So I guess - in accordance with the stated goals of this project - in the end it comes down to code simplicity, which doesn't mean to avoid customization variables altogether. The line numbers thing is actually a good example for relatively simple code that taught me (for one) a lot about the use of customization variables in my own config and in packages I use. In general, I agree with the I propose to leave the current customization variables as they are, document them properly and be mindful of this going on. |
defcustom
variables make sense? When are they best avoided?defcustom
variables make sense? When are they best avoided?
In #334 , in the context of providing customization variables, @jeffbowman wrote:
In general, I agree with this point: If we hide away a lot of the config behind customization variables, we fail our stated goals of empowering users to learn Emacs Lisp themselves and of making it easy to move away from Crafted Emacs.
For example, if a user likes part of a given
crafted-*-config
module, we'd rather not provide customization variables as a way to switch parts of that module off. Instead, we encourage the user to look at the source code of that module and recreate the parts they want in their config. This a) is an opportunity to learn Emacs Lisp, b) makes it easy for the user to outgrow Crafted Emacs.So when does it make sense to provide customization variables for Crafted Emacs?
I propose the following distinction:
Category 1: customization variables that modify the behaviour of packages (or built-in functionality)
Example: If we had something like this in
crafted-org-config
(we don't):Category 2: customization variables that modify the behaviour of Crafted Emacs itself
Example: In
crafted-updates-config
, we havecrafted-updates-fetch-interval
This is clearly something for users who want to use Crafted Emacs, but want to customize the experience. It also won't interfere when moving away from Crafted Emacs. In fact, the whole setting doesn't make sense outside of Crafted Emacs.
I think in regard to the goals and philosophy of the project, it would make sense to avoid category 1, while category 2 is OK.
Current customization variables
I tried to sort the customization variables we already have into these categories:
crafted-defaults-config
crafted-windows-prefix-key
crafted-init-config
crafted-init-auto-save-customized
crafted-init-config
crafted-init-auto-save-selected-packages
crafted-startup-config
crafted-startup-inhibit-splash
crafted-startup-config
crafted-startup-recentf-count
crafted-ui-config
crafted-ui-line-numbers-enabled-modes
crafted-ui-config
crafted-ui-line-numbers-disabled-modes
crafted-ui-config
crafted-ui-display-line-numbers
crafted-updates-config
crafted-updates-fetch-interval
The variables marked with "?" don't quite fit my distinction, which shows that we have to distinguish further.
crafted-windows-prefix-key
:I'm not quite sure, here. While this pertains to a built-in functionality (
winner-mode
), which argues for Category 1, one could also argue that this doesn't really change the behaviour, just the keybindings. Are variables that define keybindings a special case of Category 2?crafted-ui-line-numbers-enabled-modes
andcrafted-ui-line-numbers-disabled-modes
:Here also, I'm not quite sure. These two don't turn parts of Crafted Emacs on or off, but - like keybindings - let the user customize how they want to use what Crafted Emacs offers. Is this a special case, too?
Mode specific line numbers in
crafted-ui
- a package?Come to think of it, maybe the cleanest way would be to make the (imho very useful) functionality for mode-dependent line number settings a package in its own right. That package could provide its own customizations and that users could take with them if the move away from Crafted Emacs.
The text was updated successfully, but these errors were encountered: