Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-04-07 Thread Rasmus
Myles English  writes:

> A patch is attached that fixes some naughty brackets in the recent commit.

Don't worry: I probably added those by accident when rebasing.

Anyway, I pushed both patches and updated the Worg page.  Let me know if
everything is OK.

Rasmus

-- 
Bang bang



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-04-03 Thread Myles English
>From 2d9b513e14f6d34fe81a5970fd4cee24fc253a31 Mon Sep 17 00:00:00 2001
From: Myles English 
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


Rasmus,

A patch is attached that fixes some naughty brackets in the recent commit.

Myles

Rasmus writes:

> Myles English  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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-04-03 Thread Rasmus
Myles English  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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-03-31 Thread Myles English

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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-03-31 Thread Rasmus Pank Roulund
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
>From 43a26688870f6861747a1d333a5844348d3a1749 Mon Sep 17 00:00:00 2001
From: Rasmus 
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
-	

Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-02-17 Thread Rasmus
Myles English  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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-02-15 Thread Myles English


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

>From 4495abd39d57abc0dd64361f852c3a638f86915b Mon Sep 17 00:00:00 2001
From: Myles English 
Date: Wed, 27 Jan 2016 18:18:38 +
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 

Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-29 Thread Rasmus
Hi Myles,

Myles English  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




Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-29 Thread Myles English

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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-29 Thread Rasmus
Myles English  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!




Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-28 Thread Eric S Fraga
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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-28 Thread Myles English

Rasmus writes:

> Myles English  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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-28 Thread Rasmus
Myles English  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




Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-28 Thread Myles English

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



Re: [O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-27 Thread Rasmus
Hi Myles,

Thanks for your patch.

It always makes me happy when someone is using ox-koma-letter.

Myles English  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




[O] [PATCH] ox-koma-letter.el: Add support for 'location' koma variable

2016-01-27 Thread Myles English
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

>From 4495abd39d57abc0dd64361f852c3a638f86915b Mon Sep 17 00:00:00 2001
From: Myles English 
Date: Wed, 27 Jan 2016 18:18:38 +
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.
+