[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 79fac08 1/6: * lisp/custom.el (custom-declare-varia
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] master 79fac08 1/6: * lisp/custom.el (custom-declare-variable): Shorten code a bit |
Date: |
Sun, 25 Oct 2015 01:16:23 +0000 |
branch: master
commit 79fac080d277fed07b3c192890ad59d36d9f83b6
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* lisp/custom.el (custom-declare-variable): Shorten code a bit
---
lisp/custom.el | 57 ++++++++++++++++++++++---------------------------------
1 files changed, 23 insertions(+), 34 deletions(-)
diff --git a/lisp/custom.el b/lisp/custom.el
index c5d0e65..cc284ef 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -155,40 +155,29 @@ 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)
- (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))
- (cond ((eq keyword :initialize)
- (setq initialize value))
- ((eq keyword :set)
- (put symbol 'custom-set value))
- ((eq keyword :get)
- (put symbol 'custom-get value))
- ((eq keyword :require)
- (push value requests))
- ((eq keyword :risky)
- (put symbol 'risky-local-variable value))
- ((eq keyword :safe)
- (put symbol 'safe-local-variable value))
- ((eq keyword :type)
- (put symbol 'custom-type (purecopy value)))
- ((eq keyword :options)
- (if (get symbol 'custom-options)
- ;; Slow safe code to avoid duplicates.
- (mapc (lambda (option)
- (custom-add-option symbol option))
- value)
- ;; Fast code for the common case.
- (put symbol 'custom-options (copy-sequence value))))
- (t
- (custom-handle-keyword symbol keyword value
- 'custom-variable))))))
+ (let ((keyword (pop args)))
+ (unless (symbolp keyword)
+ (error "Junk in args %S" (cons keyword args)))
+ (unless args
+ (error "Keyword %s is missing an argument" keyword))
+ (let ((value (pop args)))
+ (pcase keyword
+ (`:initialize (setq initialize value))
+ (`:set (put symbol 'custom-set value))
+ (`:get (put symbol 'custom-get value))
+ (`:require (push value requests))
+ (`:risky (put symbol 'risky-local-variable value))
+ (`:safe (put symbol 'safe-local-variable value))
+ (`:type (put symbol 'custom-type (purecopy value)))
+ (`:options (if (get symbol 'custom-options)
+ ;; Slow safe code to avoid duplicates.
+ (mapc (lambda (option)
+ (custom-add-option symbol option))
+ value)
+ ;; Fast code for the common case.
+ (put symbol 'custom-options (copy-sequence value))))
+ (_ (custom-handle-keyword symbol keyword value
+ 'custom-variable))))))
(put symbol 'custom-requests requests)
;; Do the actual initialization.
(unless custom-dont-initialize
- [Emacs-diffs] master updated (b6c6629 -> 816f78c), Artur Malabarba, 2015/10/24
- [Emacs-diffs] master 79fac08 1/6: * lisp/custom.el (custom-declare-variable): Shorten code a bit,
Artur Malabarba <=
- [Emacs-diffs] master cfd9ef5 3/6: * lisp/isearch.el (search-default-regexp-mode): New variable, Artur Malabarba, 2015/10/24
- [Emacs-diffs] master c5f9ccf 4/6: * lisp/isearch.el: Generalize definition of regexp-function toggles, Artur Malabarba, 2015/10/24
- [Emacs-diffs] master fa647ec 2/6: * lisp/isearch.el: Delete redundant :group entries, Artur Malabarba, 2015/10/24
- [Emacs-diffs] master 816f78c 6/6: * lisp/isearch.el: Make character-fold search the default again, Artur Malabarba, 2015/10/24
- [Emacs-diffs] master f5f18f9 5/6: * lisp/character-fold.el: Many improvements, Artur Malabarba, 2015/10/24