emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Cc: alan.schmitt@polytechnique.org
Subject: Re: koma letter exporter: changing the priority of options
Date: Sat, 17 Aug 2013 20:16:15 +0200	[thread overview]
Message-ID: <87vc34dvyo.fsf@gmx.us> (raw)
In-Reply-To: 87eh9s46kx.fsf@pank.eu

Rasmus <rasmus@gmx.us> writes:

> Alan,
>
>> alan.schmitt@polytechnique.org 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	other threads:[~2013-08-17 18:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-09 10:12 koma letter exporter: changing the priority of options Alan Schmitt
2013-06-09 18:00 ` Viktor Rosenfeld
2013-06-10  7:14   ` Alan Schmitt
2013-06-10  8:40   ` Rasmus
2013-07-19 13:01     ` Alan Schmitt
2013-07-19 18:57       ` Rasmus
2013-07-20 11:58         ` Viktor Rosenfeld
2013-07-20 12:59           ` Rasmus
2013-07-20 11:55       ` Viktor Rosenfeld
2013-07-22  7:14         ` Alan Schmitt
2013-07-22  7:50           ` Nicolas Goaziou
2013-07-22 12:42             ` Alan Schmitt
2013-07-22 13:17               ` Nicolas Goaziou
2013-07-22 13:45                 ` Alan Schmitt
2013-07-22 14:53           ` Alan Schmitt
2013-08-17 16:37             ` Rasmus
2013-08-17 18:16               ` Rasmus [this message]
2013-08-27  8:02                 ` Alan Schmitt
2013-08-27  8:29                   ` Alan Schmitt
2013-08-31 14:35                     ` Alan Schmitt
2013-08-31 16:05                       ` Rasmus
2013-08-28 11:26                   ` Rasmus
2013-08-28 11:43                     ` Alan Schmitt
2013-08-28 12:06                       ` Rasmus
2013-08-28 13:23                         ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vc34dvyo.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).