changeset 19040:c0dc58ad2d47

Synched with 1.9954.
author Per Abrahamsen <abraham@dina.kvl.dk>
date Wed, 30 Jul 1997 12:04:50 +0000
parents 193352043c50
children 036cc3196550
files lisp/cus-edit.el
diffstat 1 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/cus-edit.el	Wed Jul 30 04:28:44 1997 +0000
+++ b/lisp/cus-edit.el	Wed Jul 30 12:04:50 1997 +0000
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: help, faces
-;; Version: 1.9951
+;; Version: 1.9954
 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
 
 ;; This file is part of GNU Emacs.
@@ -1428,7 +1428,7 @@
 	 (text (or (and (eq category 'group)
 			(nth 4 entry))
 		   (nth 3 entry)))
-	 (lisp (eq (widget-get parent :custom-form) 'lisp))
+	 (form (widget-get parent :custom-form))
 	 children)
     (while (string-match "\\`\\(.*\\)%c\\(.*\\)\\'" text)
       (setq text (concat (match-string 1 text) 
@@ -1457,8 +1457,10 @@
 	(if (eq custom-magic-show 'long)
 	    (insert text)
 	  (insert (symbol-name state)))
-	(when lisp 
-	  (insert " (lisp)"))
+	(cond ((eq form 'lisp)
+	       (insert " (lisp)"))
+	      ((eq form 'mismatch)
+	       (insert " (mismatch)")))
 	(put-text-property start (point) 'face 'custom-state-face))
       (insert "\n"))
     (when (and (eq category 'group)
@@ -1479,7 +1481,7 @@
 	     :button-suffix ""
 	     :help-echo "Change the state."
 	     :format (if hidden "%t" "%[%t%]")
-	     :tag (if lisp 
+	     :tag (if (memq form '(lisp mismatch))
 		      (concat "(" magic ")")
 		    (concat "[" magic "]")))
 	    children)
@@ -1603,7 +1605,8 @@
 		   (require load)
 		 (error nil)))
 	      ;; Don't reload a file already loaded.
-	      ((member load preloaded-file-list))
+	      ((and (boundp 'preloaded-file-list)
+		    (member load preloaded-file-list)))
 	      ((assoc load load-history))
 	      ((assoc (locate-library load) load-history))
 	      (t
@@ -1789,7 +1792,7 @@
     (when (eq state 'unknown)
       (unless (widget-apply conv :match value)
 	;; (widget-apply (widget-convert type) :match value)
-	(setq form 'lisp)))
+	(setq form 'mismatch)))
     ;; Now we can create the child widget.
     (cond ((eq custom-buffer-style 'tree)
 	   (insert prefix (if last " `--- " " |--- "))
@@ -1813,7 +1816,7 @@
 		  :action 'custom-toggle-parent
 		  nil)
 		 buttons))
-	  ((eq form 'lisp)
+	  ((memq form '(lisp mismatch))
 	   ;; In lisp mode edit the saved value when possible.
 	   (let* ((value (cond ((get symbol 'saved-value)
 				(car (get symbol 'saved-value)))
@@ -1956,10 +1959,10 @@
     ("---" ignore ignore)
     ("Don't show as Lisp expression" custom-variable-edit 
      (lambda (widget)
-       (not (eq (widget-get widget :custom-form) 'edit))))
+       (eq (widget-get widget :custom-form) 'lisp)))
     ("Show as Lisp expression" custom-variable-edit-lisp
      (lambda (widget)
-       (not (eq (widget-get widget :custom-form) 'lisp)))))
+       (eq (widget-get widget :custom-form) 'edit))))
   "Alist of actions for the `custom-variable' widget.
 Each entry has the form (NAME ACTION FILTER) where NAME is the name of
 the menu entry, ACTION is the function to call on the widget when the
@@ -2010,7 +2013,7 @@
 	  ((setq val (widget-apply child :validate))
 	   (goto-char (widget-get val :from))
 	   (error "%s" (widget-get val :error)))
-	  ((eq form 'lisp)
+	  ((memq form '(lisp mismatch))
 	   (funcall set symbol (eval (setq val (widget-value child))))
 	   (put symbol 'customized-value (list val)))
 	  (t
@@ -2032,7 +2035,7 @@
 	  ((setq val (widget-apply child :validate))
 	   (goto-char (widget-get val :from))
 	   (error "%s" (widget-get val :error)))
-	  ((eq form 'lisp)
+	  ((memq form '(lisp mismatch))
 	   (put symbol 'saved-value (list (widget-value child)))
 	   (funcall set symbol (eval (widget-value child))))
 	  (t
@@ -2481,6 +2484,13 @@
 
 (define-widget 'hook 'list
   "A emacs lisp hook"
+  :value-to-internal (lambda (widget value)
+		       (if (symbolp value)
+			   (list value)
+			 value))
+  :match (lambda (widget value)
+	   (or (symbolp value)
+	       (widget-editable-list-match widget value)))
   :convert-widget 'custom-hook-convert-widget
   :tag "Hook")
 
@@ -2586,7 +2596,7 @@
   "Insert a customize group for WIDGET in the current buffer."
   (let* ((state (widget-get widget :custom-state))
 	 (level (widget-get widget :custom-level))
-	 (indent (widget-get widget :indent))
+	 ;; (indent (widget-get widget :indent))
 	 (prefix (widget-get widget :custom-prefix))
 	 (buttons (widget-get widget :buttons))
 	 (tag (widget-get widget :tag))