Re: [dev] [vis] [PATCH] Set tabwidth and expandtab in config.def.h

From: Marc André Tanner <>
Date: Sun, 4 Jan 2015 18:52:00 +0100

On Sun, Jan 04, 2015 at 06:22:00PM +0100, Silvan Jegen wrote:
> On Sun, Jan 04, 2015 at 06:12:00PM +0100, Matthias Rabault wrote:
> > Thanks for the patch, I'll check it out this evening (can't yet, I'm
> > using my phone). What I was thinking of was adding code in main() that
> > alters the Editor structure according to config.def.h defines, just
> > before calling the main loop.
> When looking at the main function you can see that the editor's statusbar
> field is being set using the "config"-pointer and a corresponding function
> called editor_statusbar_set.
> If you want to follow that pattern you can add two setter functions for
> tabwidth and expandtab and set the fields that way (either using the
> Config in config or a "#define"d value).
> I wonder though if it wouldn't be cleaner to just pass a pointer to the
> Config struct to the editor_new function and dealing with the field
> value initializations there.

I agree, adding individual options to editor_new is wrong. Somebody also
sent me a patch which makes the colors used for the line numbers configurable.
He introduced

 editor_uicolors_set(Editor *ed, UIColors*)

where the UIColors struct would then be passed on to

 Win *window_new(Text*, UIColors*)

while this passing around of global configuration data is somewhat
annoying I would like to keep {editor,window}.[ch] independent from
the editor frontend implementing the specific vis/nano/sam/whatever
interface. It should thus not directly refer to global variables.

 Marc André Tanner >< >< GPG key: CF7D56C0
Received on Sun Jan 04 2015 - 18:52:00 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 04 2015 - 19:00:09 CET