From 3847d0074c23d782abb1756a35b2cf44175f8684 Mon Sep 17 00:00:00 2001 From: "rasmus.pank" Date: Sun, 19 May 2013 17:32:44 +0200 Subject: [PATCH 2/4] ox-koma-letter: changed handling of subject * ox-koma-letter.el: org-koma-letter-subject-format is now a radio list. If nil neither subject format nor type is exported. * ox-koma-letter.el: allow for t value of #+OPTIONS: subject:VALUE * ox-koma-letter.el: export of subject format is independent of title, but title is not independent of :with-subject. The issue is that I could select #+OPTIONS: subject:t and this would give a wrong value. Hopefully this bevaior is better. --- contrib/lisp/ox-koma-letter.el | 55 +++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 2389025..77d21c7 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -6,7 +6,6 @@ ;; Alan Schmitt ;; Viktor Rosenfeld ;; Rasmus Pank Roulund - ;; Keywords: org, wp, tex ;; This program is free software: you can redistribute it and/or modify @@ -123,10 +122,36 @@ :group 'org-export-koma-letter :type 'string) -(defcustom org-koma-letter-use-subject "untitled" - "Use the title as the letter's subject." - :group 'org-export-koma-letter - :type 'string) +(defcustom org-koma-letter-subject-format "left" + "Use the title as the letter's subject. At the time of writing +the following values are allowed: + + - fteropening: subject after opening + - beforeopening: subject before opening + - centered: subject centered + - left:subject left-justified + - right: subject right-justified + - titled: add title/description to subject + - underlined: set subject underlined (see note in text please) + - untitled: do not add title/description to subject. + - No-export: like untitled but the title is not inserted into + the exported document. + +Please refer to the KOMA-script manual (Table 4.16. in the +English manual of 2012-07-22)" + :type '(radio (const "fteropening") + (const "beforeopening") + (const "centered") + (const "left") + (const "right") + (const "titled") + (const "underlined") + (const "untitled") + (const :tag "No-export" nil) + (string)) + :group 'org-export-koma-letter) + + (defcustom org-koma-letter-use-backaddress t "Print return address in small line above to address." @@ -179,7 +204,7 @@ Use `foldmarks:true' to activate default fold marks or (:with-phone nil "phone" org-koma-letter-use-phone) (:with-email nil "email" org-koma-letter-use-email) (:with-place nil "place" org-koma-letter-use-place) - (:with-subject nil "subject" org-koma-letter-use-subject)) + (:with-subject nil "subject" org-koma-letter-subject-format)) :translate-alist '((export-block . org-koma-letter-export-block) (export-snippet . org-koma-letter-export-snippet) (keyword . org-koma-letter-keyword) @@ -300,12 +325,18 @@ holding export options." ;; Document start "\\begin{document}\n\n" ;; Subject - (let ((with-subject (plist-get info :with-subject))) - (when with-subject - (concat - (format "\\KOMAoption{subject}{%s}\n" with-subject) - (format "\\setkomavar{subject}{%s}\n\n" - (org-export-data (plist-get info :title) info))))) + (let* ((with-subject (plist-get info :with-subject)) + (subject-format (if (member with-subject '("True" t "true" "TRUE")) + ;; FIXME: could this be done more elegantly? + ;; I.e. force lower face of with-subject if string. + org-koma-letter-subject-format + with-subject)) + (subject (org-export-data (plist-get info :title) info))) + (concat + (when with-subject + (format "\\KOMAoption{subject}{%s}\n\n" subject-format)) + (when (and subject with-subject) + (format "\\setkomavar{subject}{%s}\n\n" subject)))) ;; Letter start (format "\\begin{letter}{%%\n%s}\n\n" (or (plist-get info :to-address) "no address given")) -- 1.8.2.3