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 20:47:34 +0200

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

>> >> the buffer will contain a bunch of lines, each of them
>> >> correspoding to some object (basically, I have a vector
>> >> of these "objects", and I want to display them in some way).
>> >
>> > Sounds like a candidate for `tabulated-list-mode'.  You can
>> > use that to print lines that are composed of one or more
>> > columns, and a header line that let you sort by any column
>> > (if you want).
>> 
>> Thanks for your tip, though after consideration I ended up using
>> EWOC.
>
> It might help others if you say why.  For example, what in your
> problem context helped you decide that EWOC might be more useful
> to it than `tabulated-list-mode'?

Good point.

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.

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.

OTOH, t-l-m has some things that EWOC doesn't:

1. Automatic sorting, though this is not that difficult to achieve in
EWOC, too.  (Also, what I need is a few more complicated sorting
algorithms - for instance, one of the columns is a timestamp, and I want
to be able to sort by time *or* by time of the day alone, disregarding
the date; I's also want to be able to do sorting based on more than one
column etc.)

2. A major mode to derive from - with EWOC, I'll probably end up
deriving my mode from special-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.  As Emanuel points out, I could even do everything
myself from scratch.

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.  (I
won't write about it here too much, though, since it is a client for
a cloudy-ish service on the net which is not "free as in beer" and uses
software which is not "free as in FSF".  Moreover, the nature of the
service seems to almost *exclude* the possibility of a free version, at
least in the "as in beer" sense - "free as in FSF" might be
theoretically possible, though maybe unreasonable from business
standpoint - I see no much point in giving away server-side software
which is a basis for your rather niche business.)

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]