Alan Schmitt <[email protected]> writes:

>>> I could not find a way to do it another way, but I'll gladly take any
>>> suggestion. What we want is:
>>> - if email is set in the file, use it;
>>> - otherwise, use the one from the lco;
>>> - otherwise, use the default one.
>>
>>     (PREAMBLE-STRING    DEFAULT-VALUES    LCO    BUFFER-LOCAL)
>>
>> where a member of DEFAULT-VALUES is a cons, e.g.
>>
>>     ("fromname" . "Rasmus").
>>
>> Then we can remove all pairs from DEFAULT-VALUES where the first first
>> element (the "key") also exists in BUFFER-LOCAL.  
>
> This could be a way to do it. However, I don't know how to detect the
> variables in the LCO file, which is why they may be duplicated in the
> tex file.

As Viktor argues, mainly ugly and fragile solutions exist to check the
LCO file (e.g. find the file with kpsewhich in texlive).  Yet, it
doesn't matter, as all you care about it the location of the variable
/depending/ on whether it's set in the buffer.

E.g. 

#+LCO: test
* my letter
  text

produces 

[...]
\setkomavar{fromemail}{[email protected]}
\LoadLetterOption{test}
[...]

which may or may not produce result in [email protected] being printed
depending on what test.lco contains.

On the other hand 

#+EMAIL: [email protected]
#+LCO: test
* my letter
  text

triggers and updatedp variable (how to automate this I'd have to think
about) and

[...]
\LoadLetterOption{test}
\setkomavar{fromemail}{[email protected]}
[...]

Is this not what you want?

–Rasmus

-- 
ツ

Reply via email to