Mercurial > hg > xemacs-beta
diff lisp/custom/cus-edit.el @ 181:bfd6434d15b3 r20-3b17
Import from CVS: tag r20-3b17
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:53:19 +0200 |
parents | 9ad43877534d |
children | 3d6bfa290dbd |
line wrap: on
line diff
--- a/lisp/custom/cus-edit.el Mon Aug 13 09:52:21 2007 +0200 +++ b/lisp/custom/cus-edit.el Mon Aug 13 09:53:19 2007 +0200 @@ -4,7 +4,7 @@ ;; ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> ;; Keywords: help, faces -;; Version: 1.9953 +;; 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) @@ -1790,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 " `--- " " |--- ")) @@ -1814,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))) @@ -1957,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 @@ -2011,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 @@ -2033,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 @@ -2482,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")