From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viktor Rosenfeld Subject: Re: [PATCH] Improve configurability of ox-koma-letter Date: Mon, 22 Apr 2013 13:27:28 +0200 Message-ID: <20130422112728.GE7821@cartman> References: <20130421175957.GA7821@cartman> <878v4adh12.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 ([208.118.235.92]:35534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUEuH-0003Ak-0L for emacs-orgmode@gnu.org; Mon, 22 Apr 2013 07:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUEuF-0000Vq-Bk for emacs-orgmode@gnu.org; Mon, 22 Apr 2013 07:27:36 -0400 Received: from mail-bk0-x235.google.com ([2a00:1450:4008:c01::235]:37119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUEuF-0000Ve-17 for emacs-orgmode@gnu.org; Mon, 22 Apr 2013 07:27:35 -0400 Received: by mail-bk0-f53.google.com with SMTP id jg9so190377bkc.12 for ; Mon, 22 Apr 2013 04:27:34 -0700 (PDT) Content-Disposition: inline In-Reply-To: <878v4adh12.fsf@pank.eu> 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: Rasmus Cc: emacs-orgmode@gnu.org Hi Rasmus, Rasmus wrote: > > * Setting of KOMA options > > > > The presence of the sender's phone and email, the letter's place and > > subject, as well as foldmarks and the backaddress are > > configurable. Consider: > > > > #+OPTIONS: subject:titled place:nil phone:t email:t foldmarks:nil backaddress:nil > > In a similar spirit to subject is firsthead. First head is displayed > by default in scrlttr2 as far as I recall, which is annoying. Is firsthead something that you change on a letter-by-letter basis? Or do you configure it once for your letters and never change it? In the latter case the configuration can be moved of to an LCO file. In the former case an option would be nice. I had to actually change the options I introduced so far for different letters (e.g., I don't want foldmarks if I send the letter by email). > If we make foldmark an option should it not be a string accepting > values from "Table 4.3.: Combinable values for the configuration of > folding marks with option foldmarks" in the KOMA-Script manual? Same as above. If I read the scrguide correctly, the foldmark variable can be set multiple times, e.g., #+BEGIN_SRC latex \KOMAoption{foldmarks}{blmtP} \KOMAoption{foldmarks}{true} #+END_SRC The first line sets the behavior (and could be moved to an LCO file), the second line can be used to switch foldmarks on or off (and could be set by the exporter). Haven't tried this though. > [...] > > +(defcustom org-koma-letter-opening "Dear Madam or Sir," > > "Letter's opening, as a string." > > :group 'org-export-koma-letter > > :type 'string) > > While I also mainly write English letters I don't think we need to > assume everyone does. I'd also opt for a default nil here. Fair enough. > [...] > > +(defcustom org-koma-letter-use-subject "untitled" > > + "Use the title as the letter's subject." > > + :group 'org-export-koma-letter > > + :type 'string) > > Perhaps the default should depend on whether a title is present? The way I understand the org exporter, a title is always present. If not explicitly set using #+TITLE it defaults to the file name or the org heading. > [...] > > +(defcustom org-koma-letter-use-place t > > + "Print the letter's place next to the date." > > + :group 'org-export-koma-letter > > + :type 'boolean) > > + > > Sorry for not testing this myself, but what is the behavior if > e.g. org-koma-letter-use-place is t but I didn't specify a place? > Will it print a nil or nothing? It will print nil. Maybe this variable should also be configured to nil then. > > > '(?k "Export with KOMA Scrlttr2" > > - ((?K "As LaTeX buffer" org-koma-letter-export-as-latex) > > - (?k "As LaTeX file" org-koma-letter-export-to-latex) > > + ((?L "As LaTeX buffer" org-koma-letter-export-as-latex) > > + (?l "As LaTeX file" org-koma-letter-export-to-latex) > > (?p "As PDF file" org-koma-letter-export-to-pdf) > > - (?O "As PDF file and open" > > + (?o "As PDF file and open" > > (lambda (a s v b) > > Another approach (which I also somehow like) is to put it under the > LaTeX menu. E.g. like beamer or like org-ravel ¹ I didn't know this was possible. I don't care either way, but I suppose an advantage would be that some commands could be then consolidated to save space. > > + (let ((with-place (plist-get info :with-place)) > > + (place (plist-get info :place))) > > + (when (or place (not with-place)) > > + (format "\\setkomavar{place}{%s}\n" (if with-place place "")))) > > Wouldn't this work better: E.g. it wouldn't allow a place when place > is nil or when with-place is nil? > > (when (and place (not with-place)) > (format "\\setkomavar{place}{%s}\n" place )) This will print the place if it is configured somewhere, even if =place:nil= is set in #+OPTIONS. Note that I use the empty string "" to surpress the space in my code. For example, I have in my LCO file #+BEGIN_SRC latex \setkomavar{place}{Berlin} #+END_SRC That is, the space is usually printed in every letter. If I use #+OPTIONS: place:nil in a particular letter, the following code is emitted: #+BEGIN_SRC latex \LoadLetterOption{myletter.lco} % place is set here \setkomavar{place}{} % this surpresses the printing of place #+END_SRC > > + ;; KOMA options > > + (let ((with-backaddress (plist-get info :with-backaddress)) > > + (with-foldmarks (plist-get info :with-foldmarks)) > > + (with-phone (plist-get info :with-phone)) > > + (with-email (plist-get info :with-email))) > > + (concat > > + (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false")) > > + (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks "true" "false")) > > + (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false")) > > + (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" > > "false")))) > > Relating to configurable foldmarks: > > (if with-foldmarks > (format "\\KOMAoption{foldmarks}{%s}\n" (if foldmarks > foldmarks true))) > > (untested). I would rather adapt the with-foldmarks option to accept a string rather than adding another foldmarks variable. Cheers, Viktor > > –Rasmus > > Footnotes: >  ¹ https://github.com/chasberry/orgmode-accessories > > -- > When the facts change, I change my mind. What do you do, sir? >