>From 4495abd39d57abc0dd64361f852c3a638f86915b Mon Sep 17 00:00:00 2001 From: Myles English Date: Wed, 27 Jan 2016 18:18:38 +0000 Subject: [PATCH] ox-koma-letter: Add support for LOCATION koma variable * contrib/lisp/ox-koma-letter.el (koma-letter): Duplicated code used for 'place' variable, renamed as 'location' Whenever OPTION keyword contains a 'location' item or LOCATION keyword is used in the buffer, set KOMA option 'location' after LCO inclusion. --- contrib/lisp/ox-koma-letter.el | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el index 9a4686e..8afeed2 100644 --- a/contrib/lisp/ox-koma-letter.el +++ b/contrib/lisp/ox-koma-letter.el @@ -41,6 +41,7 @@ ;; - PHONE_NUMBER: see `org-koma-letter-phone-number', ;; - SIGNATURE: see `org-koma-letter-signature', ;; - PLACE: see `org-koma-letter-place', +;; - LOCATION: see `org-koma-letter-location', ;; - TO_ADDRESS: If unspecified this is set to "\mbox{}". ;; ;; TO_ADDRESS and FROM_ADDRESS can also be specified using heading @@ -58,6 +59,7 @@ ;; - phone (see `org-koma-letter-use-phone') ;; - email (see `org-koma-letter-use-email') ;; - place (see `org-koma-letter-use-place') +;; - location (see `org-koma-letter-use-location') ;; - subject, a list of format options ;; (see `org-koma-letter-subject-format') ;; - after-closing-order, a list of the ordering of headings with @@ -188,6 +190,12 @@ This option can also be set with the PLACE keyword." :group 'org-export-koma-letter :type 'string) +(defcustom org-koma-letter-location "" + "Sender's extension field, as a string. +This option can also be set with the LOCATION keyword." + :group 'org-export-koma-letter + :type 'string) + (defcustom org-koma-letter-opening "" "Letter's opening, as a string. @@ -356,6 +364,13 @@ This option can also be set with the OPTIONS keyword, e.g.: :group 'org-export-koma-letter :type 'boolean) +(defcustom org-koma-letter-use-location t + "Non-nil prints the contents of the letter's extension below the header. +This option can also be set with the OPTIONS keyword, e.g.: +\"location:nil\"." + :group 'org-export-koma-letter + :type 'boolean) + (defcustom org-koma-letter-default-class "default-koma-letter" "Default class for `org-koma-letter'. The value must be a member of `org-latex-classes'." @@ -406,6 +421,7 @@ e.g. \"title-subject:t\"." (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t) (:to-address "TO_ADDRESS" nil nil newline) (:place "PLACE" nil org-koma-letter-place) + (:location "LOCATION" nil org-koma-letter-location) (:subject "SUBJECT" nil nil parse) (:opening "OPENING" nil org-koma-letter-opening parse) (:closing "CLOSING" nil org-koma-letter-closing parse) @@ -425,6 +441,7 @@ e.g. \"title-subject:t\"." (:with-foldmarks nil "foldmarks" org-koma-letter-use-foldmarks) (:with-phone nil "phone" org-koma-letter-use-phone) (:with-place nil "place" org-koma-letter-use-place) + (:with-location nil "location" org-koma-letter-use-location) (:with-subject nil "subject" org-koma-letter-subject-format) (:with-title-as-subject nil "title-subject" org-koma-letter-prefer-subject) (:with-headline-opening nil nil org-koma-letter-headline-is-opening-maybe) @@ -435,12 +452,14 @@ e.g. \"title-subject:t\"." (:inbuffer-email "EMAIL" nil 'koma-letter:empty) (:inbuffer-phone-number "PHONE_NUMBER" nil 'koma-letter:empty) (:inbuffer-place "PLACE" nil 'koma-letter:empty) + (:inbuffer-location "LOCATION" nil 'koma-letter:empty) (:inbuffer-signature "SIGNATURE" nil 'koma-letter:empty) (:inbuffer-with-backaddress nil "backaddress" 'koma-letter:empty) (:inbuffer-with-email nil "email" 'koma-letter:empty) (:inbuffer-with-foldmarks nil "foldmarks" 'koma-letter:empty) (:inbuffer-with-phone nil "phone" 'koma-letter:empty) - (:inbuffer-with-place nil "place" 'koma-letter:empty)) + (:inbuffer-with-place nil "place" 'koma-letter:empty) + (:inbuffer-with-location nil "location" 'koma-letter:empty)) :translate-alist '((export-block . org-koma-letter-export-block) (export-snippet . org-koma-letter-export-snippet) (headline . org-koma-letter-headline) @@ -755,6 +774,14 @@ a communication channel." (format "\\setkomavar{place}{%s}\n" (if (plist-get info :with-place) (plist-get info :place) "")))) + ;; Location. + (let ((with-location-set (funcall check-scope 'with-location)) + (location-set (funcall check-scope 'location))) + (and (or (and with-location-set location-set) + (and (eq scope 'buffer) (or with-location-set location-set))) + (format "\\setkomavar{location}{%s}\n" + (if (plist-get info :with-location) (plist-get info :location) + "")))) ;; Folding marks. (and (funcall check-scope 'with-foldmarks) (let ((foldmarks (plist-get info :with-foldmarks))) -- 2.7.0