1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-30 08:09:04 +00:00
Commit Graph

300 Commits

Author SHA1 Message Date
Stefan Monnier
2fb271ca35 Fix unload+reload of files using custom-initialize-delay (bug#47072)
* 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.
2021-04-22 09:32:04 -04:00
Stefan Kangas
289ec2d911 ; Remove some useless comments 2021-04-16 14:54:02 +02:00
Basil L. Contovounesios
0ddbacca7d Don't override load-path in require-theme
* 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)
2021-03-05 11:02:20 +00:00
Basil L. Contovounesios
8e759d60cc Decouple require-theme from load-theme
* 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.
2021-03-04 15:40:35 +00:00
Protesilaos Stavrou
59e1867a1f Add 'require-theme' function
* 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'.
2021-03-01 19:50:02 +00:00
Stefan Monnier
04ab3904ed * lisp/gnus/gnus-art.el: Fix misuse of standard-value.
* lisp/custom.el (custom--standard-value): New function.

* lisp/gnus/gnus-art.el: (gnus-article-browse-html-parts)
(gnus-article-browse-html-article):
* lisp/dired-aux.el (dired-do-find-regexp-and-replace):
* lisp/emacs-lisp/package-x.el (package-upload-buffer-internal):
* lisp/startup.el (command-line): Use it.
2021-02-02 14:39:28 -05:00
Stefan Monnier
deb90c893d * lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.
(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.
2021-01-19 12:10:48 -05:00
Stefan Monnier
5039f79340 Fix marking "delayed-initialization" vars as dynamically scoped
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`.
2021-01-14 16:45:40 -05:00
Basil L. Contovounesios
5960e9cf57
; * lisp/custom.el (defcustom): Fix last change. 2021-01-10 13:20:51 +00:00
Lars Ingebrigtsen
14a1a84a33 Add a link to the manual from the defcustom doc string
* lisp/custom.el (defcustom): Add a link to the manual for the
:type element.
2021-01-10 13:43:12 +01:00
Stefan Monnier
7d7bfbf034 * lisp/emacs-lisp/autoload.el: Improve last change
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`.
2021-01-05 17:57:15 -05:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Michael Albinus
e45ad6b08e Merge from origin/emacs-27
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
2020-11-25 12:18:23 +01:00
Basil L. Contovounesios
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.
2020-11-24 16:50:37 +00:00
Mauro Aranda
527413fb2f Go back to not using custom-push-theme when enabling a theme
* 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.
2020-11-06 09:34:08 -03:00
Lars Ingebrigtsen
76d522e59e custom-theme-set-variables more resilient against removed libraries
* lisp/custom.el (custom-theme-set-variables): Don't bug out on
  settings that require a library that has been removed (bug#38843).
2020-11-01 13:14:41 +01:00
Mauro Aranda
31c3f53816 Preserve user customizations after disabling a theme
* 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).
2020-09-05 13:53:18 +02:00
Mauro Aranda
01819490b6 Keep the user theme in sync when marking a variable as set
* 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).
2020-08-27 16:22:35 +02:00
Juri Linkov
3b04d39c3c * lisp/custom.el (custom-add-choice): Fix previous commit. 2020-08-09 02:48:14 +03:00
Lars Ingebrigtsen
c3a6bcac86 Add new utility function custom-add-choice
* lisp/custom.el (custom-add-choice): New function (bug#41225).
2020-08-08 13:42:48 +02:00
Mauro Aranda
d6f9b09777 Fix saving multiple themes
* lisp/custom.el (enable-theme): Be side-effect free when modifying
custom-enabled-themes.  (Bug#19999)
2020-01-11 10:31:44 +02:00
Eli Zaretskii
071483b6f5 Fix reverting customizations
* 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)
2020-01-01 19:49:57 +02:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Filipp Gunbin
1b83228cc7 Correct small misprint in defcustom's docstring
* lisp/custom.el (defcustom): Correct misprint in docstring.
2019-11-25 21:12:46 +03:00
Paul Eggert
ba12c5467d Fix load-theme bug with user-emacs-directory
* lisp/custom.el (custom-theme-directory): Delay initialization,
since the value depends on user-emacs-directory (Bug#37256).
2019-09-01 09:56:59 -07:00
Lars Ingebrigtsen
716f8cb1f9 Doc string clarification for defcustom
* lisp/custom.el (defcustom): Mention `custom-declare-variable' in
the doc string(bug#22703).
2019-08-01 14:48:09 +02:00
Juanma Barranquero
e3b70e6b2d Add :local specifier to defcustom
* lisp/custom.el (custom-declare-variable): Allow the new :local
parameter (bug#14591).
(defcustom): Document it.
2019-06-27 13:26:45 +02:00
Paul Eggert
f744797af1 Go back to "Maintainer: emacs-devel@gnu.org"
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.
2019-05-25 14:25:18 -07:00
Paul Eggert
bef1be8730 Fixes for "Maintainer:" and related lines
Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines,
which are not that useful.  It also cleans up and regularizes a
few similar lines.
2019-05-19 21:34:27 -07:00
Stefan Monnier
6309131349 * lisp/custom.el: Avoid adding vars to load-history multiple times
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.
2019-05-06 12:37:00 -04:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Basil L. Contovounesios
b16f08015f Minor custom.el simplifications
* lisp/custom.el (custom-quote): Duplicate macroexp-quote.
(custom-load-symbol, customize-mark-to-save, customize-mark-as-set)
(custom-theme-name-valid-p, enable-theme, custom-enabled-themes)
(disable-theme): Simplify logic.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
5c3db91692 * lisp/custom.el: Use lexical-binding
Remove duplicate 'Custom Themes' comment heading.
(deftheme, custom-declare-theme): Fix advertised calling convention.
(custom-enabled-themes): Fix message grammar.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
70d702d3b1 Fix custom-available-themes file expansion
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.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
82e19fede8 Improve loading of byte-compiled custom themes
* lisp/custom.el (load-theme):
Load byte-compiled file of safe themes when available.

https://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00614.html
https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00060.html
2018-07-13 11:28:16 -04:00
Daniel Colascione
aabaa9f8c8 Apply non-user themes only when asked
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.
2018-06-16 15:44:23 -07:00
Daniel Colascione
b8478b2ab7 Clarify that enabling a theme does not disable other themes
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.
2018-06-12 23:28:47 -07:00
Noam Postavsky
53e9fa2b5a * lisp/custom.el (defcustom): Fix docstring (Bug#27891). 2018-01-30 22:14:02 -05:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
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.
2017-09-13 15:54:37 -07:00
Glenn Morris
217eaf6932 ; * lisp/custom.el: Comments. 2017-02-21 15:11:56 -05:00
Glenn Morris
20dda6be76 Tweak recent custom-reevaluate-setting change
* lisp/custom.el (custom-reevaluate-setting):
Tweak previous change to avoid font-lock init issues.
2017-02-21 12:59:56 -05:00
Glenn Morris
96cea19842 Ensure delayed-init custom variables get marked special
* lisp/custom.el (custom-reevaluate-setting):
If the variable has never been set, defvar it.  (Bug#25770)
2017-02-20 18:30:40 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Wieland Hoffmann
72613557e0 Grammar fix in doc string
* lisp/custom.el (defgroup): Grammar fix in doc string.

Copyright-paperwork-exempt: yes
2016-02-21 13:32:22 +11:00
Leo Liu
71a04969c4 * lisp/custom.el (defface): Revert indentation change. (Bug#22524) 2016-02-05 09:48:17 +08:00
Glenn Morris
c51943d71d * lisp/custom.el (defcustom): Doc fix.
* doc/lispref/customize.texi (Variable Definitions):
Defcustom should always have a type.
2016-01-28 17:45:50 -05:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Artur Malabarba
2a85bf6a8e * lisp/custom.el (custom-declare-variable): Shorten code again
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.
2015-10-25 14:39:07 +00:00