* [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
@ 2016-01-27 18:32 Myles English
2016-01-27 22:05 ` Rasmus
0 siblings, 1 reply; 16+ messages in thread
From: Myles English @ 2016-01-27 18:32 UTC (permalink / raw)
To: Emacs-orgmode
[-- 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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-27 18:32 [PATCH] ox-koma-letter.el: Add support for 'location' koma variable Myles English
@ 2016-01-27 22:05 ` Rasmus
2016-01-28 11:19 ` Myles English
2016-01-28 20:17 ` Eric S Fraga
0 siblings, 2 replies; 16+ messages in thread
From: Rasmus @ 2016-01-27 22:05 UTC (permalink / raw)
To: emacs-orgmode
Hi Myles,
Thanks for your patch.
It always makes me happy when someone is using ox-koma-letter.
Myles English <mylesenglish@gmail.com> writes:
> 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.
Aside: it sounds like what you need is "yourref", maybe "yourmail",
"myref", "customer", and "invoice". These are typed in the same line as
the date and place. In my manual it’s described around pp. 180.
On to "location". From the manual pp. 195 it looks like it is usually
something akin to an address field on the right side of the head. I think
"location" should be settable via a special :location: heading, probably
with special line breaking rules like the :to:/:from: special headings.
We can allow a #+LOCATION keyword in addition, but need not. All IMO.
WDYT?
Thanks,
Rasmus
--
This message is brought to you by the department of redundant departments
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-27 22:05 ` Rasmus
@ 2016-01-28 11:19 ` Myles English
2016-01-28 12:20 ` Rasmus
2016-01-28 20:17 ` Eric S Fraga
1 sibling, 1 reply; 16+ messages in thread
From: Myles English @ 2016-01-28 11:19 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hi Rasmus,
Rasmus writes:
> Thanks for your patch.
>
> It always makes me happy when someone is using ox-koma-letter.
Thanks for making it!
>> 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.
>
> Aside: it sounds like what you need is "yourref", maybe "yourmail",
> "myref", "customer", and "invoice". These are typed in the same line as
> the date and place. In my manual it’s described around pp. 180.
Thanks, those are all useful fields I didn't know about. The
description of "frombank" indicates that "location" is still a good
place for bank account details.
> On to "location". From the manual pp. 195 it looks like it is usually
> something akin to an address field on the right side of the head. I think
> "location" should be settable via a special :location: heading, probably
> with special line breaking rules like the :to:/:from: special headings.
> We can allow a #+LOCATION keyword in addition, but need not. All IMO.
> WDYT?
Given that "location" is intended as a "user's extension field" I
suppose that a special tagged :location: heading would be convenient for
some uses, if you want to add it. For most cases however, I think its
use would break up the structure of the org-mode letter so I would still
prefer this way for the simple case of inserting bank details:
______________________
** Change of address
:EXPORT_LOCATION: \usekomavar{frombank}
I have moved.
______________________
Where the frombank variable has been set in the LCO file:
\setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big
Bank\\Sort Code: 11-22-33}
The bank details only appear in a letter when the property is set.
Which is much neater than the special heading approach, something like
this:
______________________
** Change of address
*** Location field :location:
\usekomavar{frombank}
*** Rest of letter
I have moved.
______________________
Myles
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-28 11:19 ` Myles English
@ 2016-01-28 12:20 ` Rasmus
2016-01-28 22:00 ` Myles English
0 siblings, 1 reply; 16+ messages in thread
From: Rasmus @ 2016-01-28 12:20 UTC (permalink / raw)
To: mylesenglish; +Cc: emacs-orgmode
Myles English <mylesenglish@gmail.com> writes:
> Thanks for making it!
It's Nicolas’ creation, not mine. I merely contribute a few patches
to it.
>> Aside: it sounds like what you need is "yourref", maybe "yourmail",
>> "myref", "customer", and "invoice". These are typed in the same line as
>> the date and place. In my manual it’s described around pp. 180.
>
> Thanks, those are all useful fields I didn't know about. The
> description of "frombank" indicates that "location" is still a good
> place for bank account details.
OK.
>> On to "location". From the manual pp. 195 it looks like it is usually
>> something akin to an address field on the right side of the head. I think
>> "location" should be settable via a special :location: heading, probably
>> with special line breaking rules like the :to:/:from: special headings.
>> We can allow a #+LOCATION keyword in addition, but need not. All IMO.
>> WDYT?
>
> Given that "location" is intended as a "user's extension field" I
> suppose that a special tagged :location: heading would be convenient for
> some uses, if you want to add it. For most cases however, I think its
> use would break up the structure of the org-mode letter so I would still
> prefer this way for the simple case of inserting bank details:
>
> ______________________
>
> ** Change of address
> :EXPORT_LOCATION: \usekomavar{frombank}
You could have this is a LCO file as well. If so, you might be able to
populate location using \ifkomavarempty{}{}. I use this in my standard
footer to insert fields depending on which variables are set.
> \setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big
> Bank\\Sort Code: 11-22-33}
>
> The bank details only appear in a letter when the property is set.
>
> Which is much neater than the special heading approach, something like
> this:
>
> ______________________
>
> ** Change of address
>
> *** Location field :location:
> \usekomavar{frombank}
But is it much neater than:
** bank details :location:
Acc. no.: 12345
Big Bank Corp
Sort code: 1122
For temporary data, I’d rather have it like in my example. For permanent
data I can keep it in a .lco file.
And maybe #+include: "bank-info.org".
Thanks,
Rasmus
--
History is what should never happen again
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-28 12:20 ` Rasmus
@ 2016-01-28 22:00 ` Myles English
2016-01-29 12:16 ` Rasmus
0 siblings, 1 reply; 16+ messages in thread
From: Myles English @ 2016-01-28 22:00 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus writes:
> Myles English <mylesenglish@gmail.com> writes:
>
>> Thanks for making it!
>
> It's Nicolas’ creation, not mine. I merely contribute a few patches
> to it.
Thanks to Nicolas too.
>>> Aside: it sounds like what you need is "yourref", maybe "yourmail",
>>> "myref", "customer", and "invoice". These are typed in the same line as
>>> the date and place. In my manual it’s described around pp. 180.
>>
>> Thanks, those are all useful fields I didn't know about. The
>> description of "frombank" indicates that "location" is still a good
>> place for bank account details.
>
> OK.
>
>>> On to "location". From the manual pp. 195 it looks like it is usually
>>> something akin to an address field on the right side of the head. I think
>>> "location" should be settable via a special :location: heading, probably
>>> with special line breaking rules like the :to:/:from: special headings.
>>> We can allow a #+LOCATION keyword in addition, but need not. All IMO.
>>> WDYT?
>>
>> Given that "location" is intended as a "user's extension field" I
>> suppose that a special tagged :location: heading would be convenient for
>> some uses, if you want to add it. For most cases however, I think its
>> use would break up the structure of the org-mode letter so I would still
>> prefer this way for the simple case of inserting bank details:
>>
>> ______________________
>>
>> ** Change of address
>> :EXPORT_LOCATION: \usekomavar{frombank}
>
> You could have this is a LCO file as well.
Do you mean like this:
\setkomavar{location}{\usekomavar{frombank}}
I don't understand why I would want to do that because I would have to
use a different LCO file depending on whether I was writing to my bank
or not.
> If so, you might be able to populate location using
> \ifkomavarempty{}{}. I use this in my standard footer to insert
> fields depending on which variables are set.
Following on from my not understanding, any chance of an example of how
to do that showing what variable to set when writing to my bank, (to
cause the location variable to be populated with bank details)?
>> \setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big
>> Bank\\Sort Code: 11-22-33}
>>
>> The bank details only appear in a letter when the property is set.
>>
>> Which is much neater than the special heading approach, something like
>> this:
>>
>> ______________________
>>
>> ** Change of address
>>
>> *** Location field :location:
>> \usekomavar{frombank}
>
> But is it much neater than:
>
> ** bank details :location:
> Acc. no.: 12345
> Big Bank Corp
> Sort code: 1122
Err, yes it is? And anyway, that data is in my LCO file, I don't want
to duplicate it.
> For temporary data, I’d rather have it like in my example. For permanent
> data I can keep it in a .lco file.
Yes, that is what I have done (hmmm, I am beginning to sense a
fundamental misunderstanding here). My bank account details are
permanent data and are in a LCO file.
> And maybe #+include: "bank-info.org".
The way you have edited my original email in your reply makes it
difficult to follow what is being discussed. I would like to clarify
the main point by quoting from my original message:
#+BEGIN_QUOTE
...I would still prefer this way for the simple case of
inserting bank details:
______________________
** Change of address
:EXPORT_LOCATION: \usekomavar{frombank}
I have moved.
______________________
Where the frombank variable has been set in the LCO file:
\setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big
Bank\\Sort Code: 11-22-33}
The bank details only appear in a letter when the property is set.
#+END_QUOTE
That property mentioned is the :EXPORT_LOCATION: property. You can set
it to whatever you like, referencing something in your LCO file or
temporary data.
Myles
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-28 22:00 ` Myles English
@ 2016-01-29 12:16 ` Rasmus
2016-01-29 22:08 ` Myles English
0 siblings, 1 reply; 16+ messages in thread
From: Rasmus @ 2016-01-29 12:16 UTC (permalink / raw)
To: emacs-orgmode
Hi Myles,
Myles English <mylesenglish@gmail.com> writes:
>> But is it much neater than:
>>
>> ** bank details :location:
>> Acc. no.: 12345
>> Big Bank Corp
>> Sort code: 1122
>
> Err, yes it is? And anyway, that data is in my LCO file, I don't want
> to duplicate it.
That's fine, but one might want to put information there that's specific
to a particular letter (and thus no LCO file is readily available or is an
additional level of complexity).
>> For temporary data, I’d rather have it like in my example. For permanent
>> data I can keep it in a .lco file.
>
> Yes, that is what I have done (hmmm, I am beginning to sense a
> fundamental misunderstanding here). My bank account details are
> permanent data and are in a LCO file.
I’m arguing for a solution that supports BOTH "one-off" and permanent
data.
> #+BEGIN_QUOTE
> ...I would still prefer this way for the simple case of
> inserting bank details:
>
> ______________________
>
> ** Change of address
> :EXPORT_LOCATION: \usekomavar{frombank}
>
> I have moved.
> ______________________
>
> Where the frombank variable has been set in the LCO file:
>
> \setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big
> Bank\\Sort Code: 11-22-33}
>
> The bank details only appear in a letter when the property is set.
> #+END_QUOTE
>
> That property mentioned is the :EXPORT_LOCATION: property. You can set
> it to whatever you like, referencing something in your LCO file or
> temporary data.
The keyword is convenient when you want to insert a pointer to field. I
But for a one-off letter where I might need to include "one-off" details
on the left, I’d rather type:
* bank details :location:
Acc. No.: 1234567890
at Big Bank
Sort Code: 11-22-33
Than
#+latex_header: \setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big Bank\\Sort Code: 11-22-33}
#+Location: \usekomavar{frombank}
To me the former reads much easier and hides away the technical details.
Thus, I wish to see to see support for entry forms.
Rasmus
--
The Kids call him Billy the Saint
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-29 12:16 ` Rasmus
@ 2016-01-29 22:08 ` Myles English
2016-01-29 22:39 ` Rasmus
0 siblings, 1 reply; 16+ messages in thread
From: Myles English @ 2016-01-29 22:08 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus,
Rasmus writes:
> I’m arguing for a solution that supports BOTH "one-off" and permanent
> data.
OK, sorry, I thought you were arguing for a heading tagged :location:
and against an option #+LOCATION or property :EXPORT_LOCATION:. How
about applying my patch please and the tagged heading can be developed
by someone™ 'later'.
> The keyword is convenient when you want to insert a pointer to field. I
>
> But for a one-off letter where I might need to include "one-off" details
> on the left, I’d rather type:
>
> * bank details :location:
> Acc. No.: 1234567890
> at Big Bank
> Sort Code: 11-22-33
>
> Than
>
> #+latex_header: \setkomavar{frombank}{\raggedright Acc.~No.:\,1234567890\\at Big Bank\\Sort Code: 11-22-33}
> #+Location: \usekomavar{frombank}
>
> To me the former reads much easier and hides away the technical details.
> Thus, I wish to see to see support for entry forms.
Alright, I get the general idea but in that specific case this would be
simpler:
#+LOCATION: \raggedright Acc.~No.:\,1234567890\\at Big Bank\\Sort Code: 11-22-33
Myles
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-29 22:08 ` Myles English
@ 2016-01-29 22:39 ` Rasmus
2016-02-15 13:51 ` Myles English
0 siblings, 1 reply; 16+ messages in thread
From: Rasmus @ 2016-01-29 22:39 UTC (permalink / raw)
To: emacs-orgmode
Myles English <mylesenglish@gmail.com> writes:
>> I’m arguing for a solution that supports BOTH "one-off" and permanent
>> data.
>
> OK, sorry, I thought you were arguing for a heading tagged :location:
> and against an option #+LOCATION or property :EXPORT_LOCATION:. How
> about applying my patch please and the tagged heading can be developed
> by someone™ 'later'.
I have a strong taste for feature parity... I'm very busy until at least
Thursday due to travel. Maybe I can do it next weekend. Unless you beat
me to it.
I will try to merge your patch soon, this weekend. Again, unless someone
beats me to it.
> Alright, I get the general idea but in that specific case this would be
> simpler:
>
> #+LOCATION: \raggedright Acc.~No.:\,1234567890\\at Big Bank\\Sort Code: 11-22-33
You are right.
Rasmus
--
El Rey ha muerto. ¡Larga vida al Rey!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
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
0 siblings, 2 replies; 16+ messages in thread
From: Myles English @ 2016-02-15 13:51 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Rasmus
[-- Attachment #1: Type: text/plain, Size: 168 bytes --]
Rasmus writes:
> I will try to merge your patch soon, this weekend. Again, unless someone
> beats me to it.
Please would someone apply this patch?
Thanks,
Myles
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-koma-letter-Add-support-for-LOCATION-koma-variabl.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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-02-15 13:51 ` Myles English
@ 2016-02-17 22:53 ` Rasmus
2016-03-31 19:56 ` Rasmus Pank Roulund
1 sibling, 0 replies; 16+ messages in thread
From: Rasmus @ 2016-02-17 22:53 UTC (permalink / raw)
To: mylesenglish; +Cc: emacs-orgmode
Myles English <mylesenglish@gmail.com> writes:
> Rasmus writes:
>
>> I will try to merge your patch soon, this weekend. Again, unless someone
>> beats me to it.
>
> Please would someone apply this patch?
I will *try* to write the remaining code to maintain feature parity
between keywords and special headings in the weekend. I don’t think we
should add half-finished features.
Rasmus
--
Together we'll stand, divided we'll fall
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
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
1 sibling, 1 reply; 16+ messages in thread
From: Rasmus Pank Roulund @ 2016-03-31 19:56 UTC (permalink / raw)
To: mylesenglish; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 239 bytes --]
Myles,
Is :with-location something you feel strongly about? I'm not sure I find
that it makes sense...
I would like to apply the following patch on top of yours.
Thanks,
Rasmus
--
I almost cut my hair, it happened just the other day
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-koma-letter-Changes-to-LOCATION-handling.patch --]
[-- Type: text/x-diff, Size: 5705 bytes --]
From 43a26688870f6861747a1d333a5844348d3a1749 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Tue, 29 Mar 2016 18:08:09 +0200
Subject: [PATCH 1/2] ox-koma-letter: Changes to LOCATION handling
* ox-koma-letter.el (options): Parse LOCATION and remove
:with-location and :inbuffer-with-location.
(org-koma-letter--get-tagged-contents): Change string handling.
(org-koma-letter--get-value): Simplify function.
(org-koma-letter-use-location): remove
---
contrib/lisp/ox-koma-letter.el | 63 ++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 39 deletions(-)
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d36e817..a76033d 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -376,13 +376,6 @@ 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'."
@@ -436,7 +429,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)
+ (:location "LOCATION" nil org-koma-letter-location parse)
(:subject "SUBJECT" nil nil parse)
(:opening "OPENING" nil org-koma-letter-opening parse)
(:closing "CLOSING" nil org-koma-letter-closing parse)
@@ -453,7 +446,6 @@ 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)
@@ -472,7 +464,6 @@ e.g. \"title-subject:t\"."
(: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-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)
@@ -767,42 +758,36 @@ a communication channel."
(format "\\KOMAoption{fromphone}{%s}\n"
(if (plist-get info :with-phone) "true" "false")))
;; Signature.
- (let* ((head-opening (plist-get info :with-headline-opening))
- (signature (funcall heading-or-key-value
- (if head-opening 'closing nil)
- :signature
- (if head-opening 'signature nil))))
- (and signature
- (format "\\setkomavar{signature}{%s}\n" signature)))
+ (let* ((heading-val
+ (and (plist-get info :with-headline-opening)
+ (org-string-nw-p
+ (org-trim
+ (org-export-data
+ (org-koma-letter--get-tagged-contents 'closing)
+ info)))))
+ (signature (org-string-nw-p (plist-get info :signature)))
+ (signature-scope (funcall check-scope 'signature)))
+ (and (or (and signature signature-scope)
+ heading-val)
+ (not (and (eq scope 'global) heading-val))
+ (format "\\setkomavar{signature}{%s}\n"
+ (if signature-scope signature heading-val))))
;; Back address.
(and (funcall check-scope 'with-backaddress)
(format "\\KOMAoption{backaddress}{%s}\n"
(if (plist-get info :with-backaddress) "true" "false")))
;; Place.
- (let ((place-scoped (funcall check-scope 'with-place))
+ (let ((with-place-set (funcall check-scope 'with-place))
(place-set (funcall check-scope 'place)))
- (when (or (and place-scoped place-set)
- (and (eq scope 'buffer)
- (or place-scoped place-set)))
- (format "\\setkomavar{place}{%s}\n"
- (if (plist-get info :with-place) (plist-get info :place)
- ""))))
+ (and (or (and with-place-set place-set)
+ (and (eq scope 'buffer) (or with-place-set place-set)))
+ (format "\\setkomavar{place}{%s}\n"
+ (if (plist-get info :with-place) (plist-get info :place)
+ ""))))
;; Location.
- (let ((heading-val
- (org-koma-letter--add-latex-newlines
- (org-export-data
- (org-koma-letter--get-tagged-contents 'location)
- info)))
- (with-location-set (funcall check-scope 'with-location))
- (location-set (funcall check-scope 'location))
- (location (plist-get info :location)))
- (when (or (and with-location-set (or location-set heading-val))
- (and (eq scope 'buffer) (or with-location-set location-set heading-val))
- (format "\\setkomavar{location}{%s}\n"
- (if (plist-get info :with-location)
- (if (plist-get info :special-headings) (or heading-val location "")
- (or option location ""))
- "")))))
+ (let ((location (funcall heading-or-key-value 'location :location)))
+ (and location
+ (format "\\setkomavar{location}{%s}\n" location)))
;; Folding marks.
(and (funcall check-scope 'with-foldmarks)
(let ((foldmarks (plist-get info :with-foldmarks)))
--
2.8.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-03-31 19:56 ` Rasmus Pank Roulund
@ 2016-03-31 23:32 ` Myles English
2016-04-03 11:33 ` Rasmus
0 siblings, 1 reply; 16+ messages in thread
From: Myles English @ 2016-03-31 23:32 UTC (permalink / raw)
To: Rasmus Pank Roulund; +Cc: emacs-orgmode
Hi Rasmus,
Thanks for looking at this again.
Rasmus Pank Roulund writes:
> Myles,
>
> Is :with-location something you feel strongly about? I'm not sure I find
> that it makes sense...
>
> I would like to apply the following patch on top of yours.
I think that's alright.
Just to recap: I use the "location" field, intended as a general purpose
extension field, for bank details. Those details shouldn't be in every
letter I write and I don't want to have to enter those details every
time they are used. For those reasons I put the bank details in
variable in a LCO file and toggle the inclusion by setting the
:LOCATION: (or :EXPORT_LOCATION) property like this:
:EXPORT_LOCATION: \usekomavar{frombank}
As long as I can still do that I don't
mind.
Myles
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-03-31 23:32 ` Myles English
@ 2016-04-03 11:33 ` Rasmus
2016-04-04 0:54 ` Myles English
0 siblings, 1 reply; 16+ messages in thread
From: Rasmus @ 2016-04-03 11:33 UTC (permalink / raw)
To: mylesenglish; +Cc: emacs-orgmode
Myles English <mylesenglish@gmail.com> writes:
> Thanks for looking at this again.
I'm just sorry about the delay, but I hope you can appreciate that
sometimes time is at a premium.
>> Is :with-location something you feel strongly about? I'm not sure I find
>> that it makes sense...
>>
>> I would like to apply the following patch on top of yours.
>
> I think that's alright.
>
> Just to recap: I use the "location" field, intended as a general purpose
> extension field, for bank details. Those details shouldn't be in every
> letter I write and I don't want to have to enter those details every
> time they are used. For those reasons I put the bank details in
> variable in a LCO file and toggle the inclusion by setting the
> :LOCATION: (or :EXPORT_LOCATION) property like this:
>
> :EXPORT_LOCATION: \usekomavar{frombank}
So if something should be in ALL letters the advised method would be to
use LCO file or set the location variable. I’m just concerned with having
too many variables. ox-koma-letter is already fairly complex.
It might make sense to NOT parse (i.e. interpret org syntax) the keyword
version or location then. Then you’d be able to add latex commands there.
The headline version would still be parsed.
Rasmus
--
Nothing's wrong with an email that ends in a minor key
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-04-03 11:33 ` Rasmus
@ 2016-04-04 0:54 ` Myles English
2016-04-07 8:09 ` Rasmus
0 siblings, 1 reply; 16+ messages in thread
From: Myles English @ 2016-04-04 0:54 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: patch --]
[-- Type: text/x-diff, Size: 1529 bytes --]
From 2d9b513e14f6d34fe81a5970fd4cee24fc253a31 Mon Sep 17 00:00:00 2001
From: Myles English <mylesenglish@gmail.com>
Date: Mon, 4 Apr 2016 01:11:19 +0100
Subject: [PATCH] ox-koma-letter: Fixed bug in filling 'location' field
* contrib/lisp/ox-koma-letter.el: Fix code apparently introduced
in 3ee3663
---
contrib/lisp/ox-koma-letter.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index d36e817..2ef9025 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -797,12 +797,12 @@ a communication channel."
(location-set (funcall check-scope 'location))
(location (plist-get info :location)))
(when (or (and with-location-set (or location-set heading-val))
- (and (eq scope 'buffer) (or with-location-set location-set heading-val))
- (format "\\setkomavar{location}{%s}\n"
- (if (plist-get info :with-location)
- (if (plist-get info :special-headings) (or heading-val location "")
- (or option location ""))
- "")))))
+ (and (eq scope 'buffer) (or with-location-set location-set heading-val)))
+ (format "\\setkomavar{location}{%s}\n"
+ (if (plist-get info :with-location)
+ (if (plist-get info :special-headings) (or heading-val location "")
+ (or heading-val location ""))
+ ""))))
;; Folding marks.
(and (funcall check-scope 'with-foldmarks)
(let ((foldmarks (plist-get info :with-foldmarks)))
--
2.7.4
[-- Attachment #2: Type: text/plain, Size: 1402 bytes --]
Rasmus,
A patch is attached that fixes some naughty brackets in the recent commit.
Myles
Rasmus writes:
> Myles English <mylesenglish@gmail.com> writes:
>
>> Thanks for looking at this again.
>
> I'm just sorry about the delay, but I hope you can appreciate that
> sometimes time is at a premium.
>
>>> Is :with-location something you feel strongly about? I'm not sure I find
>>> that it makes sense...
>>>
>>> I would like to apply the following patch on top of yours.
>>
>> I think that's alright.
>>
>> Just to recap: I use the "location" field, intended as a general purpose
>> extension field, for bank details. Those details shouldn't be in every
>> letter I write and I don't want to have to enter those details every
>> time they are used. For those reasons I put the bank details in
>> variable in a LCO file and toggle the inclusion by setting the
>> :LOCATION: (or :EXPORT_LOCATION) property like this:
>>
>> :EXPORT_LOCATION: \usekomavar{frombank}
>
> So if something should be in ALL letters the advised method would be to
> use LCO file or set the location variable. I’m just concerned with having
> too many variables. ox-koma-letter is already fairly complex.
>
> It might make sense to NOT parse (i.e. interpret org syntax) the keyword
> version or location then. Then you’d be able to add latex commands there.
> The headline version would still be parsed.
>
> Rasmus
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] ox-koma-letter.el: Add support for 'location' koma variable
2016-01-27 22:05 ` Rasmus
2016-01-28 11:19 ` Myles English
@ 2016-01-28 20:17 ` Eric S Fraga
1 sibling, 0 replies; 16+ messages in thread
From: Eric S Fraga @ 2016-01-28 20:17 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
On Wednesday, 27 Jan 2016 at 23:05, Rasmus wrote:
> It always makes me happy when someone is using ox-koma-letter.
Just to let you know that I use ox-koma-letter all the time! It took a
while before I started using it but that was mostly because I need to
figure out how to do my organisation's letterhead using an LCO file...
So, thanks for ox-koma-letter!
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3.3-449-gd85ff3
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-04-07 8:09 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 18:32 [PATCH] ox-koma-letter.el: Add support for 'location' koma variable Myles English
2016-01-27 22:05 ` 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
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).