diff options
| author | Stefan Monnier | 2007-07-28 20:03:40 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-07-28 20:03:40 +0000 |
| commit | a0247dcf3990ef954108d39d913d9cccc3a1b4fe (patch) | |
| tree | a27d820d1ebb44ef383f8dbbfdd68e95da1e982b | |
| parent | 806bc6df0a6730551e9cc55aacc2dfa2b8dd13f1 (diff) | |
| download | emacs-a0247dcf3990ef954108d39d913d9cccc3a1b4fe.tar.gz 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'.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/cus-edit.el | 105 |
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 @@ | |||
| 1 | 2007-07-28 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-07-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * cus-edit.el (customize-read-group): New fun. | ||
| 4 | (customize-group-other-window, customize-face-other-window): | ||
| 5 | Prompt before delegating to customize-(group|face). | ||
| 6 | Bind pop-up-windows rather than use the other-window argument. | ||
| 7 | (customize-group, customize-face): Prompt from the interactive spec. | ||
| 8 | Remove args `prompt-for-group' and `other-window'. | ||
| 9 | |||
| 3 | * emacs-lisp/advice.el (ad-interactive-form): Re-introduce. | 10 | * emacs-lisp/advice.el (ad-interactive-form): Re-introduce. |
| 4 | (ad-body-forms, ad-advised-interactive-form): Revert this part of | 11 | (ad-body-forms, ad-advised-interactive-form): Revert this part of |
| 5 | last change. | 12 | 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 @@ | |||
| 141 | 141 | ||
| 142 | (require 'cus-face) | 142 | (require 'cus-face) |
| 143 | (require 'wid-edit) | 143 | (require 'wid-edit) |
| 144 | (eval-when-compile | 144 | |
| 145 | (defvar custom-versions-load-alist) ; from cus-load | 145 | (defvar custom-versions-load-alist) ; from cus-load |
| 146 | (defvar recentf-exclude)) ; from recentf.el | 146 | (defvar recentf-exclude) ; from recentf.el |
| 147 | 147 | ||
| 148 | (condition-case nil | 148 | (condition-case nil |
| 149 | (require 'cus-load) | 149 | (require 'cus-load) |
| @@ -1032,22 +1032,20 @@ then prompt for the MODE to customize." | |||
| 1032 | t nil nil (if group (symbol-name major-mode)))))))) | 1032 | t nil nil (if group (symbol-name major-mode)))))))) |
| 1033 | (customize-group (custom-group-of-mode mode))) | 1033 | (customize-group (custom-group-of-mode mode))) |
| 1034 | 1034 | ||
| 1035 | (defun customize-read-group () | ||
| 1036 | (let ((completion-ignore-case t)) | ||
| 1037 | (completing-read "Customize group (default emacs): " | ||
| 1038 | obarray | ||
| 1039 | (lambda (symbol) | ||
| 1040 | (or (and (get symbol 'custom-loads) | ||
| 1041 | (not (get symbol 'custom-autoload))) | ||
| 1042 | (get symbol 'custom-group))) | ||
| 1043 | t))) | ||
| 1035 | 1044 | ||
| 1036 | ;;;###autoload | 1045 | ;;;###autoload |
| 1037 | (defun customize-group (&optional group prompt-for-group other-window) | 1046 | (defun customize-group (&optional group) |
| 1038 | "Customize GROUP, which must be a customization group." | 1047 | "Customize GROUP, which must be a customization group." |
| 1039 | (interactive) | 1048 | (interactive (list (customize-read-group))) |
| 1040 | (and (null group) | ||
| 1041 | (or prompt-for-group (called-interactively-p)) | ||
| 1042 | (let ((completion-ignore-case t)) | ||
| 1043 | (setq group | ||
| 1044 | (completing-read "Customize group (default emacs): " | ||
| 1045 | obarray | ||
| 1046 | (lambda (symbol) | ||
| 1047 | (or (and (get symbol 'custom-loads) | ||
| 1048 | (not (get symbol 'custom-autoload))) | ||
| 1049 | (get symbol 'custom-group))) | ||
| 1050 | t)))) | ||
| 1051 | (when (stringp group) | 1049 | (when (stringp group) |
| 1052 | (if (string-equal "" group) | 1050 | (if (string-equal "" group) |
| 1053 | (setq group 'emacs) | 1051 | (setq group 'emacs) |
| @@ -1055,25 +1053,21 @@ then prompt for the MODE to customize." | |||
| 1055 | (let ((name (format "*Customize Group: %s*" | 1053 | (let ((name (format "*Customize Group: %s*" |
| 1056 | (custom-unlispify-tag-name group)))) | 1054 | (custom-unlispify-tag-name group)))) |
| 1057 | (if (get-buffer name) | 1055 | (if (get-buffer name) |
| 1058 | (if other-window | 1056 | (pop-to-buffer name) |
| 1059 | (let ((pop-up-windows t) | 1057 | (custom-buffer-create |
| 1060 | (same-window-buffer-names nil) | 1058 | (list (list group 'custom-group)) |
| 1061 | (same-window-regexps nil)) | 1059 | name |
| 1062 | (pop-to-buffer name)) | 1060 | (concat " for group " |
| 1063 | (pop-to-buffer name)) | 1061 | (custom-unlispify-tag-name group)))))) |
| 1064 | (funcall (if other-window | ||
| 1065 | 'custom-buffer-create-other-window | ||
| 1066 | 'custom-buffer-create) | ||
| 1067 | (list (list group 'custom-group)) | ||
| 1068 | name | ||
| 1069 | (concat " for group " | ||
| 1070 | (custom-unlispify-tag-name group)))))) | ||
| 1071 | 1062 | ||
| 1072 | ;;;###autoload | 1063 | ;;;###autoload |
| 1073 | (defun customize-group-other-window (&optional group) | 1064 | (defun customize-group-other-window (&optional group) |
| 1074 | "Customize GROUP, which must be a customization group, in another window." | 1065 | "Customize GROUP, which must be a customization group, in another window." |
| 1075 | (interactive) | 1066 | (interactive (list (customize-read-group))) |
| 1076 | (customize-group group t t)) | 1067 | (let ((pop-up-windows t) |
| 1068 | (same-window-buffer-names nil) | ||
| 1069 | (same-window-regexps nil)) | ||
| 1070 | (customize-group group))) | ||
| 1077 | 1071 | ||
| 1078 | ;;;###autoload | 1072 | ;;;###autoload |
| 1079 | (defalias 'customize-variable 'customize-option) | 1073 | (defalias 'customize-variable 'customize-option) |
| @@ -1254,41 +1248,33 @@ Emacs that is associated with version VERSION of PACKAGE." | |||
| 1254 | (< minor1 minor2))))) | 1248 | (< minor1 minor2))))) |
| 1255 | 1249 | ||
| 1256 | ;;;###autoload | 1250 | ;;;###autoload |
| 1257 | (defun customize-face (&optional face prompt-for-face other-window) | 1251 | (defun customize-face (&optional face) |
| 1258 | "Customize FACE, which should be a face name or nil. | 1252 | "Customize FACE, which should be a face name or nil. |
| 1259 | If FACE is nil, customize all faces. If FACE is actually a | 1253 | If FACE is nil, customize all faces. If FACE is actually a |
| 1260 | face-alias, customize the face it is aliased to. | 1254 | face-alias, customize the face it is aliased to. |
| 1261 | 1255 | ||
| 1262 | Interactively, when point is on text which has a face specified, | 1256 | Interactively, when point is on text which has a face specified, |
| 1263 | suggest to customize that face, if it's customizable." | 1257 | suggest to customize that face, if it's customizable." |
| 1264 | (interactive) | 1258 | (interactive (list (read-face-name "Customize face" "all faces" t))) |
| 1265 | (and (null face) | ||
| 1266 | (or prompt-for-face (called-interactively-p)) | ||
| 1267 | (setq face (read-face-name "Customize face" "all faces" t))) | ||
| 1268 | (if (member face '(nil "")) | 1259 | (if (member face '(nil "")) |
| 1269 | (setq face (face-list))) | 1260 | (setq face (face-list))) |
| 1270 | (if (and (listp face) (null (cdr face))) | 1261 | (if (and (listp face) (null (cdr face))) |
| 1271 | (setq face (car face))) | 1262 | (setq face (car face))) |
| 1272 | (let ((create-buffer-fn (if other-window | 1263 | (if (listp face) |
| 1273 | 'custom-buffer-create-other-window | 1264 | (custom-buffer-create |
| 1274 | 'custom-buffer-create))) | 1265 | (custom-sort-items |
| 1275 | (if (listp face) | 1266 | (mapcar (lambda (s) (list s 'custom-face)) face) |
| 1276 | (funcall create-buffer-fn | 1267 | t nil) |
| 1277 | (custom-sort-items | 1268 | "*Customize Faces*") |
| 1278 | (mapcar (lambda (s) | 1269 | ;; If FACE is actually an alias, customize the face it is aliased to. |
| 1279 | (list s 'custom-face)) | 1270 | (if (get face 'face-alias) |
| 1280 | face) | 1271 | (setq face (get face 'face-alias))) |
| 1281 | t nil) | 1272 | (unless (facep face) |
| 1282 | "*Customize Faces*") | 1273 | (error "Invalid face %S" face)) |
| 1283 | ;; If FACE is actually an alias, customize the face it is aliased to. | 1274 | (custom-buffer-create |
| 1284 | (if (get face 'face-alias) | 1275 | (list (list face 'custom-face)) |
| 1285 | (setq face (get face 'face-alias))) | 1276 | (format "*Customize Face: %s*" |
| 1286 | (unless (facep face) | 1277 | (custom-unlispify-tag-name face))))) |
| 1287 | (error "Invalid face %S" face)) | ||
| 1288 | (funcall create-buffer-fn | ||
| 1289 | (list (list face 'custom-face)) | ||
| 1290 | (format "*Customize Face: %s*" | ||
| 1291 | (custom-unlispify-tag-name face)))))) | ||
| 1292 | 1278 | ||
| 1293 | ;;;###autoload | 1279 | ;;;###autoload |
| 1294 | (defun customize-face-other-window (&optional face) | 1280 | (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. | |||
| 1297 | 1283 | ||
| 1298 | Interactively, when point is on text which has a face specified, | 1284 | Interactively, when point is on text which has a face specified, |
| 1299 | suggest to customize that face, if it's customizable." | 1285 | suggest to customize that face, if it's customizable." |
| 1300 | (interactive) | 1286 | (interactive (list (read-face-name "Customize face" "all faces" t))) |
| 1301 | (customize-face face t t)) | 1287 | (let ((pop-up-windows t) |
| 1288 | (same-window-buffer-names nil) | ||
| 1289 | (same-window-regexps nil)) | ||
| 1290 | (customize-face face))) | ||
| 1302 | 1291 | ||
| 1303 | (defalias 'customize-customized 'customize-unsaved) | 1292 | (defalias 'customize-customized 'customize-unsaved) |
| 1304 | 1293 | ||