From 2a85bf6a8e27dafd1005505a43cf9c4aff0957ea Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 25 Oct 2015 11:24:40 +0000 Subject: * 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. --- lisp/custom.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lisp/custom.el') diff --git a/lisp/custom.el b/lisp/custom.el index c5d0e65f42b..afff8674f34 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -155,15 +155,14 @@ set to nil, as the value is no longer rogue." (unless (memq :group args) (custom-add-to-group (custom-current-group) symbol 'custom-variable)) (while args - (let ((arg (car args))) - (setq args (cdr args)) - (unless (symbolp arg) + (let ((keyword (pop args))) + (unless (symbolp keyword) (error "Junk in args %S" args)) - (let ((keyword arg) - (value (car args))) - (unless args - (error "Keyword %s is missing an argument" keyword)) - (setq args (cdr args)) + (unless args + (error "Keyword %s is missing an argument" keyword)) + (let ((value (pop args))) + ;; Can't use `pcase' because it is loaded after `custom.el' + ;; during bootstrap. See `loadup.el'. (cond ((eq keyword :initialize) (setq initialize value)) ((eq keyword :set) -- cgit v1.2.1