all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* a group as node of a tree widget
@ 2005-09-19  6:55 Masatake YAMATO
  0 siblings, 0 replies; 3+ messages in thread
From: Masatake YAMATO @ 2005-09-19  6:55 UTC (permalink / raw)
  Cc: emacs-devel

Is it possible to use a group widget as node of tree widget?

As far as trying following code, a group widget is not handled well.

(defun tree-test ()
  (interactive)

  (switch-to-buffer "TREE-GROUP-NODE-TEST")
  
  (kill-all-local-variables)
  (let ((inhibit-read-only t))
    (erase-buffer))

  (widget-create
   'tree-widget 
   :open t
   :node '(group (push-button
		  :tag "Root"
		  :format "%[%t%]\n")))

  (use-local-map widget-keymap)
  (widget-setup))

M-x tree-test and click "Root" node. Then string "Root" is gone.

Masatake YAMATO

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: a group as node of a tree widget
@ 2005-09-19  8:27 David PONCE
  2005-09-19  9:09 ` Masatake YAMATO
  0 siblings, 1 reply; 3+ messages in thread
From: David PONCE @ 2005-09-19  8:27 UTC (permalink / raw)
  Cc: emacs-devel

Hi Masatake,

> Is it possible to use a group widget as node of tree widget?
> 
> As far as trying following code, a group widget is not handled well.

You're right.  Does it work better with this patch?

Thanks for your report.

David


2005-09-19  David Ponce  <david@dponce.com>

	* tree-widget.el (tree-widget-value-create): Save the converted
	tree :node widget.

Index: tree-widget.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/tree-widget.el,v
retrieving revision 1.9
diff -c -r1.9 tree-widget.el
*** tree-widget.el	15 Aug 2005 13:00:09 -0000	1.9
--- tree-widget.el	19 Sep 2005 08:21:31 -0000
***************
*** 647,660 ****
            (when (and (not args) xpandr)
              (setq args (mapcar 'widget-convert (funcall xpandr tree)))
              (widget-put tree :args args))
            ;; Create the icon widget for the expanded tree.
            (push (widget-create-child-and-convert
!                  tree (widget-get tree (if args :open-icon :empty-icon))
!                  ;; At this point the node widget isn't yet created.
!                  :node (setq node (widget-convert node)))
                  buttons)
            ;; Create the tree node widget.
!           (push (widget-create-child tree node) children)
            ;; Update the icon :node with the created node widget.
            (widget-put (car buttons) :node (car children))
            ;; Create the tree children.
--- 647,661 ----
            (when (and (not args) xpandr)
              (setq args (mapcar 'widget-convert (funcall xpandr tree)))
              (widget-put tree :args args))
+           ;; Defer the node widget creation after icon creation.
+           (widget-put tree :node (widget-convert node))
            ;; Create the icon widget for the expanded tree.
            (push (widget-create-child-and-convert
!                  tree (widget-get tree (if args :open-icon :empty-icon)))
                  buttons)
            ;; Create the tree node widget.
!           (push (widget-create-child tree (widget-get tree :node))
!                 children)
            ;; Update the icon :node with the created node widget.
            (widget-put (car buttons) :node (car children))
            ;; Create the tree children.
***************
*** 696,709 ****
                ;; Update the icon :node with the created node widget.
                (widget-put (car buttons) :node (car children)))))
  ;;;; Collapsed node.
        ;; Create the icon widget for the collapsed tree.
        (push (widget-create-child-and-convert
!              tree (widget-get tree :close-icon)
!              ;; At this point the node widget isn't yet created.
!              :node (setq node (widget-convert node)))
              buttons)
        ;; Create the tree node widget.
!       (push (widget-create-child tree node) children)
        ;; Update the icon :node with the created node widget.
        (widget-put (car buttons) :node (car children)))
      ;; Save widget children and buttons.  The tree-widget :node child
--- 697,711 ----
                ;; Update the icon :node with the created node widget.
                (widget-put (car buttons) :node (car children)))))
  ;;;; Collapsed node.
+       ;; Defer the node widget creation after icon creation.
+       (widget-put tree :node (widget-convert node))
        ;; Create the icon widget for the collapsed tree.
        (push (widget-create-child-and-convert
!              tree (widget-get tree :close-icon))
              buttons)
        ;; Create the tree node widget.
!       (push (widget-create-child tree (widget-get tree :node))
!             children)
        ;; Update the icon :node with the created node widget.
        (widget-put (car buttons) :node (car children)))
      ;; Save widget children and buttons.  The tree-widget :node child

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: a group as node of a tree widget
  2005-09-19  8:27 a group as node of a tree widget David PONCE
@ 2005-09-19  9:09 ` Masatake YAMATO
  0 siblings, 0 replies; 3+ messages in thread
From: Masatake YAMATO @ 2005-09-19  9:09 UTC (permalink / raw)
  Cc: emacs-devel

> > Is it possible to use a group widget as node of tree widget?
> > 
> > As far as trying following code, a group widget is not handled well.
> 
> You're right.  Does it work better with this patch?
> 
> Thanks for your report.

Works fine. Thank you.

Masatake

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-19  9:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-19  8:27 a group as node of a tree widget David PONCE
2005-09-19  9:09 ` Masatake YAMATO
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19  6:55 Masatake YAMATO

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.