aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil L. Contovounesios2018-05-11 16:09:57 +0100
committerStefan Monnier2018-07-13 11:28:16 -0400
commit5c3db916927e08361d6a3172b53460f91ec81047 (patch)
tree843d0325e6424e505faeb23a9985c3e47f3864b2
parent70d702d3b1c40f72059bb5694bd805b1c65d141d (diff)
downloademacs-5c3db916927e08361d6a3172b53460f91ec81047.tar.gz
emacs-5c3db916927e08361d6a3172b53460f91ec81047.zip
* 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.
-rw-r--r--lisp/custom.el50
1 files changed, 25 insertions, 25 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index 4536788eb20..1c667c8aa2d 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1,4 +1,4 @@
1;;; custom.el --- tools for declaring and initializing options 1;;; custom.el --- tools for declaring and initializing options -*- lexical-binding: t -*-
2;; 2;;
3;; Copyright (C) 1996-1997, 1999, 2001-2018 Free Software Foundation, 3;; Copyright (C) 1996-1997, 1999, 2001-2018 Free Software Foundation,
4;; Inc. 4;; Inc.
@@ -150,7 +150,7 @@ set to nil, as the value is no longer rogue."
150 (put symbol 'force-value nil)) 150 (put symbol 'force-value nil))
151 (if (keywordp doc) 151 (if (keywordp doc)
152 (error "Doc string is missing")) 152 (error "Doc string is missing"))
153 (let ((initialize 'custom-initialize-reset) 153 (let ((initialize #'custom-initialize-reset)
154 (requests nil)) 154 (requests nil))
155 (unless (memq :group args) 155 (unless (memq :group args)
156 (custom-add-to-group (custom-current-group) symbol 'custom-variable)) 156 (custom-add-to-group (custom-current-group) symbol 'custom-variable))
@@ -426,7 +426,7 @@ information."
426(defun custom-declare-group (symbol members doc &rest args) 426(defun custom-declare-group (symbol members doc &rest args)
427 "Like `defgroup', but SYMBOL is evaluated as a normal argument." 427 "Like `defgroup', but SYMBOL is evaluated as a normal argument."
428 (while members 428 (while members
429 (apply 'custom-add-to-group symbol (car members)) 429 (apply #'custom-add-to-group symbol (car members))
430 (setq members (cdr members))) 430 (setq members (cdr members)))
431 (when doc 431 (when doc
432 ;; This text doesn't get into DOC. 432 ;; This text doesn't get into DOC.
@@ -618,11 +618,8 @@ VARIABLE is a symbol that names a user option.
618The result is that the change is treated as having been made through Custom." 618The result is that the change is treated as having been made through Custom."
619 (put variable 'customized-value (list (custom-quote (eval variable))))) 619 (put variable 'customized-value (list (custom-quote (eval variable)))))
620 620
621 621;; Loading files needed to customize a symbol.
622;;; Custom Themes 622;; This is in custom.el because menu-bar.el needs it for toggle cmds.
623
624;;; Loading files needed to customize a symbol.
625;;; This is in custom.el because menu-bar.el needs it for toggle cmds.
626 623
627(defvar custom-load-recursion nil 624(defvar custom-load-recursion nil
628 "Hack to avoid recursive dependencies.") 625 "Hack to avoid recursive dependencies.")
@@ -715,7 +712,7 @@ To actually save the value, call `custom-save-all'.
715 712
716Return non-nil if the `saved-value' property actually changed." 713Return non-nil if the `saved-value' property actually changed."
717 (custom-load-symbol symbol) 714 (custom-load-symbol symbol)
718 (let* ((get (or (get symbol 'custom-get) 'default-value)) 715 (let* ((get (or (get symbol 'custom-get) #'default-value))
719 (value (funcall get symbol)) 716 (value (funcall get symbol))
720 (saved (get symbol 'saved-value)) 717 (saved (get symbol 'saved-value))
721 (standard (get symbol 'standard-value)) 718 (standard (get symbol 'standard-value))
@@ -744,7 +741,7 @@ default value. Otherwise, set it to nil.
744 741
745Return non-nil if the `customized-value' property actually changed." 742Return non-nil if the `customized-value' property actually changed."
746 (custom-load-symbol symbol) 743 (custom-load-symbol symbol)
747 (let* ((get (or (get symbol 'custom-get) 'default-value)) 744 (let* ((get (or (get symbol 'custom-get) #'default-value))
748 (value (funcall get symbol)) 745 (value (funcall get symbol))
749 (customized (get symbol 'customized-value)) 746 (customized (get symbol 'customized-value))
750 (old (or (get symbol 'saved-value) (get symbol 'standard-value)))) 747 (old (or (get symbol 'saved-value) (get symbol 'standard-value))))
@@ -776,7 +773,7 @@ E.g. dumped variables whose default depends on run-time information."
776 ;; always do the funcall step, even if symbol was not bound before. 773 ;; always do the funcall step, even if symbol was not bound before.
777 (or (default-boundp symbol) 774 (or (default-boundp symbol)
778 (eval `(defvar ,symbol nil))) ; reset below, so any value is fine 775 (eval `(defvar ,symbol nil))) ; reset below, so any value is fine
779 (funcall (or (get symbol 'custom-set) 'set-default) 776 (funcall (or (get symbol 'custom-set) #'set-default)
780 symbol 777 symbol
781 (eval (car (or (get symbol 'saved-value) (get symbol 'standard-value)))))) 778 (eval (car (or (get symbol 'saved-value) (get symbol 'standard-value))))))
782 779
@@ -946,7 +943,7 @@ the default value for the SYMBOL to the value of EXP.
946REQUEST is a list of features we must require in order to 943REQUEST is a list of features we must require in order to
947handle SYMBOL properly. 944handle SYMBOL properly.
948COMMENT is a comment string about SYMBOL." 945COMMENT is a comment string about SYMBOL."
949 (apply 'custom-theme-set-variables 'user args)) 946 (apply #'custom-theme-set-variables 'user args))
950 947
951(defun custom-theme-set-variables (theme &rest args) 948(defun custom-theme-set-variables (theme &rest args)
952 "Initialize variables for theme THEME according to settings in ARGS. 949 "Initialize variables for theme THEME according to settings in ARGS.
@@ -994,8 +991,8 @@ COMMENT is a comment string about SYMBOL."
994 set) 991 set)
995 (when requests 992 (when requests
996 (put symbol 'custom-requests requests) 993 (put symbol 'custom-requests requests)
997 (mapc 'require requests)) 994 (mapc #'require requests))
998 (setq set (or (get symbol 'custom-set) 'custom-set-default)) 995 (setq set (or (get symbol 'custom-set) #'custom-set-default))
999 (put symbol 'saved-value (list value)) 996 (put symbol 'saved-value (list value))
1000 (put symbol 'saved-variable-comment comment) 997 (put symbol 'saved-variable-comment comment)
1001 ;; Allow for errors in the case where the setter has 998 ;; Allow for errors in the case where the setter has
@@ -1091,26 +1088,29 @@ list, in which A occurs before B if B was defined with a
1091;; they were used to supply keyword-value pairs like `:immediate', 1088;; they were used to supply keyword-value pairs like `:immediate',
1092;; `:variable-reset-string', etc. We don't use any of these, so ignore them. 1089;; `:variable-reset-string', etc. We don't use any of these, so ignore them.
1093 1090
1094(defmacro deftheme (theme &optional doc &rest ignored) 1091(defmacro deftheme (theme &optional doc &rest _ignored)
1095 "Declare THEME to be a Custom theme. 1092 "Declare THEME to be a Custom theme.
1096The optional argument DOC is a doc string describing the theme. 1093The optional argument DOC is a doc string describing the theme.
1097 1094
1098Any theme `foo' should be defined in a file called `foo-theme.el'; 1095Any theme `foo' should be defined in a file called `foo-theme.el';
1099see `custom-make-theme-feature' for more information." 1096see `custom-make-theme-feature' for more information."
1100 (declare (doc-string 2)) 1097 (declare (doc-string 2)
1098 (advertised-calling-convention (theme &optional doc) "22.1"))
1101 (let ((feature (custom-make-theme-feature theme))) 1099 (let ((feature (custom-make-theme-feature theme)))
1102 ;; It is better not to use backquote in this file, 1100 ;; It is better not to use backquote in this file,
1103 ;; because that makes a bootstrapping problem 1101 ;; because that makes a bootstrapping problem
1104 ;; if you need to recompile all the Lisp files using interpreted code. 1102 ;; if you need to recompile all the Lisp files using interpreted code.
1105 (list 'custom-declare-theme (list 'quote theme) (list 'quote feature) doc))) 1103 (list 'custom-declare-theme (list 'quote theme) (list 'quote feature) doc)))
1106 1104
1107(defun custom-declare-theme (theme feature &optional doc &rest ignored) 1105(defun custom-declare-theme (theme feature &optional doc &rest _ignored)
1108 "Like `deftheme', but THEME is evaluated as a normal argument. 1106 "Like `deftheme', but THEME is evaluated as a normal argument.
1109FEATURE is the feature this theme provides. Normally, this is a symbol 1107FEATURE is the feature this theme provides. Normally, this is a symbol
1110created from THEME by `custom-make-theme-feature'." 1108created from THEME by `custom-make-theme-feature'."
1109 (declare (advertised-calling-convention (theme feature &optional doc) "22.1"))
1111 (unless (custom-theme-name-valid-p theme) 1110 (unless (custom-theme-name-valid-p theme)
1112 (error "Custom theme cannot be named %S" theme)) 1111 (error "Custom theme cannot be named %S" theme))
1113 (add-to-list 'custom-known-themes theme) 1112 (unless (memq theme custom-known-themes)
1113 (push theme custom-known-themes))
1114 (put theme 'theme-feature feature) 1114 (put theme 'theme-feature feature)
1115 (when doc (put theme 'theme-documentation doc))) 1115 (when doc (put theme 'theme-documentation doc)))
1116 1116
@@ -1218,7 +1218,7 @@ Return t if THEME was successfully loaded, nil otherwise."
1218 (interactive 1218 (interactive
1219 (list 1219 (list
1220 (intern (completing-read "Load custom theme: " 1220 (intern (completing-read "Load custom theme: "
1221 (mapcar 'symbol-name 1221 (mapcar #'symbol-name
1222 (custom-available-themes)))) 1222 (custom-available-themes))))
1223 nil nil)) 1223 nil nil))
1224 (unless (custom-theme-name-valid-p theme) 1224 (unless (custom-theme-name-valid-p theme)
@@ -1411,9 +1411,9 @@ Setting this variable through Customize calls `enable-theme' or
1411 themes (delq theme themes))))) 1411 themes (delq theme themes)))))
1412 (enable-theme 'user) 1412 (enable-theme 'user)
1413 (custom-set-default symbol themes) 1413 (custom-set-default symbol themes)
1414 (if failures 1414 (when failures
1415 (message "Failed to enable theme: %s" 1415 (message "Failed to enable theme(s): %s"
1416 (mapconcat 'symbol-name failures ", ")))))) 1416 (mapconcat #'symbol-name failures ", "))))))
1417 1417
1418(defsubst custom-theme-enabled-p (theme) 1418(defsubst custom-theme-enabled-p (theme)
1419 "Return non-nil if THEME is enabled." 1419 "Return non-nil if THEME is enabled."
@@ -1425,7 +1425,7 @@ See `custom-enabled-themes' for a list of enabled themes."
1425 (interactive (list (intern 1425 (interactive (list (intern
1426 (completing-read 1426 (completing-read
1427 "Disable custom theme: " 1427 "Disable custom theme: "
1428 (mapcar 'symbol-name custom-enabled-themes) 1428 (mapcar #'symbol-name custom-enabled-themes)
1429 nil t)))) 1429 nil t))))
1430 (when (custom-theme-enabled-p theme) 1430 (when (custom-theme-enabled-p theme)
1431 (let ((settings (get theme 'theme-settings))) 1431 (let ((settings (get theme 'theme-settings)))
@@ -1491,7 +1491,7 @@ This function returns nil if no custom theme specifies a value for VARIABLE."
1491 (if (and valspec 1491 (if (and valspec
1492 (or (get variable 'force-value) 1492 (or (get variable 'force-value)
1493 (default-boundp variable))) 1493 (default-boundp variable)))
1494 (funcall (or (get variable 'custom-set) 'set-default) variable 1494 (funcall (or (get variable 'custom-set) #'set-default) variable
1495 (eval (car valspec)))))) 1495 (eval (car valspec))))))
1496 1496
1497(defun custom-theme-recalc-face (face) 1497(defun custom-theme-recalc-face (face)
@@ -1532,7 +1532,7 @@ Each of the arguments ARGS has this form:
1532 (VARIABLE IGNORED) 1532 (VARIABLE IGNORED)
1533 1533
1534This means reset VARIABLE. (The argument IGNORED is ignored)." 1534This means reset VARIABLE. (The argument IGNORED is ignored)."
1535 (apply 'custom-theme-reset-variables 'user args)) 1535 (apply #'custom-theme-reset-variables 'user args))
1536 1536
1537;;; The End. 1537;;; The End.
1538 1538