1 |
;;; cus-edit.el --- tools for customizing Emacs and Lisp packages |
;;; cus-edit.el --- tools for customizing Emacs and Lisp packages |
2 |
;; |
;; |
3 |
;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
;; Copyright (C) 1996,97,1999,2000,01,02,2003 Free Software Foundation, Inc. |
4 |
;; |
;; |
5 |
;; Author: Per Abrahamsen <abraham@dina.kvl.dk> |
;; Author: Per Abrahamsen <abraham@dina.kvl.dk> |
6 |
;; Maintainer: FSF |
;; Maintainer: FSF |
1189 |
;; If we pass BUFFER to `bury-buffer', the buffer isn't removed from |
;; If we pass BUFFER to `bury-buffer', the buffer isn't removed from |
1190 |
;; the window. |
;; the window. |
1191 |
(defun custom-bury-buffer (buffer) |
(defun custom-bury-buffer (buffer) |
1192 |
(bury-buffer)) |
(with-current-buffer buffer |
1193 |
|
(bury-buffer))) |
1194 |
|
|
1195 |
(defcustom custom-buffer-done-function 'custom-bury-buffer |
(defcustom custom-buffer-done-function 'custom-bury-buffer |
1196 |
"*Function called to remove a Custom buffer when the user is done with it. |
"*Function called to remove a Custom buffer when the user is done with it. |
1206 |
:type 'integer |
:type 'integer |
1207 |
:group 'custom-buffer) |
:group 'custom-buffer) |
1208 |
|
|
1209 |
|
(defun custom-get-fresh-buffer (name) |
1210 |
|
"Get a fresh new buffer with name NAME. |
1211 |
|
If the buffer already exist, clean it up to be like new." |
1212 |
|
(let ((buf (get-buffer name))) |
1213 |
|
(if (null buf) |
1214 |
|
(get-buffer-create name) |
1215 |
|
(with-current-buffer buf |
1216 |
|
(kill-all-local-variables) |
1217 |
|
(erase-buffer) |
1218 |
|
(let ((ols (overlay-lists))) |
1219 |
|
(dolist (ol (nconc (car ols) (cdr ols))) |
1220 |
|
(delete-overlay ol))) |
1221 |
|
buf)))) |
1222 |
|
|
1223 |
;;;###autoload |
;;;###autoload |
1224 |
(defun custom-buffer-create (options &optional name description) |
(defun custom-buffer-create (options &optional name description) |
1225 |
"Create a buffer containing OPTIONS. |
"Create a buffer containing OPTIONS. |
1227 |
OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where |
1228 |
SYMBOL is a customization option, and WIDGET is a widget for editing |
SYMBOL is a customization option, and WIDGET is a widget for editing |
1229 |
that option." |
that option." |
1230 |
(unless name (setq name "*Customization*")) |
(pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*"))) |
|
(kill-buffer (get-buffer-create name)) |
|
|
(pop-to-buffer (get-buffer-create name)) |
|
1231 |
(custom-buffer-create-internal options description)) |
(custom-buffer-create-internal options description)) |
1232 |
|
|
1233 |
;;;###autoload |
;;;###autoload |
1238 |
SYMBOL is a customization option, and WIDGET is a widget for editing |
SYMBOL is a customization option, and WIDGET is a widget for editing |
1239 |
that option." |
that option." |
1240 |
(unless name (setq name "*Customization*")) |
(unless name (setq name "*Customization*")) |
|
(kill-buffer (get-buffer-create name)) |
|
1241 |
(let ((window (selected-window)) |
(let ((window (selected-window)) |
1242 |
(pop-up-windows t) |
(pop-up-windows t) |
1243 |
(special-display-buffer-names nil) |
(special-display-buffer-names nil) |
1244 |
(special-display-regexps nil) |
(special-display-regexps nil) |
1245 |
(same-window-buffer-names nil) |
(same-window-buffer-names nil) |
1246 |
(same-window-regexps nil)) |
(same-window-regexps nil)) |
1247 |
(pop-to-buffer (get-buffer-create name)) |
(pop-to-buffer (custom-get-fresh-buffer name)) |
1248 |
(custom-buffer-create-internal options description) |
(custom-buffer-create-internal options description) |
1249 |
(select-window window))) |
(select-window window))) |
1250 |
|
|
1404 |
(unless group |
(unless group |
1405 |
(setq group 'emacs)) |
(setq group 'emacs)) |
1406 |
(let ((name "*Customize Browser*")) |
(let ((name "*Customize Browser*")) |
1407 |
(kill-buffer (get-buffer-create name)) |
(pop-to-buffer (custom-get-fresh-buffer name))) |
|
(pop-to-buffer (get-buffer-create name))) |
|
1408 |
(custom-mode) |
(custom-mode) |
1409 |
(widget-insert "\ |
(widget-insert "\ |
1410 |
Square brackets show active fields; type RET or click mouse-1 |
Square brackets show active fields; type RET or click mouse-1 |
2451 |
becomes the backup value, so you can get it again." |
becomes the backup value, so you can get it again." |
2452 |
(let* ((symbol (widget-value widget)) |
(let* ((symbol (widget-value widget)) |
2453 |
(set (or (get symbol 'custom-set) 'set-default)) |
(set (or (get symbol 'custom-set) 'set-default)) |
|
(comment-widget (widget-get widget :comment-widget)) |
|
2454 |
(value (get symbol 'saved-value)) |
(value (get symbol 'saved-value)) |
2455 |
(comment (get symbol 'saved-variable-comment))) |
(comment (get symbol 'saved-variable-comment))) |
2456 |
(cond ((or value comment) |
(cond ((or value comment) |
2474 |
The value that was current before this operation |
The value that was current before this operation |
2475 |
becomes the backup value, so you can get it again." |
becomes the backup value, so you can get it again." |
2476 |
(let* ((symbol (widget-value widget)) |
(let* ((symbol (widget-value widget)) |
2477 |
(set (or (get symbol 'custom-set) 'set-default)) |
(set (or (get symbol 'custom-set) 'set-default))) |
|
(comment-widget (widget-get widget :comment-widget))) |
|
2478 |
(if (get symbol 'standard-value) |
(if (get symbol 'standard-value) |
2479 |
(progn |
(progn |
2480 |
(custom-variable-backup-value widget) |
(custom-variable-backup-value widget) |
2595 |
(unless (widget-get widget :inactive) |
(unless (widget-get widget :inactive) |
2596 |
(let ((tag (custom-face-edit-attribute-tag widget)) |
(let ((tag (custom-face-edit-attribute-tag widget)) |
2597 |
(from (copy-marker (widget-get widget :from))) |
(from (copy-marker (widget-get widget :from))) |
|
(to (widget-get widget :to)) |
|
2598 |
(value (widget-value widget)) |
(value (widget-value widget)) |
2599 |
(inhibit-read-only t) |
(inhibit-read-only t) |
2600 |
(inhibit-modification-hooks t)) |
(inhibit-modification-hooks t)) |
3735 |
(and (not (boundp symbol)) |
(and (not (boundp symbol)) |
3736 |
(not (eq (get symbol 'force-value) |
(not (eq (get symbol 'force-value) |
3737 |
'rogue)))))) |
'rogue)))))) |
3738 |
(comment (get symbol 'saved-variable-comment)) |
(comment (get symbol 'saved-variable-comment))) |
|
sep) |
|
3739 |
;; Check `requests'. |
;; Check `requests'. |
3740 |
(dolist (request requests) |
(dolist (request requests) |
3741 |
(when (and (symbolp request) (not (featurep request))) |
(when (and (symbolp request) (not (featurep request))) |