From 8771dafd7c9c7355b5fe29fdef42796ce7115057 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 20 Sep 2014 21:32:52 +0200 Subject: [PATCH] ox-koma-letter: Fix "to" and "from" * contrib/lisp/ox-koma-letter.el (koma-letter): Properly display default "from" address from template. (org-koma-letter--determine-to-and-from): Do not provide a default "to" value as it might be set through a LCO file. (org-koma-letter-template): Remove trailing whitespace. --- contrib/lisp/ox-koma-letter.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 32dd1999b..597aeb8ea 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -391,7 +391,7 @@ was not present." (:lco "LCO" nil org-koma-letter-class-option-file) (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) t) (:author-changed-in-buffer-p "AUTHOR" nil nil t) - (:from-address "FROM_ADDRESS" nil nil newline) + (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline) (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number) (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t) (:to-address "TO_ADDRESS" nil nil newline) @@ -504,15 +504,14 @@ KEY should be `to' or `from'. `ox-koma-letter' allows two ways to specify TO and FROM. If both are present return the preferred one as determined by `org-koma-letter-prefer-special-headings'." - (let ((option (plist-get info (if (eq key 'to) :to-address :from-address))) + (let ((option (org-string-nw-p + (plist-get info (if (eq key 'to) :to-address :from-address)))) (headline (org-koma-letter--get-tagged-contents key))) (replace-regexp-in-string "\n" "\\\\\\\\\n" (org-trim - (or (if (plist-get info :special-headings) (or headline option) - (or option headline)) - ;; Fallback values. - (if (eq key 'to) "\\mbox{}" org-koma-letter-from-address)))))) + (if (plist-get info :special-headings) (or headline option "") + (or option headline "")))))) @@ -618,7 +617,7 @@ holding export options." (org-koma-letter--build-settings 'buffer info) ;; From address. (let ((from-address (org-koma-letter--determine-to-and-from info 'from))) - (when (org-string-nw-p from-address) + (when (org-string-nw-p from-address) (format "\\setkomavar{fromaddress}{%s}\n" from-address))) ;; Date. (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info)) -- 2.11.4.GIT