[Top][All Lists]
[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, 19 Apr 2004 17:27:27 +0900 (JST) |
> > 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.
> >
> > No! These overlays should not evaporate.
> > If they evaporate, the form won't work any more.
>
> Unless I misunderstand, they will evaporate only when the underlying
> buffer content gets deleted to prepare the buffer for insertion of new
> contents.
>
> As I understand it, each overlay covers one field,
> and if the field becomes empty, the overlay will evaporate.
>
> The old overlays/buttons are then completely useless to
> keep around.
>
> Is that really true? If the user adds more text in the field, isn't
> the overlay supposed to cover that new text?
Difficult to answer. At least "Programming Example" in widget's info
(attached to this mail) doesn't work well. Because `erase-buffer'
makes all overlays empty. Should remove-overlays be used in the
example? Another idea is that adding an optional argument to
`erase-buffer' like
(defun erase-buffer (&optional delete-overlay-too)
...)
If the user gives non-nil value to erase-buffer as the argument, all
overlays are also removed.
Anyway, overlays for button, sample and doc should be put evaporate.
See the attachd patch.
Masatake YAMATO
File: widget, Node: Programming Example, Next: Setting Up the Buffer, Prev:
User Interface, Up: Top
Programming Example
===================
Here is the code to implement the user interface example (see *note User
Interface::).
(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))
2004-04-19 Masatake YAMATO <address@hidden>
* wid-edit.el (widget-specify-button): Put evaporate to the
overlay for sample.
(widget-specify-sample): Put evaporate to the overlay for sample.
(widget-specify-doc): Put evaporate to the overlay for documentation.
Index: lisp/wid-edit.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/wid-edit.el,v
retrieving revision 1.124
diff -u -r1.124 wid-edit.el
--- lisp/wid-edit.el 4 Jan 2004 15:11:59 -0000 1.124
+++ lisp/wid-edit.el 19 Apr 2004 08:24:37 -0000
@@ -382,6 +382,7 @@
(setq help-echo 'widget-mouse-help))
(overlay-put overlay 'button widget)
(overlay-put overlay 'keymap (widget-get widget :keymap))
+ (overlay-put overlay 'evaporate t)
;; We want to avoid the face with image buttons.
(unless (widget-get widget :suppress-face)
(overlay-put overlay 'face (widget-apply widget :button-face-get))
@@ -401,6 +402,7 @@
"Specify sample for WIDGET between FROM and TO."
(let ((overlay (make-overlay from to nil t nil)))
(overlay-put overlay 'face (widget-apply widget :sample-face-get))
+ (overlay-put overlay 'evaporate t)
(widget-put widget :sample-overlay overlay)))
(defun widget-specify-doc (widget from to)
@@ -408,6 +410,7 @@
(let ((overlay (make-overlay from to nil t nil)))
(overlay-put overlay 'widget-doc widget)
(overlay-put overlay 'face widget-documentation-face)
+ (overlay-put overlay 'evaporate t)
(widget-put widget :doc-overlay overlay)))
(defmacro widget-specify-insert (&rest form)
- Re: Strange problem with latest CVS, (continued)
- Re: Strange problem with latest CVS, peta, 2004/04/07
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/07
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/08
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/09
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/12
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/13
- Re: Strange problem with latest CVS, David Kastrup, 2004/04/13
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/13
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/14
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/14
- Re: Strange problem with latest CVS,
Masatake YAMATO <=
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/19
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/20
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/20
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/21
Re: Strange problem with latest CVS, Richard Stallman, 2004/04/07
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/08
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/08
- Re: Strange problem with latest CVS, Richard Stallman, 2004/04/09
- Re: Strange problem with latest CVS, Masatake YAMATO, 2004/04/10
- Re: Strange problem with latest CVS, Kim F. Storm, 2004/04/10