libconf-dev
[Top][All Lists]
Advanced

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

Re: [Libconf-dev] [chl <address@hidden>] [ Task #2129] solve the indent


From: dams
Subject: Re: [Libconf-dev] [chl <address@hidden>] [ Task #2129] solve the indentation problem
Date: 05 May 2003 23:55:24 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

address@hidden said:

> From: chl <address@hidden>
> Subject: [ Task #2129] solve the indentation problem
> To: address@hidden
> Date: 05 May 2003 19:43:51 +0200
> 
> (cf
> https://savannah.nongnu.org/pm/task.php?func=detailtask&project_task_id=2129&group_id=3552&group_project_id=948
> )
> 
> . let's think together about indentation
> . do we want to indent added atoms?
> 
> I think that we should keep the indentation like it was in the
> original file. For instance, if we are in a indented section, we
> should indent atoms like they are just before or just after the
> inserted atom. That will keeps files coherent.

How do we detect that an atom is indented? by looking at /^\s*/ ? That should
work : if we are inserting an atom, we can look at the number of \s at the
beginning of an existing atom in thesame section, and add it as indentation. We
have to find out what to do if we add a new section, or if there is no other
atom to look at, in the same section.

> 
> . do we want to try to respect the original indentation?
> 
> I think libconf must be able to reproduce the _same_ original
> file. (_same_ means same md5sum, if you prefer). So, my point of
> view is to respect the indentation.

To be able to reach same md5sum, we would have to keep additional spaces on the
same line, which we don't do. However, if we solve theproblem of 

atom #comment

being transformed in

#comment
atom

We'll be really near the exact same output.
Solving this comment issue is the goal of the task about "changing comment
structure". I'll try to do it for the 18th may.

Could you think about an algorythm to find out what is the indentation of the
file in th following situation :

- we add an atom in a section where there are already original atoms (should be
  trivial, we look at the /^\s+/ of the other atoms
- we add an atom in a section where there are no original atoms (maybe we
  should look at the other section, and find out what is the indentation?)
- we build the file from scratch, but with section and atoms. which indentation
  do we choose?

thx

-- 
dams




reply via email to

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