From f6767ff0900fa65096ca4591b71a60516c4e71c6 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sun, 24 Nov 2013 17:57:37 +0100 Subject: [PATCH 1/3] Minor fixes for ox-koma-script.el * ox-koma-letter.el (org-koma-letter-headline): Correct docstring. (org-koma-letter-template): Insert subject before document start. (org-koma-letter-headline): Fix spelling. (org-koma-letter-template): Better subject handling. --- contrib/lisp/ox-koma-letter.el | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 240de29..e4d6f7a 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -111,11 +111,15 @@ ;; \[EXTRA]")) ;; ;; Then, in your Org document, be sure to require the proper class -;; with : +;; with: ;; ;; #+LATEX_CLASS: my-letter ;; ;; Or by setting `org-koma-letter-default-class'. +;; You may possibly have to load (LaTeX) Babel as well e.g. by adding +;; it to `org-latex-packages-alist', +;; +;; (add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil)) ;;; Code: @@ -211,7 +215,6 @@ At this time the following values are allowed: - titled: add title/description to subject. - underlined: set subject underlined. - untitled: do not add title/description to subject. - - No-export: do no insert a subject even if present. Please refer to the KOMA-script manual (Table 4.16. in the English manual of 2012-07-22)." @@ -516,7 +519,7 @@ appropriate place." CONTENTS is the transcoded contents string. INFO is a plist holding export options." ;; FIXME: instead of setq'ing org-koma-letter-special-contents and - ;; callying varioues stuff it might be nice to put a big let* around the templace + ;; callying varioues stuff it might be nice to put a big let* around the template ;; as in org-groff... (concat ;; Time-stamp. @@ -585,7 +588,7 @@ holding export options." (let ((with-backaddress (plist-get info :with-backaddress)) (with-backaddress-set (plist-get info :with-backaddress-changed-in-buffer-p)) (with-foldmarks (plist-get info :with-foldmarks)) - (with-foldmarks-set + (with-foldmarks-set (not (string-equal (plist-get info :with-foldmarks-changed-in-buffer-p) "foldmarks-not-set"))) (with-phone (plist-get info :with-phone)) @@ -601,28 +604,25 @@ holding export options." (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))) (when with-email-set (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false"))))) - ;; Document start - "\\begin{document}\n\n" ;; Subject (let* ((with-subject (plist-get info :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 (length subject-format)) - (y "")) + ;; TODO: this is a bit ugly and assumes that with-subject is + ;; (a list of) symbol(s) or string(s)... + (subject-format (mapcar + (lambda (elt) (if (and elt (symbolp elt)) (symbol-name elt) elt)) + (cond ((member with-subject '("true" "t" t)) nil) + ((listp with-subject) with-subject) + (t (list with-subject))))) + (subject (org-export-data (plist-get info :title) info))) (concat (when (and with-subject subject-format) (concat "\\KOMAoption{subject}{" - (apply 'format - (dotimes (x l y) - (setq y (concat (if (> x 0) "%s," "%s") y))) - subject-format) "}\n")) + (mapconcat 'identity subject-format ",") "}\n" )) (when (and subject with-subject) (format "\\setkomavar{subject}{%s}\n\n" subject)))) + ;; Document start + "\\begin{document}\n\n" ;; Letter start (format "\\begin{letter}{%%\n%s}\n\n" (org-koma-letter--determine-to-and-from info 'to)) -- 1.8.4.2