Ignacio Casso <ignacioca...@hotmail.com> writes: > Then we should decide if we want to use autoload cookies for custom > variables to make this work also with lexical binding. Otherwise, code > like the snippet above would produce an error in Emacs 29, and in Emacs > 27 the let binding would be ignored (although at least the custom setter > would work). I have no opinion regarding this last point since I don't > remember what were the disadvantages of using autoload cookies for > custom variables.
AFAIK, autoloading defcustoms is not discussed in the manual. I have no idea about possible pitfalls as well. > I've prepared a patch for the first point, which I attach at the end of > this email. All changes fall in one of the following cases: > > - `set-default' -> `set-default-toplevel-value' (as explained) > > - `set' -> `set-default-toplevel-value' > > The same, but in this cases there was another bug: If a buffer set the > custom variable locally before the feature was autoloaded, the setter > of the variable would not set the standard value as the default for > other buffers, and would overwrite the buffer-local value. > > - :set 'set-default -> nothing, since it would be already the default > > I don't really know what most of the variables whose setter I have > changed do or whether it makes any sense to use them inside a let > binding, but I have made the change for all of them nevertheless, since > it can not harm and could potentially fix a bug. Feel free to restrict > those changes only to those variables where it makes sense, such as > `org-capture-templates', if you want to keep the patch small and simple. LGTM! Unless others have objections, I am inclined to merge the patch fully. But please add changlog entries to the commit message. Best, Ihor