diff lisp/wid-edit.el @ 18364:01666331d10f

Synched with 1.9930.
author Per Abrahamsen <abraham@dina.kvl.dk>
date Sat, 21 Jun 1997 12:48:00 +0000
parents eecbc06aed1c
children ceb9388fe67f
line wrap: on
line diff
--- a/lisp/wid-edit.el	Sat Jun 21 07:37:53 1997 +0000
+++ b/lisp/wid-edit.el	Sat Jun 21 12:48:00 1997 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: extensions
-;; Version: 1.9924
+;; Version: 1.9929
 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
 
 ;; This file is part of GNU Emacs.
@@ -439,6 +439,15 @@
 	     (setq missing nil))))
     value))
 
+(defun widget-get-indirect (widget property)
+  "In WIDGET, get the value of PROPERTY.
+If the value is a symbol, return its binding.  
+Otherwise, just return the value."
+  (let ((value (widget-get widget property)))
+    (if (symbolp value)
+	(symbol-value value)
+      value)))
+
 (defun widget-member (widget property)
   "Non-nil iff there is a definition in WIDGET for PROPERTY."
   (cond ((widget-plist-member (cdr widget) property)
@@ -667,14 +676,6 @@
   :type 'string
   :group 'widget-button)
 
-(defun widget-button-insert-indirect (widget key)
-  "Insert value of WIDGET's KEY property."
-  (let ((val (widget-get widget key)))
-    (while (and val (symbolp val))
-      (setq val (symbol-value val)))
-    (when val 
-      (insert val))))
-
 ;;; Creating Widgets.
 
 ;;;###autoload
@@ -1185,13 +1186,13 @@
 	  (setq found field))))
     found))
 
-;; This is how, for example, a variable changes its state to "set"
-;; when it is being edited.
 (defun widget-before-change (from &rest ignore)
+  ;; This is how, for example, a variable changes its state to `modified'.
+  ;; when it is being edited.
   (condition-case nil
       (let ((field (widget-field-find from)))
 	(widget-apply field :notify field))
-    (error (debug "After Change"))))
+    (error (debug "Before Change"))))
 
 (defun widget-after-change (from to old)
   ;; Adjust field size and text properties.
@@ -1236,7 +1237,8 @@
 		    (unless (eq old secret)
 		      (subst-char-in-region begin (1+ begin) old secret)
 		      (put-text-property begin (1+ begin) 'secret old))
-		    (setq begin (1+ begin)))))))))
+		    (setq begin (1+ begin)))))))
+	  (widget-apply field :notify field)))
     (error (debug "After Change"))))
 
 ;;; Widget Functions
@@ -1337,9 +1339,9 @@
 		(insert "%"))
 	       ((eq escape ?\[)
 		(setq button-begin (point))
-		(widget-button-insert-indirect widget :button-prefix))
+		(insert (widget-get-indirect widget :button-prefix)))
 	       ((eq escape ?\])
-		(widget-button-insert-indirect widget :button-suffix)
+		(insert (widget-get-indirect widget :button-suffix))
 		(setq button-end (point)))
 	       ((eq escape ?\{)
 		(setq sample-begin (point)))
@@ -1649,22 +1651,6 @@
   "Open the info node specified by WIDGET."
   (Info-goto-node (widget-value widget)))
 
-;;; The `group-link' Widget.
-
-(define-widget 'group-link 'link
-  "A link to a customization group."
-  :create 'widget-group-link-create
-  :action 'widget-group-link-action)
-
-(defun widget-group-link-create (widget)
-  (let ((state (widget-get (widget-get widget :parent) :custom-state)))
-    (if (eq state 'hidden)
-	(widget-default-create widget))))
-
-(defun widget-group-link-action (widget &optional event)
-  "Open the info node specified by WIDGET."
-  (customize-group (widget-value widget)))
-
 ;;; The `url-link' Widget.
 
 (define-widget 'url-link 'link
@@ -2635,24 +2621,6 @@
 	(widget-glyph-insert widget on "down" "down-pushed")
       (widget-glyph-insert widget off "right" "right-pushed"))))
 
-(define-widget 'group-visibility 'item
-  "An indicator and manipulator for hidden group contents."
-  :format "%[%v%]"
-  :create 'widget-group-visibility-create
-  :button-prefix ""
-  :button-suffix ""
-  :on "Hide"
-  :off "Show"
-  :value-create 'widget-visibility-value-create
-  :action 'widget-toggle-action
-  :match (lambda (widget value) t))
-
-(defun widget-group-visibility-create (widget)
-  (let ((visible (widget-value widget)))
-    (if visible
-	(insert "--------")))
-  (widget-default-create widget))
-
 ;;; The `documentation-link' Widget.
 ;;
 ;; This is a helper widget for `documentation-string'.