* lisp/custom.el (custom-initialize-delay): Don't delay if
`custom-delayed-init-variables` has already been processed.
* lisp/startup.el (command-line): Mark `custom-delayed-init-variables`
as processed.
* lisp/custom.el (require-theme): Open-code 'require' error, because
binding load-path can prevent other libraries from loading on error,
such as debug.el, which gives a misleading error. (Bug#45068)
* lisp/custom.el (require-theme): Refashion after 'require', as a
function for loading only named features. Do not call
load-theme (bug#45068).
* etc/NEWS: Update its announcement accordingly.
* doc/lispref/customize.texi (Custom Themes): Document it.
* etc/themes/modus-operandi-theme.el:
* etc/themes/modus-vivendi-theme.el: Remove redundant calls to
'provide'.
* test/lisp/custom-tests.el (custom-tests--with-temp-dir): New
macro.
(custom-theme--load-path): Use it.
(custom-tests-require-theme): New test.
* etc/NEWS: Document new function.
* lisp/custom.el (require-theme): Add function.
This follows from the discussion on bug#45068 where it became apparent
that there was no equivalent mechanism to 'require' that read through
the 'custom-theme-load-path'.
(command-line): Don't re-evaluate the `custom-delayed-init-variables`
a second time after reading the `early-init.el` file.
(x-apply-session-resources): Set `blink-cursor-mode` rather than
`no-blinking-cursor`.
* lisp/frame.el (blink-cursor-start): Turn `blink-cursor-mode` off
if `blink-cursor-mode` was set to nil.
(blink-cursor-mode): Default to it being enabled regardless of
`window-system`.
* lisp/custom.el (custom-initialize-delay): Fox docstring now that
autoload.el preserves the `:initialize` info.
We used to mark those vars as dynbound in `custom-reevaluate-setting`
which forced us to bind `current-load-list` around it to avoid having
the vars be associated with the wrong file. Move this marking to
`custom-initialize-delay` so we don't need this workaround.
* lisp/custom.el (custom-initialize-delay): Mark the var as dynamic.
(custom-reevaluate-setting): Don't use `defvar` here.
* lisp/startup.el (command-line): Don't let-bind `current-load-list`
around calls to `custom-reevaluate-setting`.
It turns out there were other places that used `custom-initialize-delay`
on autoloaded variables and used various hacks to make it work with
`autoload.el`. The new code makes those hacks unneeded.
Also, there's no point trying to "optimize" those rare cases anyway,
so I simplified the `autoload.el` code for those cases.
(make-autoload): For non-trivial cases,
just include the whole `defcustom` instead of trying to mimic it.
* lisp/mail/rmail.el (rmail-spool-directory): Remove hacks.
* lisp/info.el (Info-default-directory-list): Remove `progn` hack.
* lisp/custom.el (custom-declare-variable)
(custom-handle-all-keywords): Don't use pseudo-group `nil`.
6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803)
fc4379f1ae Minor cleanup of tramp-tests.el on MS Windows
dea3d6aa18 Fix handling of defcustom :local tag
For discussion, see the following emacs-devel thread:
https://lists.gnu.org/r/emacs-devel/2020-11/msg00734.html
* lisp/custom.el (custom-declare-variable): Delay call to
make-variable-buffer-local until after user option has been
initialized with a value. Otherwise the user option may be
initialized to nil.
* test/lisp/custom-tests.el (custom--test-local-option)
(custom--test-permanent-option): New :local user options.
(custom-test-local-option): New test for defcustom :local keyword.
* lisp/custom.el (enable-theme): Relying on custom-push-theme to
handle theme settings and prior user settings was a mistake. The
theme settings haven't changed between loading the theme and enabling
it, so we don't need all of what custom-push-theme does. However, we
still need to save a user setting outside of Customize, in order to be
able to get back to it, so do that in enable-theme itself.
* lisp/custom.el (enable-theme): Since we are enabling the theme, bind
custom--inhibit-theme-enable to nil. Then rely on custom-push-theme
to do the right thing with the theme settings and prior user settings,
instead of manipulating the property here. This way, when disabling a
theme, we restore user preferences, even when the values were changed
outside of customize.
(disable-theme): Call custom-push-theme instead of handling theme
settings directly.
(custom-push-theme): Avoid another instance of Bug#28904: we don't
need the changed theme when the value recorded for it is going to be
the same as the recorded for the user theme.
* test/lisp/custom-tests.el (custom--test-theme-variables): Get rid of
a portion of the test that will always fail, because the user theme
has priority over every other theme. Expect the test to pass now that
we preserve user customizations after disabling a theme (bug#34027).
* lisp/custom.el (customize-mark-as-set): Keep the user theme in sync
even if the new value of the variable is the saved-value or the
standard-value. If we don't do this, custom themes might end up
stepping over the user preferences in a session (bug#28904).
* lisp/custom.el (custom-push-theme): Don't use setcar to modify
the recorded value of PROP; instead, cons a new property list by
deleting the old value and adding the new one. (Bug#38812)
Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is
no special maintainer for a file. Although this wasn't documented
it was common practice and removing the lines didn't have consensus.
Avoid the abuse of (eval `(defvar ...)) which tends to end up
adding redundant entries in `load-history`, as discussed in
https://lists.gnu.org/r/help-gnu-emacs/2019-03/msg00237.html
(custom-initialize-default): Don't add to load-history.
(custom-declare-variable): Use internal--define-uninitialized-variable
and only add the var to load-history once. Do it before calling
`initialize` so the special-variable-p flag is set.
* src/eval.c (Finternal__define_uninitialized_variable): New function.
(Fdefvar, Fdefconst): Use it.
(syms_of_eval): Defsubr' it.
For discussion, see thread starting at
https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00222.html.
* lisp/custom.el: (custom-available-themes): Use directory-files
instead of performing arbitrary wildcard expansion in file names.
(custom-theme--load-path): Document return value.
* test/lisp/custom-tests.el: New file.
(custom-theme--load-path): New test.
Theme settings now generally aren't actually applied until a call to
`enable-theme-, either one made explicitly or implicitly through
`load-theme' with NO-ENABLE nil. This change has the effect of not
applying theme changes just because we load a lisp file containing a
theme specification. The previous behavior is preserved for the
special case of the `user' theme, which is frequently used for
ad-hoc customization.
* lisp/cus-face.el (custom-theme-set-faces): Call
`custom--should-apply-setting' to decide whether to apply
a setting.
* lisp/custom.el (custom--should-apply-setting): New function.
(custom--inhibit-theme-enable): Add `apply-only-user' option;
default to it.
(custom-push-theme, custom-theme-set-variables): Call
`custom--should-apply-setting' to decide whether to apply
a setting.
Avoid user confusion by explicitly stating that enabling a theme does
not imply disabling other themes and that theme load functions are not
theme switch functions.
* lisp/custom.el (load-theme, enable-theme): Clarify docstrings.
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November. Change these FTP URLs to https://ftp.gnu.org
instead. Make similar changes for URLs to other organizations moving
away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
Without using pcase this time. We can't use pcase because it is loaded
after custom in loadup.el. Also add a comment explaining this to future
dummies like me.