summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrasmus <rasmus@gmx.us>2013-08-17 18:24:36 (GMT)
committer Alan Schmitt <alan.schmitt@polytechnique.org>2013-08-27 08:09:39 (GMT)
commit55d18eed957df1de1032ab75e9cf118e272e8c63 (patch)
treee7bb0b362d86c72d2d0543e7719537716b31befe
parentc2fa90248c92963ebb936e225433c33ba4c716d2 (diff)
downloadorg-mode-55d18eed957df1de1032ab75e9cf118e272e8c63.zip
org-mode-55d18eed957df1de1032ab75e9cf118e272e8c63.tar.gz
Set opening via headline
* ox-koma-letter.el (org-koma-letter-headline-is-opening-maybe): new variable. If `t' let headlines set subject. (org-koma-letter-headline): let headline set opening. (org-koma-letter-template): let opening and closing be empty if nil. Signed-off-by: Alan Schmitt <alan.schmitt@polytechnique.org>
-rw-r--r--contrib/lisp/ox-koma-letter.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d149f9d..bb68771 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -175,7 +175,11 @@ function may be given. Functions must return a string."
:type 'string)
(defcustom org-koma-letter-opening nil
- "Letter's opening, as a string."
+ "Letter's opening, as a string.
+
+If (1) this value is nil; (2) the letter is started with a
+headline; and (3) `org-koma-letter-headline-is-opening-maybe' is
+t the value opening will be implicit set as the headline title."
:group 'org-export-koma-letter
:type 'string)
@@ -264,6 +268,13 @@ Use `foldmarks:true' to activate default fold marks or
:group 'org-export-koma-letter
:type 'string)
+(defcustom org-koma-letter-headline-is-opening-maybe t
+ "Whether a headline may be used as an opening.
+A headline is only used if #+OPENING is not set. See also
+`org-koma-letter-opening'."
+ :group 'org-export-koma-letter
+ :type 'boolean)
+
(defconst org-koma-letter-special-tags-in-letter '(to from)
"header tags related to the letter itself")
@@ -482,6 +493,10 @@ appropriate place."
(push (cons tag contents)
org-koma-letter-special-contents)
nil)
+ (unless (or (plist-get info :opening)
+ (not org-koma-letter-headline-is-opening-maybe))
+ (plist-put info :opening
+ (org-export-data (org-element-property :title headline) info)))
contents)))
@@ -584,11 +599,11 @@ holding export options."
(format "\\begin{letter}{%%\n%s}\n\n"
(org-koma-letter--determine-special-value info 'to))
;; Opening.
- (format "\\opening{%s}\n\n" (plist-get info :opening))
+ (format "\\opening{%s}\n\n" (or (plist-get info :opening) ""))
;; Letter body.
contents
;; Closing.
- (format "\n\\closing{%s}\n" (plist-get info :closing))
+ (format "\n\\closing{%s}\n" (or (plist-get info :closing) ""))
(org-koma-letter--prepare-special-contents-as-macro
(plist-get info :with-after-closing))
;; Letter end.