Commit 12bafdaa authored by Chong Yidong's avatar Chong Yidong
Browse files

(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'.
parent f0db902e
...@@ -501,17 +501,12 @@ ...@@ -501,17 +501,12 @@
(defun custom-split-regexp-maybe (regexp) (defun custom-split-regexp-maybe (regexp)
"If REGEXP is a string, split it to a list at `\\|'. "If REGEXP is a string, split it to a list at `\\|'.
You can get the original back with from the result with: You can get the original back from the result with:
(mapconcat 'identity result \"\\|\") (mapconcat 'identity result \"\\|\")
IF REGEXP is not a string, return it unchanged." IF REGEXP is not a string, return it unchanged."
(if (stringp regexp) (if (stringp regexp)
(let ((start 0) (split-string regexp "\\\\|")
all)
(while (string-match "\\\\|" regexp start)
(setq all (cons (substring regexp start (match-beginning 0)) all)
start (match-end 0)))
(nreverse (cons (substring regexp start) all)))
regexp)) regexp))
(defun custom-variable-prompt () (defun custom-variable-prompt ()
...@@ -1559,18 +1554,15 @@ Editing a setting changes only the text in the buffer." ...@@ -1559,18 +1554,15 @@ Editing a setting changes only the text in the buffer."
"Square brackets indicate"))) "Square brackets indicate")))
(if init-file-user (if init-file-user
(widget-insert " (widget-insert "
Use the setting's State button to set it or save changes in it. Use the Save or Set buttons to set apply your changes.
Saving a change normally works by editing your Emacs init file.") Saving a change normally works by editing your Emacs ")
(widget-insert " (widget-insert "
\nSince you started Emacs with `-q', which inhibits use of the \nSince you started Emacs with `-q', you cannot save settings into
Emacs init file, you cannot save settings into the Emacs init file.")) the Emacs "))
(widget-insert "\nSee ")
(widget-create 'custom-manual (widget-create 'custom-manual
:tag "Custom file" :tag "init file"
"(emacs)Saving Customizations") "(emacs)Saving Customizations")
(widget-insert (widget-insert ".\nSee ")
" for information on how to save in a different file.\n
See ")
(widget-create 'custom-manual (widget-create 'custom-manual
:tag "Help" :tag "Help"
:help-echo "Read the online help." :help-echo "Read the online help."
...@@ -2439,13 +2431,13 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"." ...@@ -2439,13 +2431,13 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
(defface custom-variable-tag (defface custom-variable-tag
`((((class color) `((((class color)
(background dark)) (background dark))
(:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch)) (:foreground "light blue" :weight bold :inherit variable-pitch))
(((min-colors 88) (class color) (((min-colors 88) (class color)
(background light)) (background light))
(:foreground "blue1" :weight bold :height 1.2 :inherit variable-pitch)) (:foreground "blue1" :weight bold :inherit variable-pitch))
(((class color) (((class color)
(background light)) (background light))
(:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch)) (:foreground "blue" :weight bold :inherit variable-pitch))
(t (:weight bold))) (t (:weight bold)))
"Face used for unpushable variable tags." "Face used for unpushable variable tags."
:group 'custom-faces) :group 'custom-faces)
...@@ -2636,15 +2628,11 @@ try matching its doc string against `custom-guess-doc-alist'." ...@@ -2636,15 +2628,11 @@ try matching its doc string against `custom-guess-doc-alist'."
widget 'custom-magic nil))) widget 'custom-magic nil)))
(widget-put widget :custom-magic magic) (widget-put widget :custom-magic magic)
(push magic buttons)) (push magic buttons))
;; ### NOTE: this is ugly!!!! I need to update the :buttons property
;; before the call to `widget-default-format-handler'. Otherwise, I
;; loose my current `buttons'. This function shouldn't be called like
;; this anyway. The doc string widget should be added like the others.
;; --dv
(widget-put widget :buttons buttons) (widget-put widget :buttons buttons)
(insert "\n") (insert "\n")
;; Insert documentation. ;; Insert documentation.
(widget-default-format-handler widget ?h) (widget-add-documentation-string-button
widget :visibility-widget 'custom-visibility)
;; The comment field ;; The comment field
(unless (eq state 'hidden) (unless (eq state 'hidden)
...@@ -2984,6 +2972,21 @@ to switch between two values." ...@@ -2984,6 +2972,21 @@ to switch between two values."
;; This call will possibly make the comment invisible ;; This call will possibly make the comment invisible
(custom-redraw widget))) (custom-redraw widget)))
;;; The `custom-visibility' Widget
(define-widget 'custom-visibility 'visibility
"Show or hide a documentation string."
:button-face 'custom-visibility
:pressed-face 'custom-visibility
:mouse-face 'highlight
:pressed-face 'highlight)
(defface custom-visibility
'((t :height 0.8 :inherit link))
"Face for the `custom-visibility' widget."
:version "23.1"
:group 'custom-faces)
;;; The `custom-face-edit' Widget. ;;; The `custom-face-edit' Widget.
(define-widget 'custom-face-edit 'checklist (define-widget 'custom-face-edit 'checklist
...@@ -3355,7 +3358,9 @@ SPEC must be a full face spec." ...@@ -3355,7 +3358,9 @@ SPEC must be a full face spec."
;; Update buttons. ;; Update buttons.
(widget-put widget :buttons buttons) (widget-put widget :buttons buttons)
;; Insert documentation. ;; Insert documentation.
(widget-default-format-handler widget ?h) (widget-add-documentation-string-button
widget :visibility-widget 'custom-visibility)
;; The comment field ;; The comment field
(unless (eq state 'hidden) (unless (eq state 'hidden)
(let* ((comment (get symbol 'face-comment)) (let* ((comment (get symbol 'face-comment))
...@@ -3927,7 +3932,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups." ...@@ -3927,7 +3932,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
;; Insert documentation. ;; Insert documentation.
(if (and (eq custom-buffer-style 'links) (> level 1)) (if (and (eq custom-buffer-style 'links) (> level 1))
(widget-put widget :documentation-indent 0)) (widget-put widget :documentation-indent 0))
(widget-default-format-handler widget ?h)) (widget-add-documentation-string-button
widget :visibility-widget 'custom-visibility))
;; Nested style. ;; Nested style.
(t ;Visible. (t ;Visible.
;; Add parent groups references above the group. ;; Add parent groups references above the group.
...@@ -3935,7 +3942,7 @@ If GROUPS-ONLY non-nil, return only those members that are groups." ...@@ -3935,7 +3942,7 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
;;; was made to display a group. ;;; was made to display a group.
(when (eq level 1) (when (eq level 1)
(if (custom-add-parent-links widget (if (custom-add-parent-links widget
"Go to parent group:") "Parent group:")
(insert "\n")))) (insert "\n"))))
;; Create level indicator. ;; Create level indicator.
(insert-char ?\ (* custom-buffer-indent (1- level))) (insert-char ?\ (* custom-buffer-indent (1- level)))
...@@ -3971,7 +3978,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups." ...@@ -3971,7 +3978,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
;; Update buttons. ;; Update buttons.
(widget-put widget :buttons buttons) (widget-put widget :buttons buttons)
;; Insert documentation. ;; Insert documentation.
(widget-default-format-handler widget ?h) (widget-add-documentation-string-button
widget :visibility-widget 'custom-visibility)
;; Parent groups. ;; Parent groups.
(if nil ;;; This should test that the buffer (if nil ;;; This should test that the buffer
;;; was not made to display a group. ;;; was not made to display a group.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment