aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2007-06-14 23:08:20 +0000
committerChong Yidong2007-06-14 23:08:20 +0000
commit12bafdaa03ee9884d85e16e652356d72a1544d2b (patch)
tree7ac2d9cc5ceface9144c775dea974c3af0d79a14
parentf0db902e0105b87ef3eee8fdbda61068123c4496 (diff)
downloademacs-12bafdaa03ee9884d85e16e652356d72a1544d2b.tar.gz
emacs-12bafdaa03ee9884d85e16e652356d72a1544d2b.zip
(custom-split-regexp-maybe): Simplify.
(custom-buffer-create-internal): Simplify message. (custom-variable-tag): Reduce height to normal. (custom-variable-value-create, custom-face-value-create) (custom-visibility): New widget. (custom-visibility): New face. (custom-group-value-create): Call widget-add-documentation-string-button, using `custom-visibility'.
-rw-r--r--lisp/cus-edit.el69
1 files changed, 39 insertions, 30 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 0984fc73e43..9adb72c735c 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -501,17 +501,12 @@
501 501
502(defun custom-split-regexp-maybe (regexp) 502(defun custom-split-regexp-maybe (regexp)
503 "If REGEXP is a string, split it to a list at `\\|'. 503 "If REGEXP is a string, split it to a list at `\\|'.
504You can get the original back with from the result with: 504You can get the original back from the result with:
505 (mapconcat 'identity result \"\\|\") 505 (mapconcat 'identity result \"\\|\")
506 506
507IF REGEXP is not a string, return it unchanged." 507IF REGEXP is not a string, return it unchanged."
508 (if (stringp regexp) 508 (if (stringp regexp)
509 (let ((start 0) 509 (split-string regexp "\\\\|")
510 all)
511 (while (string-match "\\\\|" regexp start)
512 (setq all (cons (substring regexp start (match-beginning 0)) all)
513 start (match-end 0)))
514 (nreverse (cons (substring regexp start) all)))
515 regexp)) 510 regexp))
516 511
517(defun custom-variable-prompt () 512(defun custom-variable-prompt ()
@@ -1559,18 +1554,15 @@ Editing a setting changes only the text in the buffer."
1559 "Square brackets indicate"))) 1554 "Square brackets indicate")))
1560 (if init-file-user 1555 (if init-file-user
1561 (widget-insert " 1556 (widget-insert "
1562Use the setting's State button to set it or save changes in it. 1557Use the Save or Set buttons to set apply your changes.
1563Saving a change normally works by editing your Emacs init file.") 1558Saving a change normally works by editing your Emacs ")
1564 (widget-insert " 1559 (widget-insert "
1565\nSince you started Emacs with `-q', which inhibits use of the 1560\nSince you started Emacs with `-q', you cannot save settings into
1566Emacs init file, you cannot save settings into the Emacs init file.")) 1561the Emacs "))
1567 (widget-insert "\nSee ")
1568 (widget-create 'custom-manual 1562 (widget-create 'custom-manual
1569 :tag "Custom file" 1563 :tag "init file"
1570 "(emacs)Saving Customizations") 1564 "(emacs)Saving Customizations")
1571 (widget-insert 1565 (widget-insert ".\nSee ")
1572 " for information on how to save in a different file.\n
1573See ")
1574 (widget-create 'custom-manual 1566 (widget-create 'custom-manual
1575 :tag "Help" 1567 :tag "Help"
1576 :help-echo "Read the online help." 1568 :help-echo "Read the online help."
@@ -2439,13 +2431,13 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
2439(defface custom-variable-tag 2431(defface custom-variable-tag
2440 `((((class color) 2432 `((((class color)
2441 (background dark)) 2433 (background dark))
2442 (:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch)) 2434 (:foreground "light blue" :weight bold :inherit variable-pitch))
2443 (((min-colors 88) (class color) 2435 (((min-colors 88) (class color)
2444 (background light)) 2436 (background light))
2445 (:foreground "blue1" :weight bold :height 1.2 :inherit variable-pitch)) 2437 (:foreground "blue1" :weight bold :inherit variable-pitch))
2446 (((class color) 2438 (((class color)
2447 (background light)) 2439 (background light))
2448 (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch)) 2440 (:foreground "blue" :weight bold :inherit variable-pitch))
2449 (t (:weight bold))) 2441 (t (:weight bold)))
2450 "Face used for unpushable variable tags." 2442 "Face used for unpushable variable tags."
2451 :group 'custom-faces) 2443 :group 'custom-faces)
@@ -2636,15 +2628,11 @@ try matching its doc string against `custom-guess-doc-alist'."
2636 widget 'custom-magic nil))) 2628 widget 'custom-magic nil)))
2637 (widget-put widget :custom-magic magic) 2629 (widget-put widget :custom-magic magic)
2638 (push magic buttons)) 2630 (push magic buttons))
2639 ;; ### NOTE: this is ugly!!!! I need to update the :buttons property
2640 ;; before the call to `widget-default-format-handler'. Otherwise, I
2641 ;; loose my current `buttons'. This function shouldn't be called like
2642 ;; this anyway. The doc string widget should be added like the others.
2643 ;; --dv
2644 (widget-put widget :buttons buttons) 2631 (widget-put widget :buttons buttons)
2645 (insert "\n") 2632 (insert "\n")
2646 ;; Insert documentation. 2633 ;; Insert documentation.
2647 (widget-default-format-handler widget ?h) 2634 (widget-add-documentation-string-button
2635 widget :visibility-widget 'custom-visibility)
2648 2636
2649 ;; The comment field 2637 ;; The comment field
2650 (unless (eq state 'hidden) 2638 (unless (eq state 'hidden)
@@ -2984,6 +2972,21 @@ to switch between two values."
2984 ;; This call will possibly make the comment invisible 2972 ;; This call will possibly make the comment invisible
2985 (custom-redraw widget))) 2973 (custom-redraw widget)))
2986 2974
2975;;; The `custom-visibility' Widget
2976
2977(define-widget 'custom-visibility 'visibility
2978 "Show or hide a documentation string."
2979 :button-face 'custom-visibility
2980 :pressed-face 'custom-visibility
2981 :mouse-face 'highlight
2982 :pressed-face 'highlight)
2983
2984(defface custom-visibility
2985 '((t :height 0.8 :inherit link))
2986 "Face for the `custom-visibility' widget."
2987 :version "23.1"
2988 :group 'custom-faces)
2989
2987;;; The `custom-face-edit' Widget. 2990;;; The `custom-face-edit' Widget.
2988 2991
2989(define-widget 'custom-face-edit 'checklist 2992(define-widget 'custom-face-edit 'checklist
@@ -3355,7 +3358,9 @@ SPEC must be a full face spec."
3355 ;; Update buttons. 3358 ;; Update buttons.
3356 (widget-put widget :buttons buttons) 3359 (widget-put widget :buttons buttons)
3357 ;; Insert documentation. 3360 ;; Insert documentation.
3358 (widget-default-format-handler widget ?h) 3361 (widget-add-documentation-string-button
3362 widget :visibility-widget 'custom-visibility)
3363
3359 ;; The comment field 3364 ;; The comment field
3360 (unless (eq state 'hidden) 3365 (unless (eq state 'hidden)
3361 (let* ((comment (get symbol 'face-comment)) 3366 (let* ((comment (get symbol 'face-comment))
@@ -3927,7 +3932,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
3927 ;; Insert documentation. 3932 ;; Insert documentation.
3928 (if (and (eq custom-buffer-style 'links) (> level 1)) 3933 (if (and (eq custom-buffer-style 'links) (> level 1))
3929 (widget-put widget :documentation-indent 0)) 3934 (widget-put widget :documentation-indent 0))
3930 (widget-default-format-handler widget ?h)) 3935 (widget-add-documentation-string-button
3936 widget :visibility-widget 'custom-visibility))
3937
3931 ;; Nested style. 3938 ;; Nested style.
3932 (t ;Visible. 3939 (t ;Visible.
3933 ;; Add parent groups references above the group. 3940 ;; Add parent groups references above the group.
@@ -3935,7 +3942,7 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
3935 ;;; was made to display a group. 3942 ;;; was made to display a group.
3936 (when (eq level 1) 3943 (when (eq level 1)
3937 (if (custom-add-parent-links widget 3944 (if (custom-add-parent-links widget
3938 "Go to parent group:") 3945 "Parent group:")
3939 (insert "\n")))) 3946 (insert "\n"))))
3940 ;; Create level indicator. 3947 ;; Create level indicator.
3941 (insert-char ?\ (* custom-buffer-indent (1- level))) 3948 (insert-char ?\ (* custom-buffer-indent (1- level)))
@@ -3971,7 +3978,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
3971 ;; Update buttons. 3978 ;; Update buttons.
3972 (widget-put widget :buttons buttons) 3979 (widget-put widget :buttons buttons)
3973 ;; Insert documentation. 3980 ;; Insert documentation.
3974 (widget-default-format-handler widget ?h) 3981 (widget-add-documentation-string-button
3982 widget :visibility-widget 'custom-visibility)
3983
3975 ;; Parent groups. 3984 ;; Parent groups.
3976 (if nil ;;; This should test that the buffer 3985 (if nil ;;; This should test that the buffer
3977 ;;; was not made to display a group. 3986 ;;; was not made to display a group.