summaryrefslogtreecommitdiff
path: root/lisp/cus-edit.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-08-29 15:55:58 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-08-29 15:55:58 -0400
commit40f7e0e853bf21003fdffeac35e47616f393055d (patch)
tree25770d0dcff8956a77b577d5467caffe37fb0e0f /lisp/cus-edit.el
parent7763d67c87ae050d4e7cc28f1e0c4b14df037d2e (diff)
downloademacs-40f7e0e853bf21003fdffeac35e47616f393055d.tar.gz
Misc changes to reduce use of `(lambda...); and other cleanups.
* lisp/cus-edit.el: Use lexical-binding. (customize-push-and-save, customize-apropos) (custom-buffer-create-internal): Use closures. * lisp/progmodes/bat-mode.el (bat-mode-syntax-table): "..." are strings. * lisp/progmodes/ada-xref.el: Use setq. * lisp/net/tramp.el (with-tramp-progress-reporter): Avoid setq. * lisp/dframe.el: Use lexical-binding. (dframe-frame-mode): Fix calling convention for hooks. Use a closure. * lisp/speedbar.el (speedbar-frame-mode): Adjust call accordingly. * lisp/descr-text.el: Use lexical-binding. (describe-text-widget, describe-text-sexp, describe-property-list): Use closures. * lisp/comint.el (comint-history-isearch-push-state): Use a closure. * lisp/calculator.el: Use lexical-binding. (calculator-number-to-string): Make it work with lexical-binding. (calculator-funcall): Same and use cl-letf.
Diffstat (limited to 'lisp/cus-edit.el')
-rw-r--r--lisp/cus-edit.el41
1 files changed, 21 insertions, 20 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index b50c1a5155b..176440f91bb 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1,4 +1,4 @@
-;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
+;;; cus-edit.el --- tools for customizing Emacs and Lisp packages -*- lexical-binding:t -*-
;;
;; Copyright (C) 1996-1997, 1999-2013 Free Software Foundation, Inc.
;;
@@ -1057,8 +1057,8 @@ the resulting list value now. Otherwise, add an entry to
(let ((coding-system-for-read nil))
(customize-save-variable list-var (eval list-var)))
(add-hook 'after-init-hook
- `(lambda ()
- (customize-push-and-save ',list-var ',elts)))))
+ (lambda ()
+ (customize-push-and-save list-var elts)))))
;;;###autoload
(defun customize ()
@@ -1415,6 +1415,7 @@ suggest to customize that face, if it's customizable."
"*Customize Saved*"))))
(declare-function apropos-parse-pattern "apropos" (pattern))
+(defvar apropos-regexp)
;;;###autoload
(defun customize-apropos (pattern &optional type)
@@ -1431,23 +1432,23 @@ If TYPE is `groups', include only groups."
(require 'apropos)
(unless (memq type '(nil options faces groups))
(error "Invalid setting type %s" (symbol-name type)))
- (apropos-parse-pattern pattern)
+ (apropos-parse-pattern pattern) ;Sets apropos-regexp by side-effect: Yuck!
(let (found)
(mapatoms
- `(lambda (symbol)
- (when (string-match-p apropos-regexp (symbol-name symbol))
- ,(if (memq type '(nil groups))
- '(if (get symbol 'custom-group)
- (push (list symbol 'custom-group) found)))
- ,(if (memq type '(nil faces))
- '(if (custom-facep symbol)
- (push (list symbol 'custom-face) found)))
- ,(if (memq type '(nil options))
- `(if (and (boundp symbol)
- (eq (indirect-variable symbol) symbol)
- (or (get symbol 'saved-value)
- (custom-variable-p symbol)))
- (push (list symbol 'custom-variable) found))))))
+ (lambda (symbol)
+ (when (string-match-p apropos-regexp (symbol-name symbol))
+ (if (memq type '(nil groups))
+ (if (get symbol 'custom-group)
+ (push (list symbol 'custom-group) found)))
+ (if (memq type '(nil faces))
+ (if (custom-facep symbol)
+ (push (list symbol 'custom-face) found)))
+ (if (memq type '(nil options))
+ (if (and (boundp symbol)
+ (eq (indirect-variable symbol) symbol)
+ (or (get symbol 'saved-value)
+ (custom-variable-p symbol)))
+ (push (list symbol 'custom-variable) found))))))
(unless found
(error "No customizable %s matching %s" (symbol-name type) pattern))
(custom-buffer-create
@@ -1621,8 +1622,8 @@ or a regular expression.")
(widget-create
'editable-field
:size 40 :help-echo echo
- :action `(lambda (widget &optional event)
- (customize-apropos (split-string (widget-value widget)))))))
+ :action (lambda (widget &optional _event)
+ (customize-apropos (split-string (widget-value widget)))))))
(widget-insert " ")
(widget-create-child-and-convert
search-widget 'push-button