diff lisp/cus-edit.el @ 90951:3619e7770f2e

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 793-802) - Update from CVS - Remove RCS keywords - Merge from emacs--rel--22 * emacs--rel--22 (patch 42-50) - Update from CVS - Merge from gnus--rel--5.10 - Gnus ChangeLog tweaks * gnus--rel--5.10 (patch 229-232) - Merge from emacs--devo--0, emacs--rel--22 - ChangeLog tweak - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-223
author Miles Bader <miles@gnu.org>
date Sat, 16 Jun 2007 22:32:13 +0000
parents e6fdae9180d4 fb627c8fac18
children 92feae9bddc1
line wrap: on
line diff
--- a/lisp/cus-edit.el	Sat Jun 16 21:50:56 2007 +0000
+++ b/lisp/cus-edit.el	Sat Jun 16 22:32:13 2007 +0000
@@ -501,17 +501,12 @@
 
 (defun custom-split-regexp-maybe (regexp)
   "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 \"\\|\")
 
 IF REGEXP is not a string, return it unchanged."
   (if (stringp regexp)
-      (let ((start 0)
-	    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)))
+      (split-string regexp "\\\\|")
     regexp))
 
 (defun custom-variable-prompt ()
@@ -1559,18 +1554,15 @@
 				 "Square brackets indicate")))
 	(if init-file-user
 	    (widget-insert "
-Use the setting's State button to set it or save changes in it.
-Saving a change normally works by editing your Emacs init file.")
-	    (widget-insert "
-\nSince you started Emacs with `-q', which inhibits use of the
-Emacs init file, you cannot save settings into the Emacs init file."))
-	(widget-insert "\nSee ")
+Use the Save or Set buttons to set apply your changes.
+Saving a change normally works by editing your Emacs ")
+	  (widget-insert "
+\nSince you started Emacs with `-q', you cannot save settings into
+the Emacs "))
 	(widget-create 'custom-manual
-		       :tag "Custom file"
+		       :tag "init file"
 		       "(emacs)Saving Customizations")
-	(widget-insert
-	 " for information on how to save in a different file.\n
-See ")
+	(widget-insert ".\nSee ")
 	(widget-create 'custom-manual
 		       :tag "Help"
 		       :help-echo "Read the online help."
@@ -2439,13 +2431,13 @@
 (defface custom-variable-tag
   `((((class color)
       (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)
       (background light))
-     (:foreground "blue1" :weight bold :height 1.2 :inherit variable-pitch))
+     (:foreground "blue1" :weight bold :inherit variable-pitch))
     (((class color)
       (background light))
-     (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch))
+     (:foreground "blue" :weight bold :inherit variable-pitch))
     (t (:weight bold)))
   "Face used for unpushable variable tags."
   :group 'custom-faces)
@@ -2500,7 +2492,8 @@
 (defun custom-variable-type (symbol)
   "Return a widget suitable for editing the value of SYMBOL.
 If SYMBOL has a `custom-type' property, use that.
-Otherwise, look up symbol in `custom-guess-type-alist'."
+Otherwise, try matching SYMBOL against `custom-guess-name-alist' and
+try matching its doc string against `custom-guess-doc-alist'."
   (let* ((type (or (get symbol 'custom-type)
 		   (and (not (get symbol 'standard-value))
 			(custom-guess-type symbol))
@@ -2635,15 +2628,11 @@
 		    widget 'custom-magic nil)))
 	(widget-put widget :custom-magic magic)
 	(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)
       (insert "\n")
       ;; Insert documentation.
-      (widget-default-format-handler widget ?h)
+      (widget-add-documentation-string-button
+       widget :visibility-widget 'custom-visibility)
 
       ;; The comment field
       (unless (eq state 'hidden)
@@ -2983,6 +2972,21 @@
     ;; This call will possibly make the comment invisible
     (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.
 
 (define-widget 'custom-face-edit 'checklist
@@ -3354,7 +3358,9 @@
 	   ;; Update buttons.
 	   (widget-put widget :buttons buttons)
 	   ;; Insert documentation.
-	   (widget-default-format-handler widget ?h)
+	   (widget-add-documentation-string-button
+	    widget :visibility-widget 'custom-visibility)
+
 	   ;; The comment field
 	   (unless (eq state 'hidden)
 	     (let* ((comment (get symbol 'face-comment))
@@ -3926,7 +3932,9 @@
 	   ;; Insert documentation.
 	   (if (and (eq custom-buffer-style 'links) (> level 1))
 	       (widget-put widget :documentation-indent 0))
-	   (widget-default-format-handler widget ?h))
+	   (widget-add-documentation-string-button
+	    widget :visibility-widget 'custom-visibility))
+
 	  ;; Nested style.
 	  (t				;Visible.
 	   ;; Add parent groups references above the group.
@@ -3934,7 +3942,7 @@
 		    ;;; was made to display a group.
 	       (when (eq level 1)
 		 (if (custom-add-parent-links widget
-					      "Go to parent group:")
+					      "Parent group:")
 		     (insert "\n"))))
 	   ;; Create level indicator.
 	   (insert-char ?\  (* custom-buffer-indent (1- level)))
@@ -3970,7 +3978,9 @@
 	   ;; Update buttons.
 	   (widget-put widget :buttons buttons)
 	   ;; Insert documentation.
-	   (widget-default-format-handler widget ?h)
+	   (widget-add-documentation-string-button
+	    widget :visibility-widget 'custom-visibility)
+
 	   ;; Parent groups.
 	   (if nil  ;;; This should test that the buffer
 		    ;;; was not made to display a group.