From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alin Soare Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode Subject: Re: format text in TreeWidget. Date: Mon, 10 Jan 2011 23:04:53 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e659f534c8b2bf04998451ca X-Trace: dough.gmane.org 1294694065 19348 80.91.229.12 (10 Jan 2011 21:14:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 10 Jan 2011 21:14:25 +0000 (UTC) To: Emacs Dev , emacs-orgmode@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 10 22:14:19 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PcP4A-0000Jo-FN for ged-emacs-devel@m.gmane.org; Mon, 10 Jan 2011 22:14:14 +0100 Original-Received: from localhost ([127.0.0.1]:39525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcP49-0007GO-Ca for ged-emacs-devel@m.gmane.org; Mon, 10 Jan 2011 16:14:13 -0500 Original-Received: from [140.186.70.92] (port=34988 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PcP41-0007FV-CR for emacs-devel@gnu.org; Mon, 10 Jan 2011 16:14:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PcP40-0007dD-BU for emacs-devel@gnu.org; Mon, 10 Jan 2011 16:14:05 -0500 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:39939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PcP3z-0007cs-SW; Mon, 10 Jan 2011 16:14:04 -0500 Original-Received: by wyj26 with SMTP id 26so20688399wyj.0 for ; Mon, 10 Jan 2011 13:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=4vxCzI5FSrmK17iSkbrkiNkEExiamQggPNAZpVyP1vU=; b=YOoTIUQ8u+By+BrLF/wEIeoXjH/LpoYTqUUBLBeUJU+PjqpEWsjOlvp2tVIyMdyw/v aCo2XUneFjjxyr8NDMA535b1WQ1e7ru+bZgRx4yPpvkW/c1oSR9a0J9V11DG/U0St1eO 50znayEiIb/JUxwP4/fcK9fDjuaP3QW2z1TGc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=KTtrWkyh4G72PBmXGeyyQxPrcZp5hpFm+YL76rWnDgRQlQA8CpGLx8iG9Ny0+GIbRu H9pnoyr//B9yHM8WaUWje1Pmf7IVkUpgFV0yn90dfBvHi7xi5Ja6G0aw4jGSchdeNe+z cP8z/NuCbYGwfGsDBzqNGTljPkwi3Uo01DwXo= Original-Received: by 10.227.137.76 with SMTP id v12mr18960771wbt.47.1294693493678; Mon, 10 Jan 2011 13:04:53 -0800 (PST) Original-Received: by 10.227.38.162 with HTTP; Mon, 10 Jan 2011 13:04:53 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134418 gmane.emacs.orgmode:35940 Archived-At: --0016e659f534c8b2bf04998451ca Content-Type: text/plain; charset=UTF-8 I generate the tree in the following order: XML - (xml-parse-tag) -> LISP - (defining xml-tags as lisp functions) -> tree-widget format. I can insert to te level "xml-tags as lisp functions" an accumulator to help me know the :level N of every tree-widget element. N can represens the number of columns at the beginning of a line used by "group" ||||||||| [N times] Supposing you have a (:level N) element for every element of tree-widget, how do you define a fill-paragraph function in tree-widget mode ? Please help from the author of tree-widget and everybody else who knows it . Alin. 2011/1/10 Alin Soare > > No. > > Thanks for your answer. > > No, your answer is wrong. > > You did not understand what I meant. > > I answer you so: > > I do not like to create a tree like this : > > > |- aaaaaaaaaaaaa > aaaaaaaaaaaaaaa > |- bbbbbbbbbbbbb > bbbbbbbbbbbbbbb > `cccccccccccccccc > ccccccccccccccccc > > but like this: > > > |- aaaaaaaaaaaaaaaaaaa > | aaaaaaaaaaaaaaaaaaa > |- bbbbbbbbbbbbbbbbbbb > | bbbbbbbbbbbbbbbbbbbb > |-ccccccccccccccccccccccc > `ccccccccccccccccccccccc > > > In other words: > > Is there a function fill-paragraph for tree-mode ? > > > Thanks. > > Alin > > > > > > > > > > > > > > > > > > Alin Soare writes: > > > I did write the following code. > > > > As the :tag text is very long on some lines, and pass over the end the > > line, it is displayed on myltiple lines, and the tree looks spoiled. I > > wish to make the tree widget show the text formatted correctly, and on > > maximum N columns. > > Hm, this somehow works, but is not perfect: > > --8<---------------cut here---------------start------------->8--- > (widget-create 'tree-widget > :node '(push-button :tag > "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" :format "%[%t%]\n") > `(tree-widget > :tag ,(with-temp-buffer > (set-fill-column 50) > (insert "bla bla bla bla bla bla bla bla bla bla bla bla bla > bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla > bla bla bla bla bla bla bla bla bla bla bla") > (fill-paragraph) > (buffer-string))) > `(tree-widget > :tag ,(with-temp-buffer > (set-fill-column 60) > (insert "foo foo foo foo foo foo foo foo foo foo foo foo foo > foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo > foo foo foo foo foo foo foo foo foo foo foo") > (fill-paragraph) > (buffer-string))) > `(tree-widget > :tag ,(with-temp-buffer > (set-fill-column 70) > (insert "baz baz baz baz baz baz baz baz baz baz baz baz baz > baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz > baz baz baz baz baz baz baz baz baz baz baz") > (fill-paragraph) > (buffer-string)))) > --8<---------------cut here---------------end--------------->8--- > > The problem is that only the first line has correct tree lines... > > But maybe that's still a pointer into the right direction. > > Bye, > Tassilo > > > > > > --0016e659f534c8b2bf04998451ca Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I generate the tree in the following order:

XML - (xml-parse= -tag) -> LISP - (defining xml-tags as lisp functions) -> tree-widget = format.

I can insert to te level "xml-tags as lisp functions&qu= ot; an accumulator to help me know the

:level N

of every tree-widget element. N can represens the numbe= r of columns at the beginning of a line used by "group"

|= |||||||| [N times]

Supposing you have a (:level N) element for every= element of tree-widget, how do you define a fill-paragraph function in tre= e-widget mode ?

Please help from the author of tree-widget and everybody else who knows= it .


Alin.












<= div class=3D"gmail_quote">2011/1/10 Alin Soare <as1789@gmail.com>

No.

Th= anks for your answer.

No, your answer is wrong.

You did not u= nderstand what I meant.

I answer you so:

I do not like to create a tree like this :
<= br>
|- aaaaaaaaaaaaa
aaaaaaaaaaaaaaa
|- bbbbbbbbbbbbb
bbbbbbbbbbbbbbb
`cccccccccccccccc
ccccccccccccccc= cc

but like this:


|- aaaaaaaaaaaaaaaaaaa
|=C2=A0 aaaaa= aaaaaaaaaaaaaa
|- bbbbbbbbbbbbbbbbbbb
| bbbbbbbbbbbbbbbbbbbb
|-ccc= cccccccccccccccccccc
`ccccccccccccccccccccccc


In other words:

Is there a funct= ion fill-paragraph for tree-mode ?


Thanks.

Alin















<quote author= =3D"Tassilo Horn-5">
Alin Soare <as1789= @gmail.com> writes:

> I did write the following code.
&= gt;
> As the :tag text is very long on some lines, and pass over the = end the
> line, it is displayed on myltiple lines, and the tree looks spoiled. I=
> wish to make the tree widget show the text formatted correctly, and on=
> maximum N columns.

Hm, this somehow works, but is not perfe= ct:

--8<---------------cut here---------------start-------------&= gt;8---
(widget-create 'tree-widget
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 :node '(push-button :tag "xxxxxxxxxxxxxxxxxxxxxxxx= xxxxxxxxxxxxxxx" :format "%[%t%]\n")
=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(tree-widget
=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0:tag ,(with-temp-buffer
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(set-fill-co= lumn 50)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= (insert "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla b= la bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla = bla bla bla bla bla bla bla bla bla")
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(fill-paragr= aph)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(buf= fer-string)))
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(= tree-widget
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0:tag ,(with-temp= -buffer
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(= set-fill-column 60)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0(insert "foo foo foo foo foo foo foo foo foo foo foo foo = foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo= foo foo foo foo foo foo foo foo foo foo foo foo")
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(fill-paragr= aph)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(buf= fer-string)))
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(= tree-widget
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0:tag ,(with-temp= -buffer
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(= set-fill-column 70)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0(insert "baz baz baz baz baz baz baz baz baz baz baz baz = baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz= baz baz baz baz baz baz baz baz baz baz baz baz")
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(fill-paragr= aph)
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(buf= fer-string))))
--8<---------------cut here---------------end---------= ------>8---

The problem is that only the first line has correct t= ree lines...

But maybe that's still a pointer into the right direction.

Bye,
Tassilo



</quote>


--0016e659f534c8b2bf04998451ca--