From: Myles English <mylesenglish@gmail.com>
To: Emacs-orgmode <Emacs-orgmode@gnu.org>
Subject: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
Date: Wed, 27 Jan 2016 18:32:23 +0000 [thread overview]
Message-ID: <87egd2ho08.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 416 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 5093 bytes --]
From 4495abd39d57abc0dd64361f852c3a638f86915b Mon Sep 17 00:00:00 2001
From: Myles English <mylesenglish@gmail.com>
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
next reply other threads:[~2016-01-27 18:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 18:32 Myles English [this message]
2016-01-27 22:05 ` [PATCH] ox-koma-letter.el: Add support for 'location' koma variable Rasmus
2016-01-28 11:19 ` Myles English
2016-01-28 12:20 ` Rasmus
2016-01-28 22:00 ` Myles English
2016-01-29 12:16 ` Rasmus
2016-01-29 22:08 ` Myles English
2016-01-29 22:39 ` Rasmus
2016-02-15 13:51 ` Myles English
2016-02-17 22:53 ` Rasmus
2016-03-31 19:56 ` Rasmus Pank Roulund
2016-03-31 23:32 ` Myles English
2016-04-03 11:33 ` Rasmus
2016-04-04 0:54 ` Myles English
2016-04-07 8:09 ` Rasmus
2016-01-28 20:17 ` Eric S Fraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87egd2ho08.fsf@gmail.com \
--to=mylesenglish@gmail.com \
--cc=Emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).