summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-07-28 20:03:40 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-07-28 20:03:40 +0000
commita0247dcf3990ef954108d39d913d9cccc3a1b4fe (patch)
treea27d820d1ebb44ef383f8dbbfdd68e95da1e982b /lisp
parent806bc6df0a6730551e9cc55aacc2dfa2b8dd13f1 (diff)
downloademacs-a0247dcf3990ef954108d39d913d9cccc3a1b4fe.tar.gz
emacs-a0247dcf3990ef954108d39d913d9cccc3a1b4fe.tar.bz2
emacs-a0247dcf3990ef954108d39d913d9cccc3a1b4fe.zip
(customize-read-group): New fun.
(customize-group-other-window, customize-face-other-window): Prompt before delegating to customize-(group|face). Bind pop-up-windows rather than use the other-window argument. (customize-group, customize-face): Prompt from the interactive spec. Remove args `prompt-for-group' and `other-window'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/cus-edit.el105
2 files changed, 54 insertions, 58 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eb4f2448c0e..0a55d2a837d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
2007-07-28 Stefan Monnier <monnier@iro.umontreal.ca>
+ * cus-edit.el (customize-read-group): New fun.
+ (customize-group-other-window, customize-face-other-window):
+ Prompt before delegating to customize-(group|face).
+ Bind pop-up-windows rather than use the other-window argument.
+ (customize-group, customize-face): Prompt from the interactive spec.
+ Remove args `prompt-for-group' and `other-window'.
+
* emacs-lisp/advice.el (ad-interactive-form): Re-introduce.
(ad-body-forms, ad-advised-interactive-form): Revert this part of
last change.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 203129b410c..200f173e882 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -141,9 +141,9 @@
(require 'cus-face)
(require 'wid-edit)
-(eval-when-compile
- (defvar custom-versions-load-alist) ; from cus-load
- (defvar recentf-exclude)) ; from recentf.el
+
+(defvar custom-versions-load-alist) ; from cus-load
+(defvar recentf-exclude) ; from recentf.el
(condition-case nil
(require 'cus-load)
@@ -1032,22 +1032,20 @@ then prompt for the MODE to customize."
t nil nil (if group (symbol-name major-mode))))))))
(customize-group (custom-group-of-mode mode)))
+(defun customize-read-group ()
+ (let ((completion-ignore-case t))
+ (completing-read "Customize group (default emacs): "
+ obarray
+ (lambda (symbol)
+ (or (and (get symbol 'custom-loads)
+ (not (get symbol 'custom-autoload)))
+ (get symbol 'custom-group)))
+ t)))
;;;###autoload
-(defun customize-group (&optional group prompt-for-group other-window)
+(defun customize-group (&optional group)
"Customize GROUP, which must be a customization group."
- (interactive)
- (and (null group)
- (or prompt-for-group (called-interactively-p))
- (let ((completion-ignore-case t))
- (setq group
- (completing-read "Customize group (default emacs): "
- obarray
- (lambda (symbol)
- (or (and (get symbol 'custom-loads)
- (not (get symbol 'custom-autoload)))
- (get symbol 'custom-group)))
- t))))
+ (interactive (list (customize-read-group)))
(when (stringp group)
(if (string-equal "" group)
(setq group 'emacs)
@@ -1055,25 +1053,21 @@ then prompt for the MODE to customize."
(let ((name (format "*Customize Group: %s*"
(custom-unlispify-tag-name group))))
(if (get-buffer name)
- (if other-window
- (let ((pop-up-windows t)
- (same-window-buffer-names nil)
- (same-window-regexps nil))
- (pop-to-buffer name))
- (pop-to-buffer name))
- (funcall (if other-window
- 'custom-buffer-create-other-window
- 'custom-buffer-create)
- (list (list group 'custom-group))
- name
- (concat " for group "
- (custom-unlispify-tag-name group))))))
+ (pop-to-buffer name)
+ (custom-buffer-create
+ (list (list group 'custom-group))
+ name
+ (concat " for group "
+ (custom-unlispify-tag-name group))))))
;;;###autoload
(defun customize-group-other-window (&optional group)
"Customize GROUP, which must be a customization group, in another window."
- (interactive)
- (customize-group group t t))
+ (interactive (list (customize-read-group)))
+ (let ((pop-up-windows t)
+ (same-window-buffer-names nil)
+ (same-window-regexps nil))
+ (customize-group group)))
;;;###autoload
(defalias 'customize-variable 'customize-option)
@@ -1254,41 +1248,33 @@ Emacs that is associated with version VERSION of PACKAGE."
(< minor1 minor2)))))
;;;###autoload
-(defun customize-face (&optional face prompt-for-face other-window)
+(defun customize-face (&optional face)
"Customize FACE, which should be a face name or nil.
If FACE is nil, customize all faces. If FACE is actually a
face-alias, customize the face it is aliased to.
Interactively, when point is on text which has a face specified,
suggest to customize that face, if it's customizable."
- (interactive)
- (and (null face)
- (or prompt-for-face (called-interactively-p))
- (setq face (read-face-name "Customize face" "all faces" t)))
+ (interactive (list (read-face-name "Customize face" "all faces" t)))
(if (member face '(nil ""))
(setq face (face-list)))
(if (and (listp face) (null (cdr face)))
(setq face (car face)))
- (let ((create-buffer-fn (if other-window
- 'custom-buffer-create-other-window
- 'custom-buffer-create)))
- (if (listp face)
- (funcall create-buffer-fn
- (custom-sort-items
- (mapcar (lambda (s)
- (list s 'custom-face))
- face)
- t nil)
- "*Customize Faces*")
- ;; If FACE is actually an alias, customize the face it is aliased to.
- (if (get face 'face-alias)
- (setq face (get face 'face-alias)))
- (unless (facep face)
- (error "Invalid face %S" face))
- (funcall create-buffer-fn
- (list (list face 'custom-face))
- (format "*Customize Face: %s*"
- (custom-unlispify-tag-name face))))))
+ (if (listp face)
+ (custom-buffer-create
+ (custom-sort-items
+ (mapcar (lambda (s) (list s 'custom-face)) face)
+ t nil)
+ "*Customize Faces*")
+ ;; If FACE is actually an alias, customize the face it is aliased to.
+ (if (get face 'face-alias)
+ (setq face (get face 'face-alias)))
+ (unless (facep face)
+ (error "Invalid face %S" face))
+ (custom-buffer-create
+ (list (list face 'custom-face))
+ (format "*Customize Face: %s*"
+ (custom-unlispify-tag-name face)))))
;;;###autoload
(defun customize-face-other-window (&optional face)
@@ -1297,8 +1283,11 @@ If FACE is actually a face-alias, customize the face it is aliased to.
Interactively, when point is on text which has a face specified,
suggest to customize that face, if it's customizable."
- (interactive)
- (customize-face face t t))
+ (interactive (list (read-face-name "Customize face" "all faces" t)))
+ (let ((pop-up-windows t)
+ (same-window-buffer-names nil)
+ (same-window-regexps nil))
+ (customize-face face)))
(defalias 'customize-customized 'customize-unsaved)