emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] koma letter exporter: changing the priority of options


From: Rasmus
Subject: Re: [O] koma letter exporter: changing the priority of options
Date: Sat, 17 Aug 2013 20:16:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Rasmus <address@hidden> writes:

> Alan,
>
>> address@hidden writes:
>>
>>> Yes, this is not satisfactory (and the email and author is also
>>> problematic in this regard). We need to know whether an option was set
>>> in the file, independently of its default value. Is there a way to do
>>> this?
>>
>> Thanks to Nicolas, I've been able to create a cleaner solution: we track
>> some of the variables (ones for which we currently output something by
>> default, typically because they are set or because we choose to always
>> output something, like from-phone), and we only output the code if the
>> variable was set in the file. Thus if nothing is set, the lco file
>> wins. Note that with this approach, one can have a default in the lco
>> that is overridden by the file, for instance for foldmarks or to display
>> phone numbers.
>>
>> Regarding the name and email, we output it before the lco if they are
>> not specified in the file, and after if they are.
>>
>> What do you think of this approach? Are there other variables we should
>> track?

I spoke too early.  For example this letter no longer works as usual:

#+TITLE: test
#+OPTIONS: foldmarks:nil
* Letter
  my letter
** TO    :TO:
   someone
   somewhere

But this is because nil has a "new" meaning of "not set" as opposed to
"false".  Is this OK?  On one hand nil usually means False in ox, I
think (e.g. inline:nil → inline comments not posted), but on the other
hand nil often means not set in Emacs. . .  It is nice to having to
look at the extra setkomavariable, but I'm not sure whether it's
right.

I also find something like this ghastly:

      (unless author-set
        (when author (format "\\setkomavar{fromname}{%s}\n"
                             (org-export-data author info))))
      (unless email-set
        (when email (format "\\setkomavar{fromemail}{%s}\n" email)))
      ^^^^^^^^^^^^^^^^^^^^^^
      ;; Letter Class Option File
      (when lco
      [...]
      ))
      ;; Define "From" data.
      (when (and author author-set) (format "\\setkomavar{fromname}{%s}\n"
                                            (org-export-data author info)))
      (when from-address (format "\\setkomavar{fromaddress}{%s}\n" 
from-address))
      (when phone-number
        (format "\\setkomavar{fromphone}{%s}\n" phone-number))
      (when (and email email-set) (format "\\setkomavar{fromemail}{%s}\n" 
email))
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

But perhaps it is the only way to get what you want.  Also, with the
current setup, I can only set email before or after.  Why?  What if I
want to let PLACE be dependent on my LCO file versus my org file?

–Rasmus

-- 
When the facts change, I change my mind. What do you do, sir?




reply via email to

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