From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable Date: Wed, 27 Jan 2016 18:32:23 +0000 Message-ID: <87egd2ho08.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOUtM-0000kw-Kz for Emacs-orgmode@gnu.org; Wed, 27 Jan 2016 13:32:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOUtH-0002Ud-Kg for Emacs-orgmode@gnu.org; Wed, 27 Jan 2016 13:32:32 -0500 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:34133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOUtH-0002UM-8v for Emacs-orgmode@gnu.org; Wed, 27 Jan 2016 13:32:27 -0500 Received: by mail-wm0-x236.google.com with SMTP id n5so42006131wmn.1 for ; Wed, 27 Jan 2016 10:32:27 -0800 (PST) Received: from localhost (190.89.208.46.dyn.plus.net. [46.208.89.190]) by smtp.googlemail.com with ESMTPSA id y8sm8801460wmg.9.2016.01.27.10.32.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jan 2016 10:32:25 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs-orgmode --=-=-= Content-Type: text/plain Hello, Often when writing a letter I want to include "Your Ref: xyz" or "Account No.: 1234" and a good place to do this is below the sender's address field and above the date (and 'place') field(s). This space becomes filled with the contents of the koma variable called 'location'. This patch enables filling this variable via org-mode's contrib ox-koma-letter exporter. Please apply the attached patch. Myles --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-koma-letter-Add-support-for-LOCATION-koma-variabl.patch Content-Description: patch >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 --=-=-=--