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 09:58:23 +0200

On 2015-06-18, at 03:50, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>> correctly that I can just safely (setq my-ewoc (ewoc-create ...)),
>> knowing that the old one will be GC'ed automatically?
>
> You don't need to re-create the ewoc, but you can instead clear it
> (e.g. with ewoc-filter) and then re-fill it.

OK, that's almost the same, but seems cleaner.  And since I'm keeping
the ewoc in a global variable (there is no point in having more than one
instance in my use-case), it is also trivial.

>> Also, I'd like to color various entries in my ewoc, using different
>> faces.  Do I get it correctly that I should assign them faces right
>> after `insert'ing them in my pretty-printing function?
>
> Sounds fine, yes.  Sometimes it's more convenient to assign the face to
> the strings before you insert them, but either way work fine.

Thanks.  I ended up with squeezing a `propertize' between `insert' and
`format'.  This has a disadvantage (AFAIU) of creating a copy of the
string, but since my ewoc won't have more than, say, 100 elements,
I don't think it will slow things down a lot.

>         Stefan

Thanks a lot,

-- 
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]