1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-29 07:58:21 +00:00

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.
This commit is contained in:
Nicolas Goaziou 2014-09-20 21:32:52 +02:00
parent aaa7aa983d
commit 8771dafd7c

View File

@ -391,7 +391,7 @@ was not present."
(:lco "LCO" nil org-koma-letter-class-option-file) (:lco "LCO" nil org-koma-letter-class-option-file)
(:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) t) (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) t)
(:author-changed-in-buffer-p "AUTHOR" nil nil 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) (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
(:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t) (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t)
(:to-address "TO_ADDRESS" nil nil newline) (: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 `ox-koma-letter' allows two ways to specify TO and FROM. If both
are present return the preferred one as determined by are present return the preferred one as determined by
`org-koma-letter-prefer-special-headings'." `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))) (headline (org-koma-letter--get-tagged-contents key)))
(replace-regexp-in-string (replace-regexp-in-string
"\n" "\\\\\\\\\n" "\n" "\\\\\\\\\n"
(org-trim (org-trim
(or (if (plist-get info :special-headings) (or headline option) (if (plist-get info :special-headings) (or headline option "")
(or option headline)) (or option headline ""))))))
;; Fallback values.
(if (eq key 'to) "\\mbox{}" org-koma-letter-from-address))))))
@ -618,7 +617,7 @@ holding export options."
(org-koma-letter--build-settings 'buffer info) (org-koma-letter--build-settings 'buffer info)
;; From address. ;; From address.
(let ((from-address (org-koma-letter--determine-to-and-from info 'from))) (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))) (format "\\setkomavar{fromaddress}{%s}\n" from-address)))
;; Date. ;; Date.
(format "\\date{%s}\n" (org-export-data (org-export-get-date info) info)) (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))