From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: koma letter exporter: changing the priority of options Date: Sat, 17 Aug 2013 20:16:15 +0200 Message-ID: <87vc34dvyo.fsf@gmx.us> References: <20130609180059.GA2104@kenny.local> <874nd6we8q.fsf@pank.eu> <20130720115503.GA67549@kenny.local> <87eh9s46kx.fsf@pank.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAl3D-00018w-Ic for emacs-orgmode@gnu.org; Sat, 17 Aug 2013 14:16:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VAl38-0006VF-2s for emacs-orgmode@gnu.org; Sat, 17 Aug 2013 14:16:35 -0400 Received: from plane.gmane.org ([80.91.229.3]:58224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAl37-0006V1-PP for emacs-orgmode@gnu.org; Sat, 17 Aug 2013 14:16:30 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VAl34-00067d-V9 for emacs-orgmode@gnu.org; Sat, 17 Aug 2013 20:16:26 +0200 Received: from 87-57-37-13-dynamic.dk.customer.tdc.net ([87.57.37.13]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Aug 2013 20:16:26 +0200 Received: from rasmus by 87-57-37-13-dynamic.dk.customer.tdc.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Aug 2013 20:16:26 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: alan.schmitt@polytechnique.org Rasmus 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?