help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Seeking advice on writing a "line-based" major mode


From: Marcin Borkowski
Subject: Re: Seeking advice on writing a "line-based" major mode
Date: Thu, 18 Jun 2015 22:44:53 +0200

On 2015-06-18, at 21:50, Drew Adams <drew.adams@oracle.com> wrote:

> Thanks for providing more info.
>
>> 1. EWOC has built-in support for checking which entry the point is
>> on. I didn't find anything like that in tabulated-list-mode.
>
> Not sure what you mean, but that sounds like `tabulated-list-get-entry':
>
>   Return the Tabulated List entry at POS. ... defaults to point.
>
> or depending on what you mean, perhaps `tabulated-list-get-id':
>
>   Return the entry ID of the Tabulated List entry at POS.
>   ... defaults to point.

Cool.  Neither is mentioned in the Info manual, though...

>> 2. EWOC seems to be more flexible wrt the format of the entries.  In
>> my use case, each entry is a large-ish alist, converted from json by
>> json-read, and most of the entries in it should not show up at all.
>
> So you want to show only some of each alist entry.
>
>   `tabulated-list-print' calls the printer function specified by
>   `tabulated-list-printer', once for each entry.  The default
>   printer is `tabulated-list-print-entry', but a mode that keeps
>   data in an ewoc may instead specify a printer function (e.g., one
>   that calls `ewoc-enter-last'), with `tabulated-list-print-entry'
>   as the ewoc pretty-printer.
>
> and `tabulated-list-entries':
>
>   If a list, each element has the form (ID [DESC1 ... DESCN])
>   
> or it can be a function that returns such a list.
>
> In your case, one of the DESC would presumably be your alist value,
> formatted to show only some of it.
>
> I know very little about EWOC, but so far I don't really see what
> more it offers here.  (Not that I need to.  The info you provide is
> anyway helpful.) 

So it seems that the main advantage of EWOC is better (i.e., more
comprehensive) manual...

>> I's also want to be able to do sorting based on more than one
>> column
>
> Same here.  That would be a useful addition to `tabulated-list-mode'.
>
>> So basically, while the differences are significant, both tools
>> could do the job - it just happens that EWOC has the parts I didn't
>> want to code myself already done.
>
> Understood (though it's not clear to me what those parts are).

Maily the get-item-at-point, which t-l-m seems to have, too...  Also,
the sorting stuff, though this is not really relevant: I presume that
with t-l-m, I could do sorting "manually", i.e., on the underlying data
structure.

All in all, it seems that (apart from the manual) EWOC has only one
advantage for me: I already have some working code using it...

>> BTW, be assured that when I finish my tool (or at least get to
>> a production-ready beta, which seems quite close), I'll write a blog
>> post (or a few) about it, and put the code on the net somewhere.
>
> Thx. 

You're welcome, though it will take some time (I'm going for a vacation
in a few days).

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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