From 880f99622a4513520d1dd4e110428f18453a3af1 Mon Sep 17 00:00:00 2001 From: "rasmus.pank" Date: Sat, 25 May 2013 20:49:57 +0200 Subject: [PATCH 5/5] Only print subject options when necessary * ox-koma-letter.el (org-koma-letter-subject-format): default is now t * ox-koma-letter.el (org-koma-letter-template): better subject handling. If =#+OPTIONS: subject:(x,y)= then =\KOMAoption{subject}{x, y}=. If =subject:x= then =\KOMAoption{subject}{x}=. If =subject:t= then =\KOMAoption{subject}{...}= is not printed but \setkomavar{subject}{...} is printed. If =subject:nil= neither are printed. --- contrib/lisp/ox-koma-letter.el | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 4cb402e..ca20ec7 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -137,7 +137,7 @@ function may be given. Functions must return a string." :group 'org-export-koma-letter :type 'string) -(defcustom org-koma-letter-subject-format '("beforeopening" "left" "untitled") +(defcustom org-koma-letter-subject-format t "Use the title as the subject of the letter. At the time of writing the following values are allowed: @@ -162,6 +162,7 @@ English manual of 2012-07-22)" (const "titled") (const "untitled") (const :tag "No export" nil) + (const :tag "Default options" t) (string)) :group 'org-export-koma-letter) @@ -432,20 +433,16 @@ holding export options." "\\begin{document}\n\n" ;; Subject (let* ((with-subject (plist-get info :with-subject)) - (subject-format - (if (member - ;; test if subject-format is t - (cond ((symbolp with-subject) (downcase (symbol-name with-subject))) - ((stringp with-subject) (downcase with-subject)) - (t nil)) - '("true" "t")) - org-koma-letter-subject-format - with-subject)) + (subject-format (cond ((member with-subject '("true" "t" t)) nil) + ((stringp with-subject) (list with-subject)) + ((symbolp with-subject) + (list (symbol-name with-subject))) + (t with-subject))) (subject (org-export-data (plist-get info :title) info)) - (l (if (stringp subject-format) 1 (length subject-format))) + (l (length subject-format)) (y "")) (concat - (when with-subject + (when (and with-subject subject-format) (concat "\\KOMAoption{subject}{" (apply 'format -- 1.8.2.3