emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange problem with latest CVS


From: Masatake YAMATO
Subject: Re: Strange problem with latest CVS
Date: Mon, 12 Apr 2004 13:11:22 +0900 (JST)

>     How do you think about widgets?
>     I think widgets should set evaporate to their overlays by themselves.
> 
> I don't understand the question, sorry.

It seems that (at least) widgets related code doesn't set evaporate to
their overlays(*). My question was whether I should fix it.
Now, your answer is obvious. I will fix it.

Masatake YAMATO
-------------------------------------------------------------------------
(*) Produce typical problem:

1. eval the attached code.
2. Do M-x widget-example and you will get *Widget Example Buffer*.
3. Press return key at [Reset Form]
4. Overlay fills the buffer. and it should not do.

;; "Programming Example" in widget.info.

     (require 'widget)
     
     (eval-when-compile
       (require 'wid-edit))
     
     (defvar widget-example-repeat)
     
     (defun widget-example ()
       "Create the widgets from the Widget manual."
       (interactive)
       (switch-to-buffer "*Widget Example*")
       (kill-all-local-variables)
       (make-local-variable 'widget-example-repeat)
       (let ((inhibit-read-only t))
         (erase-buffer))
       (widget-insert "Here is some documentation.\n\nName: ")
       (widget-create 'editable-field
                 :size 13
                 "My Name")
       (widget-create 'menu-choice
                 :tag "Choose"
                 :value "This"
                 :help-echo "Choose me, please!"
                 :notify (lambda (widget &rest ignore)
                           (message "%s is a good choice!"
                                    (widget-value widget)))
                 '(item :tag "This option" :value "This")
                 '(choice-item "That option")
                 '(editable-field :menu-tag "No option" "Thus option"))
       (widget-insert "Address: ")
       (widget-create 'editable-field
                 "Some Place\nIn some City\nSome country.")
       (widget-insert "\nSee also ")
       (widget-create 'link
                 :notify (lambda (&rest ignore)
                           (widget-value-set widget-example-repeat
                                             '("En" "To" "Tre"))
                           (widget-setup))
                 "other work")
       (widget-insert
         " for more information.\n\nNumbers: count to three below\n")
       (setq widget-example-repeat
        (widget-create 'editable-list
                       :entry-format "%i %d %v"
                       :notify (lambda (widget &rest ignore)
                                 (let ((old (widget-get widget
                                                        ':example-length))
                                       (new (length (widget-value widget))))
                                   (unless (eq old new)
                                     (widget-put widget ':example-length new)
                                     (message "You can count to %d." new))))
                       :value '("One" "Eh, two?" "Five!")
                       '(editable-field :value "three")))
       (widget-insert "\n\nSelect multiple:\n\n")
       (widget-create 'checkbox t)
       (widget-insert " This\n")
       (widget-create 'checkbox nil)
       (widget-insert " That\n")
       (widget-create 'checkbox
                 :notify (lambda (&rest ignore) (message "Tickle"))
                 t)
       (widget-insert " Thus\n\nSelect one:\n\n")
       (widget-create 'radio-button-choice
                 :value "One"
                 :notify (lambda (widget &rest ignore)
                           (message "You selected %s"
                                    (widget-value widget)))
                 '(item "One") '(item "Another One.") '(item "A Final One."))
       (widget-insert "\n")
       (widget-create 'push-button
                 :notify (lambda (&rest ignore)
                           (if (= (length (widget-value widget-example-repeat))
                                  3)
                               (message "Congratulation!")
                             (error "Three was the count!")))
                 "Apply Form")
       (widget-insert " ")
       (widget-create 'push-button
                 :notify (lambda (&rest ignore)
                           (widget-example))
                 "Reset Form")
       (widget-insert "\n")
       (use-local-map widget-keymap)
       (widget-setup))








reply via email to

[Prev in Thread] Current Thread [Next in Thread]