Drew Adams <drew.adams@oracle.com> writes: >> To me, use-package and package.el are mainly orthogonal: >> Package.el is for package management (installing, updating, >> removing), while use-package is for customization beyond >> what Customize provides -- or at least allows you to >> concentrate changes related to the same package in one place. > > Speaking/asking from ignorance here... > > 1. "Customization beyond what Customize provides" > > What kinds of such customization, besides the > one you call out next (#2)? > > 2. "allows you to concentrate changes related > to the same package in one place" > > Can you be more specific here? How does what > you have in mind differ from what customize > groups provide? > Hi Drew, I'm not sure I agree with the statement from the post you are responding to and wanted to give a different perspective which might clarify why some like use-package. At its most fundamental level, use-package is really just syntactic sugar. It provides a somewhat more declarative way to manage package loading, initialisation, configuration and customisation. It takes functionality which largely already exists and puts it together in one declarative 'chunk'. Much of what it does is really just convenience macros which define a DSL for installing, loading and configuring packages. For example, it provides convenience features for defining key bindings, setting interpreters, autoloads, file associations, loading on demand or loading after something else has been loaded, adding hooks, setting customize variables, etc. Instead of having (unless (package-installed-p 'some-package) (package-install 'some-package)) (require 'some-package) (add-hook 'some-package-hook 'my-some-package-setup) (define-key some-package-map (kbd "C-c f") 'some-mode-do-something) ... (custom-set-variables `(some-package-var t)) I might just have (use-package some-package :ensure t :hook (some-package . my-some-package-setup) :bind ("C-c f" . some-mode-do-something) :custom (some-package-var t)) which would achieve the same thing. The 3 main reasons I use it are 1. I don't like the customize interface. This is not a criticism of customize. I don't like similar interfaces in other editors either. I find them slow and cumbersome. 2. I like having all the configuration for a package in one block/stanza. I could also do this with just normal elisp, but use-package provides some additional syntactic sugar which makes things less verbose. It also tends to lead to a more declarative configuration. 3. It makes it easy to delay loading of packages, temporarily disabling or defining when a package is loaded and encourages better habits by keeping all the configuration associated with a package together so that if I do temporarily disable it, I don't get other init failures when other parts of my init file try to reference something which is no longer being loaded. This isn't so much about what the package does as much as how it encourages better practice in managing your config.. In short, use-package doesn't provide new functionality as much as it provides an alternative approach to existing functionality. It adds another choice to how users can manage their configuration. Some people will like it, some will hate it and probably most won't really care one way or the other. After using it for many years, I can say it has certainly improved the management and maintenance of my init.el I do think it is worth adding to Emacs and because it can also manage installing packages from ELPA, I would love it if it was in Emacs core so I can just use it instead of first ensuring it has been installed and then using it.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4