On 18 February 2016 at 13:54, Eli Zaretskii wrote: > > From: Clément Pit--Claudel > > Date: Thu, 18 Feb 2016 13:25:49 -0500 > > > > One thing that I would find convenient as a package developer is a > notion of package-local storage. > > We will find a lot of missing infrastructure as we begin using > package.el more and more. This is just the tip of the iceberg. > > FWIW, I think we should first design the package system we want to > support, and only after that talk about stuff like saving > package-specific settings. But I have no illusions that this will be > accepted, or that the discussions will indeed be deferred. > > > * Save the customization through Custom > > * Create my own file in user-emacs-directory > > > > The first one is unsuitable for persisted information that shouldn't be > presented to the user (for example, if my package collects statistics, I > don't want to change the custom file constantly and add large amounts of > data to it). The second one in not uniform across packages, and forces me > to invent my own storage format (some packages store a lisp form, other > store a series of command that are just executed upon loading the file > (viper, history), others use json or csv-like formats (as was suggested for > package.el)). > > Personally, I see nothing wrong with each package using its own > storage format. We don't require package authors to use the same > coding style and the same abstractions, so why should storage be any > different? > > > In both cases, removing a package won't remove the storage that it uses > (either in Custom or in separate files in .emacs.d). This is especially > problematic when trying out packages: I launch a package to try it out, it > initializes its backing store (often with a file, sometimes with an entry > in custom-set-variables), then I remove it (if I don't like it), and yet > the backing store is not removed. Take viper as an example (though viper is > bundled with Emacs right now): launching it and allowing it to persist its > settings creates a file ~/.emacs.d/viper. > > > > It would be nice to have a uniform way to persist package-specific > information; ideally one that would collaborate with package.el, so that > removing a package would remove its stored state. One would need to figure > out how to handle settings persisted through custom as well, but a simple > key-value store that plays well with package.el would be a great start. > > Removing auxiliary files doesn't require those files to be in the same > format, it can be solved by having each package produce a record of > those files that the manager can use to delete them. > > A possible implementation for auxiliary files that would reduce the need for tracking the files could be something akin to: (defcustom user-package-data-directory (expand-file-name "package-data" user-emacs-directory) "Directory for storing persistent package-related data. Installation of a package creates a subdirectory for local persistent data that will be removed on package uninstallation." :type 'directory) Then part of package installation process would become: (make-directory (expand-file-name packagename user-package-data-directory)) Package removal would simply remove that directory (and it's contents). Regards, Jonathan