Markus Triska wrote:
Here is a simple widget example:

    (require 'widget)
    (require 'wid-edit)

    (defvar tw-value-field nil)

    (defun test-widgets ()
      "Create some widgets."
      (interactive)
      (switch-to-buffer "*Widget Example*")
      (kill-all-local-variables)
      (let ((inhibit-read-only t))
        (erase-buffer))
      (remove-overlays)
      (widget-insert "Here is some documentation.\n\Value: ")
      (setq tw-value-field
            (widget-create 'editable-field
                           :size 50
                           :format "%v "
                           ""))
      (widget-insert "\n")
      (widget-create 'push-button
                     :notify (lambda (&rest ignore)
                               (test-widgets))
                     "Reset Form")
      (widget-insert "\n")
      (use-local-map widget-keymap)
      (widget-setup))

    (defun tw-change-value ()
      (interactive)
      (widget-value-set tw-value-field "Changed value")
      (widget-setup))

M-x test-widgets creates a buffer with 2 widgets. M-x tw-change-value
sets the editable field's value to "Changed value" at any time. This
works well if the widget's current value is the empty string. In
contrast, if you enter anything in the editable field, and then do
M-x tw-change-value, its previous value still occurs in the buffer.
Tested with CVS trunk.


Testing this I found that if I tab to the field and do

  M-: (marker-insertion-type (widget-get (widget-at (point)) :from))

it returns t which I believe mean that the marker at the field beginning moves forward when inserting text there.


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to