aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2003-05-31 15:23:00 +0000
committerStefan Monnier2003-05-31 15:23:00 +0000
commit40627755beddfff5a4584ef8003da7ded1b2c14e (patch)
treed797386d79a5fe0a35a88afbc0267d6a1d087c0a
parentf118d83b7965edbbe2b0f3d7b1e9b92f29885abf (diff)
downloademacs-40627755beddfff5a4584ef8003da7ded1b2c14e.tar.gz
emacs-40627755beddfff5a4584ef8003da7ded1b2c14e.zip
(custom-get-fresh-buffer): New fun.
(custom-buffer-create, custom-buffer-create-other-window) (customize-browse): Use it instead of killing buffers. (custom-bury-buffer): Obey the argument. (custom-variable-reset-saved, custom-variable-reset-standard): Remove unused var `comment-widget'. (custom-face-edit-deactivate): Remove unused var `to'. (custom-save-variables): Remove unused var `sep'.
-rw-r--r--lisp/cus-edit.el37
1 files changed, 22 insertions, 15 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 0cf78ac1a0f..c7cb7d67ce4 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1,6 +1,6 @@
1;;; cus-edit.el --- tools for customizing Emacs and Lisp packages 1;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
2;; 2;;
3;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 3;; Copyright (C) 1996,97,1999,2000,01,02,2003 Free Software Foundation, Inc.
4;; 4;;
5;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 5;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -1189,7 +1189,8 @@ links: groups have links to subgroups."
1189;; If we pass BUFFER to `bury-buffer', the buffer isn't removed from 1189;; If we pass BUFFER to `bury-buffer', the buffer isn't removed from
1190;; the window. 1190;; the window.
1191(defun custom-bury-buffer (buffer) 1191(defun custom-bury-buffer (buffer)
1192 (bury-buffer)) 1192 (with-current-buffer buffer
1193 (bury-buffer)))
1193 1194
1194(defcustom custom-buffer-done-function 'custom-bury-buffer 1195(defcustom custom-buffer-done-function 'custom-bury-buffer
1195 "*Function called to remove a Custom buffer when the user is done with it. 1196 "*Function called to remove a Custom buffer when the user is done with it.
@@ -1205,6 +1206,20 @@ Called with one argument, the buffer to remove."
1205 :type 'integer 1206 :type 'integer
1206 :group 'custom-buffer) 1207 :group 'custom-buffer)
1207 1208
1209(defun custom-get-fresh-buffer (name)
1210 "Get a fresh new buffer with name NAME.
1211If 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
1208;;;###autoload 1223;;;###autoload
1209(defun custom-buffer-create (options &optional name description) 1224(defun custom-buffer-create (options &optional name description)
1210 "Create a buffer containing OPTIONS. 1225 "Create a buffer containing OPTIONS.
@@ -1212,9 +1227,7 @@ Optional NAME is the name of the buffer.
1212OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where 1227OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1213SYMBOL is a customization option, and WIDGET is a widget for editing 1228SYMBOL is a customization option, and WIDGET is a widget for editing
1214that option." 1229that option."
1215 (unless name (setq name "*Customization*")) 1230 (pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*")))
1216 (kill-buffer (get-buffer-create name))
1217 (pop-to-buffer (get-buffer-create name))
1218 (custom-buffer-create-internal options description)) 1231 (custom-buffer-create-internal options description))
1219 1232
1220;;;###autoload 1233;;;###autoload
@@ -1225,14 +1238,13 @@ OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
1225SYMBOL is a customization option, and WIDGET is a widget for editing 1238SYMBOL is a customization option, and WIDGET is a widget for editing
1226that option." 1239that option."
1227 (unless name (setq name "*Customization*")) 1240 (unless name (setq name "*Customization*"))
1228 (kill-buffer (get-buffer-create name))
1229 (let ((window (selected-window)) 1241 (let ((window (selected-window))
1230 (pop-up-windows t) 1242 (pop-up-windows t)
1231 (special-display-buffer-names nil) 1243 (special-display-buffer-names nil)
1232 (special-display-regexps nil) 1244 (special-display-regexps nil)
1233 (same-window-buffer-names nil) 1245 (same-window-buffer-names nil)
1234 (same-window-regexps nil)) 1246 (same-window-regexps nil))
1235 (pop-to-buffer (get-buffer-create name)) 1247 (pop-to-buffer (custom-get-fresh-buffer name))
1236 (custom-buffer-create-internal options description) 1248 (custom-buffer-create-internal options description)
1237 (select-window window))) 1249 (select-window window)))
1238 1250
@@ -1392,8 +1404,7 @@ Un-customize all values in this buffer. They get their standard settings."
1392 (unless group 1404 (unless group
1393 (setq group 'emacs)) 1405 (setq group 'emacs))
1394 (let ((name "*Customize Browser*")) 1406 (let ((name "*Customize Browser*"))
1395 (kill-buffer (get-buffer-create name)) 1407 (pop-to-buffer (custom-get-fresh-buffer name)))
1396 (pop-to-buffer (get-buffer-create name)))
1397 (custom-mode) 1408 (custom-mode)
1398 (widget-insert "\ 1409 (widget-insert "\
1399Square brackets show active fields; type RET or click mouse-1 1410Square brackets show active fields; type RET or click mouse-1
@@ -2440,7 +2451,6 @@ The value that was current before this operation
2440becomes the backup value, so you can get it again." 2451becomes the backup value, so you can get it again."
2441 (let* ((symbol (widget-value widget)) 2452 (let* ((symbol (widget-value widget))
2442 (set (or (get symbol 'custom-set) 'set-default)) 2453 (set (or (get symbol 'custom-set) 'set-default))
2443 (comment-widget (widget-get widget :comment-widget))
2444 (value (get symbol 'saved-value)) 2454 (value (get symbol 'saved-value))
2445 (comment (get symbol 'saved-variable-comment))) 2455 (comment (get symbol 'saved-variable-comment)))
2446 (cond ((or value comment) 2456 (cond ((or value comment)
@@ -2464,8 +2474,7 @@ restoring it to the state of a variable that has never been customized.
2464The value that was current before this operation 2474The value that was current before this operation
2465becomes the backup value, so you can get it again." 2475becomes the backup value, so you can get it again."
2466 (let* ((symbol (widget-value widget)) 2476 (let* ((symbol (widget-value widget))
2467 (set (or (get symbol 'custom-set) 'set-default)) 2477 (set (or (get symbol 'custom-set) 'set-default)))
2468 (comment-widget (widget-get widget :comment-widget)))
2469 (if (get symbol 'standard-value) 2478 (if (get symbol 'standard-value)
2470 (progn 2479 (progn
2471 (custom-variable-backup-value widget) 2480 (custom-variable-backup-value widget)
@@ -2586,7 +2595,6 @@ Also change :reverse-video to :inverse-video."
2586 (unless (widget-get widget :inactive) 2595 (unless (widget-get widget :inactive)
2587 (let ((tag (custom-face-edit-attribute-tag widget)) 2596 (let ((tag (custom-face-edit-attribute-tag widget))
2588 (from (copy-marker (widget-get widget :from))) 2597 (from (copy-marker (widget-get widget :from)))
2589 (to (widget-get widget :to))
2590 (value (widget-value widget)) 2598 (value (widget-value widget))
2591 (inhibit-read-only t) 2599 (inhibit-read-only t)
2592 (inhibit-modification-hooks t)) 2600 (inhibit-modification-hooks t))
@@ -3727,8 +3735,7 @@ or (if there were none) at the end of the buffer."
3727 (and (not (boundp symbol)) 3735 (and (not (boundp symbol))
3728 (not (eq (get symbol 'force-value) 3736 (not (eq (get symbol 'force-value)
3729 'rogue)))))) 3737 'rogue))))))
3730 (comment (get symbol 'saved-variable-comment)) 3738 (comment (get symbol 'saved-variable-comment)))
3731 sep)
3732 ;; Check `requests'. 3739 ;; Check `requests'.
3733 (dolist (request requests) 3740 (dolist (request requests)
3734 (when (and (symbolp request) (not (featurep request))) 3741 (when (and (symbolp request) (not (featurep request)))