Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-05 Thread Alan Schmitt
Rasmus  writes:

> Alan Schmitt  writes:
>
>> Rasmus: do you want to change these, or should I do it and apply the
>> patch? (The former would be simpler, I have to say.)
>
> Attached.  Sorry about the delay.  They should fix Nicholas'
> 'concerns'.

Applied and pushed, thanks.

Alan



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-05 Thread Alan Schmitt
Alan Schmitt  writes:

> Hello Rasmus,
>
> I applied the first patch, with the following small changes.

Please ignore this email, there was something wrong in my setup (I was
in the maint branch ...). Sorry for the noise.

Alan



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-05 Thread Alan Schmitt
Hello Rasmus,

I applied the first patch, with the following small changes.

This part would not apply:

--8<---cut here---start->8---
@@ -252,7 +258,7 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter)
 
 (defcustom org-koma-letter-use-backaddress nil
-  "Non-nil prints return address in small line above to address.
+  "Non-nil prints return address in line above to address.
 This option can also be set with the OPTIONS keyword, e.g.:
 \"backaddress:t\"."
   :group 'org-export-koma-letter
--8<---cut here---end--->8---

(because the string starts with "Print" now.) I just removed the "small"
from the sentence, and some spurious white lines. Here is what I got:

--8<---cut here---start->8---
@@ -230,10 +236,8 @@ English manual of 2012-07-22)."
  (string))
   :group 'org-export-koma-letter)
 
-
-
 (defcustom org-koma-letter-use-backaddress nil
-  "Print return address in small line above to address."
+  "Print return address in line above to address."
   :group 'org-export-koma-letter
   :type 'boolean)
--8<---cut here---end--->8---

(The line numbers are quite different ... there may be some edits on
your side that have not made it to the patch.)

I could not apply the second patch because the line numbers are too
different. For instance, this chunk is supposed to start on line 266,
not 336 here.

--8<---cut here---start->8---
@@ -336,6 +338,16 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter
   :type 'boolean)
 
+(defcustom org-koma-letter-use-title t
+  "Non-nil means use a title in the letter if present.
+This option can also be set with the OPTIONS keyword,
+e.g. \"with-title:nil\".
+
+See also `org-koma-letter-prefer-subject' for the handling of
+title versus subject."
+  :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'."
--8<---cut here---end--->8---

Also, what is the text after the "@@" in the first line?

I can manually apply the patch (it's not that big), or you can
regenerate it. Please let me know what you prefer.

Best,

Alan



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-05 Thread Rasmus
Nicolas Goaziou  writes:

> No. Other groups are `org-export-latex', `org-export-html'...

Bastien  writes:

> Unless I miss something, other groups are
>
> org-export-html
> org-export-latex
>
> etc.
>
> so org-export-koma-letter seems right.

Right.  That's a late night blunder on my part!

Thanks for pointing me in the right direction.


-- 
Er du tosset for noge' lårt!



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-05 Thread Alan Schmitt
Rasmus  writes:

> Quick but unrelated question.  I'm updating the Worg page and I
> noticed that the customize-group for ox-koma-letter is
> org-export-koma-letter.  Given that other groups are org-latex and
> org-html etc., should the group not be called org-koma-letter?

Yes, org-koma-letter sounds better.

Alan



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-04 Thread Bastien
Hi Rasmus,

Rasmus  writes:

> Quick but unrelated question.  I'm updating the Worg page and I
> noticed that the customize-group for ox-koma-letter is
> org-export-koma-letter.  Given that other groups are org-latex and
> org-html etc., should the group not be called org-koma-letter?

Unless I miss something, other groups are

org-export-html
org-export-latex

etc.

so org-export-koma-letter seems right.

-- 
 Bastien



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-04 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> Given that other groups are org-latex and
> org-html etc., should the group not be called org-koma-letter?

No. Other groups are `org-export-latex', `org-export-html'...


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-04 Thread Rasmus

Quick but unrelated question.  I'm updating the Worg page and I
noticed that the customize-group for ox-koma-letter is
org-export-koma-letter.  Given that other groups are org-latex and
org-html etc., should the group not be called org-koma-letter?

–Rasmus

PS: Sorry for not starting a new thread.

-- 
Dung makes an excellent fertilizer



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-04 Thread Rasmus
Alan Schmitt  writes:

> Rasmus: do you want to change these, or should I do it and apply the
> patch? (The former would be simpler, I have to say.)

Attached.  Sorry about the delay.  They should fix Nicholas'
'concerns'.

–Rasmus

-- 
Vote for proprietary math!
>From 8f3e69f5ca3d0153b6f4c80b74c7aa6f422c86e5 Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Sat, 25 Jan 2014 14:08:15 +0100
Subject: [PATCH 1/2] Documentation fixes for ox-koma-script.el

* ox-koma-letter.el commentary (org-koma-letter-use-backaddress):
  Better documentation.
---
 contrib/lisp/ox-koma-letter.el | 30 ++
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 7f2cd22..0d15956 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -34,14 +34,14 @@
 ;; On top of buffer keywords supported by `latex' back-end (see
 ;; `org-latex-options-alist'), this back-end introduces the following
 ;; keywords:
-;;   - "CLOSING" (see `org-koma-letter-closing'),
-;;   - "FROM_ADDRESS" (see `org-koma-letter-from-address'),
-;;   - "LCO" (see `org-koma-letter-class-option-file'),
-;;   - "OPENING" (see `org-koma-letter-opening'),
-;;   - "PHONE_NUMBER" (see `org-koma-letter-phone-number'),
-;;   - "SIGNATURE" (see `org-koma-letter-signature')
-;;   - "PLACE" (see `org-koma-letter-place')
-;;   - and "TO_ADDRESS".  If unspecified this is set to "\mbox{}".
+;;   - CLOSING: see `org-koma-letter-closing',
+;;   - FROM_ADDRESS: see `org-koma-letter-from-address',
+;;   - LCO: see `org-koma-letter-class-option-file',
+;;   - OPENING: see `org-koma-letter-opening',
+;;   - PHONE_NUMBER: see `org-koma-letter-phone-number',
+;;   - SIGNATURE: see `org-koma-letter-signature',
+;;   - PLACE: see `org-koma-letter-place',
+;;   - TO_ADDRESS:  If unspecified this is set to "\mbox{}".
 ;;
 ;; TO_ADDRESS and FROM_ADDRESS can also be specified using heading
 ;; with the special tags specified in
@@ -67,8 +67,9 @@
 ;; (see `org-koma-letter-special-tags-after-letter').
 ;;
 ;; The following variables works differently from the main LaTeX class
-;;   - "AUTHOR": default to user-full-name but may be disabled.  (see org-koma-letter-author),
-;;   - "EMAIL": same as AUTHOR, (see org-koma-letter-email),
+;;   - AUTHOR: Default to user-full-name but may be disabled.
+;; (See also `org-koma-letter-author'),
+;;   - EMAIL: Same as AUTHOR. (see also `org-koma-letter-email'),
 ;;
 ;; Headlines are in general ignored.  However, headlines with special
 ;; tags can be used for specified contents like postscript (ps),
@@ -105,11 +106,16 @@
 ;;   \[EXTRA]"))
 ;;
 ;; Then, in your Org document, be sure to require the proper class
-;; with :
+;; with:
 ;;
 ;;#+LATEX_CLASS: my-letter
 ;;
 ;; Or by setting `org-koma-letter-default-class'.
+;;
+;; You may have to load (LaTeX) Babel as well, e.g., by adding
+;; it to `org-latex-packages-alist',
+;;
+;;(add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil))
 
 ;;; Code:
 
@@ -252,7 +258,7 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter)
 
 (defcustom org-koma-letter-use-backaddress nil
-  "Non-nil prints return address in small line above to address.
+  "Non-nil prints return address in line above to address.
 This option can also be set with the OPTIONS keyword, e.g.:
 \"backaddress:t\"."
   :group 'org-export-koma-letter
-- 
1.8.5.3

>From a55d3611d5ae6b04c64513490d68a9959672c86f Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Sat, 25 Jan 2014 14:15:03 +0100
Subject: [PATCH 2/2] Allow separate subject and title in ox-koma-letter

* ox-koma-letter.el (org-koma-letter-use-title): New variable.
(org-koma-letter-prefer-subject): New variable.
(org-koma-letter-template): Allow separate subject and title.
---
 contrib/lisp/ox-koma-letter.el | 41 +
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 0d15956..8a3054b 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -70,6 +70,8 @@
 ;;   - AUTHOR: Default to user-full-name but may be disabled.
 ;; (See also `org-koma-letter-author'),
 ;;   - EMAIL: Same as AUTHOR. (see also `org-koma-letter-email'),
+;;   - TITLE: May be the letter title or subject depending on
+;; `org-koma-letter-prefer-subject'.
 ;;
 ;; Headlines are in general ignored.  However, headlines with special
 ;; tags can be used for specified contents like postscript (ps),
@@ -336,6 +338,16 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter
   :type 'boolean)
 
+(defcustom org-koma-letter-use-title t
+  "Non-nil means use a title in the letter if present.
+This option can also be set with the OPTIONS keyword,
+e.g. \"with-title:nil\".
+
+See also `org-koma-letter-prefer-subject' for the handling of
+title versus subject."
+  :gro

Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-04 Thread Rasmus Pank Roulund
>>> Would you give the attached patches a spin?  I think they work nicely;
>>> only the second patch is non-trivial.  Basically, one can ignore
>>> subject and title differences as now by setting
>>> org-koma-letter-prefer-subject to t and not use the SUBJECT keyword.
>>>
>>> I have set the default of -prefer-subject to nil per the discussion
>>> with Alan and Michael Strey.
>>>
>>> It should apply against master.
>>
>> It looks good. Thank you.
>>
>> A few minor remarks below.
>>
>>> +(defcustom org-koma-letter-use-title t
>>> +  "Non-nil means use a title in the letter if present.
>>> +
>>> +See also `org-koma-letter-prefer-subject' for the handling of
>>> +title versus subject."
>>> +  :group 'org-export-koma-letter
>>> +  :type 'boolean)
>>
>> You should also talk about the OPTIONS item, i.e., "title:nil", as in
>> other defcustoms.
>>
>>> +(defcustom org-koma-letter-prefer-subject nil
>>> +  "Non-nil means title should be interpret as subject if subject is 
>>> missing.
>>> +
>>> +This may be useful for older documents where the SUBJECT keyword
>>> +was not present."
>>> +:group 'org-export-koma-letter
>>> +:type 'boolean)
>>
>> Ditto.
>>
>>> -   ;; Subject
>>> -   (let ((with-subject (plist-get info :with-subject)))
>>> +   ;; Subject and title
>>> +   (let ((with-subject (plist-get info :with-subject))
>>> +(title-as-subject (plist-get info :with-title-as-subject))
>>> +(subject (org-string-nw-p (org-export-data (plist-get info :subject) 
>>> info)))
>>> +(title (org-string-nw-p (org-export-data (plist-get info :title) 
>>> info
>>
>> `title-as-subject', `subject' and `title' belong to the `let' below, not
>> this one.
>>
>>>   (when with-subject
>>> (concat
>>> (unless (eq with-subject t)
>>>   (format "\\KOMAoption{subject}{%s}\n"
>>>   (if (symbolp with-subject) with-subject
>>> (mapconcat #'symbol-name with-subject ","
>>> -   (let ((subject (org-export-data (plist-get info :title) info)))
>>> - (and (org-string-nw-p subject)
>>> -  (format "\\setkomavar{subject}{%s}\n\n" subject))
>>> +   (let ((subject (if title-as-subject (or subject title) subject))
>>> + (title (if title-as-subject (and subject title) title)))
>>> + (concat
>>> +  (and (org-string-nw-p subject)
>>> +   (format "\\setkomavar{subject}{%s}\n" subject))
>>> +  (and (org-string-nw-p title)
>>> +   (format "\\setkomavar{title}{%s}\n" title))
>>> +  (when (or (org-string-nw-p title) (org-string-nw-p subject)) 
>>> "\n"))
>
> Rasmus: do you want to change these, or should I do it and apply the
> patch? (The former would be simpler, I have to say.)

Yes, but I didn't manged to do it in the weekend.  I'll try to find
time during the week.  My apology. 

–Rasmus

-- 
When the facts change, I change my mind. What do you do, sir?



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-02-04 Thread Alan Schmitt
Hello,

Sorry for not replying earlier, I've been swamped by traveling and work.

Nicolas Goaziou  writes:

> Hello,
>
> Rasmus  writes:
>
>> Would you give the attached patches a spin?  I think they work nicely;
>> only the second patch is non-trivial.  Basically, one can ignore
>> subject and title differences as now by setting
>> org-koma-letter-prefer-subject to t and not use the SUBJECT keyword.
>>
>> I have set the default of -prefer-subject to nil per the discussion
>> with Alan and Michael Strey.
>>
>> It should apply against master.
>
> It looks good. Thank you.
>
> A few minor remarks below.
>
>> +(defcustom org-koma-letter-use-title t
>> +  "Non-nil means use a title in the letter if present.
>> +
>> +See also `org-koma-letter-prefer-subject' for the handling of
>> +title versus subject."
>> +  :group 'org-export-koma-letter
>> +  :type 'boolean)
>
> You should also talk about the OPTIONS item, i.e., "title:nil", as in
> other defcustoms.
>
>> +(defcustom org-koma-letter-prefer-subject nil
>> +  "Non-nil means title should be interpret as subject if subject is missing.
>> +
>> +This may be useful for older documents where the SUBJECT keyword
>> +was not present."
>> +:group 'org-export-koma-letter
>> +:type 'boolean)
>
> Ditto.
>
>> -   ;; Subject
>> -   (let ((with-subject (plist-get info :with-subject)))
>> +   ;; Subject and title
>> +   (let ((with-subject (plist-get info :with-subject))
>> + (title-as-subject (plist-get info :with-title-as-subject))
>> + (subject (org-string-nw-p (org-export-data (plist-get info :subject) 
>> info)))
>> + (title (org-string-nw-p (org-export-data (plist-get info :title) 
>> info
>
> `title-as-subject', `subject' and `title' belong to the `let' below, not
> this one.
>
>>   (when with-subject
>> (concat
>>  (unless (eq with-subject t)
>>(format "\\KOMAoption{subject}{%s}\n"
>>(if (symbolp with-subject) with-subject
>>  (mapconcat #'symbol-name with-subject ","
>> -(let ((subject (org-export-data (plist-get info :title) info)))
>> -  (and (org-string-nw-p subject)
>> -   (format "\\setkomavar{subject}{%s}\n\n" subject))
>> +(let ((subject (if title-as-subject (or subject title) subject))
>> +  (title (if title-as-subject (and subject title) title)))
>> +  (concat
>> +   (and (org-string-nw-p subject)
>> +(format "\\setkomavar{subject}{%s}\n" subject))
>> +   (and (org-string-nw-p title)
>> +(format "\\setkomavar{title}{%s}\n" title))
>> +   (when (or (org-string-nw-p title) (org-string-nw-p subject)) 
>> "\n"))

Rasmus: do you want to change these, or should I do it and apply the
patch? (The former would be simpler, I have to say.)

Thanks,

Alan



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-01-25 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> Would you give the attached patches a spin?  I think they work nicely;
> only the second patch is non-trivial.  Basically, one can ignore
> subject and title differences as now by setting
> org-koma-letter-prefer-subject to t and not use the SUBJECT keyword.
>
> I have set the default of -prefer-subject to nil per the discussion
> with Alan and Michael Strey.
>
> It should apply against master.

It looks good. Thank you.

A few minor remarks below.

> +(defcustom org-koma-letter-use-title t
> +  "Non-nil means use a title in the letter if present.
> +
> +See also `org-koma-letter-prefer-subject' for the handling of
> +title versus subject."
> +  :group 'org-export-koma-letter
> +  :type 'boolean)

You should also talk about the OPTIONS item, i.e., "title:nil", as in
other defcustoms.

> +(defcustom org-koma-letter-prefer-subject nil
> +  "Non-nil means title should be interpret as subject if subject is missing.
> +
> +This may be useful for older documents where the SUBJECT keyword
> +was not present."
> +:group 'org-export-koma-letter
> +:type 'boolean)

Ditto.

> -   ;; Subject
> -   (let ((with-subject (plist-get info :with-subject)))
> +   ;; Subject and title
> +   (let ((with-subject (plist-get info :with-subject))
> +  (title-as-subject (plist-get info :with-title-as-subject))
> +  (subject (org-string-nw-p (org-export-data (plist-get info :subject) 
> info)))
> +  (title (org-string-nw-p (org-export-data (plist-get info :title) 
> info

`title-as-subject', `subject' and `title' belong to the `let' below, not
this one.

>   (when with-subject
> (concat
>   (unless (eq with-subject t)
> (format "\\KOMAoption{subject}{%s}\n"
> (if (symbolp with-subject) with-subject
>   (mapconcat #'symbol-name with-subject ","
> - (let ((subject (org-export-data (plist-get info :title) info)))
> -   (and (org-string-nw-p subject)
> -(format "\\setkomavar{subject}{%s}\n\n" subject))
> + (let ((subject (if title-as-subject (or subject title) subject))
> +   (title (if title-as-subject (and subject title) title)))
> +   (concat
> +(and (org-string-nw-p subject)
> + (format "\\setkomavar{subject}{%s}\n" subject))
> +(and (org-string-nw-p title)
> + (format "\\setkomavar{title}{%s}\n" title))
> +(when (or (org-string-nw-p title) (org-string-nw-p subject)) 
> "\n"))


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-01-25 Thread Rasmus
Nicolas,

Nicolas Goaziou  writes:

> Rasmus  writes:
>
>> Nicolas Goaziou  writes:
>>
 I finally had the time to fix these old patches.  Sorry about the
 wait.
>>>
>>> You should update Org first. I modified large parts of ox-koma-letter.el
>>> recently so your patches will probably not apply. Also, some parts are
>>> not necessary anymore.
>>
>> I did. . .  And I formatted the patch against origin/master.  I'll
>> look into it.  Thanks.
>
> After a cursory look, it seems that patches 1 and 2 are not necessary
> anymore. I didn't tackle down subject vs title issue, so patch 3 is
> needed. Though, I think it needs some changes to be applied.

Would you give the attached patches a spin?  I think they work nicely;
only the second patch is non-trivial.  Basically, one can ignore
subject and title differences as now by setting
org-koma-letter-prefer-subject to t and not use the SUBJECT keyword.

I have set the default of -prefer-subject to nil per the discussion
with Alan and Michael Strey.

It should apply against master.

–Rasmus

-- 
Dung makes an excellent fertilizer
>From 10d5518e9f48f18898de138b98b3be97b446dbe3 Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Sat, 25 Jan 2014 14:08:15 +0100
Subject: [PATCH 1/2] Documentation fixes for ox-koma-script.el

* ox-koma-letter.el commentary (org-koma-letter-use-backaddress):
  Better documentation.
---
 contrib/lisp/ox-koma-letter.el | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 7f2cd22..b1f37b8 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -105,11 +105,16 @@
 ;;   \[EXTRA]"))
 ;;
 ;; Then, in your Org document, be sure to require the proper class
-;; with :
+;; with:
 ;;
 ;;#+LATEX_CLASS: my-letter
 ;;
 ;; Or by setting `org-koma-letter-default-class'.
+;;
+;; You may have to load (LaTeX) Babel as well, e.g., by adding
+;; it to `org-latex-packages-alist',
+;;
+;;(add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil))
 
 ;;; Code:
 
@@ -252,7 +257,7 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter)
 
 (defcustom org-koma-letter-use-backaddress nil
-  "Non-nil prints return address in small line above to address.
+  "Non-nil prints return address in line above to address.
 This option can also be set with the OPTIONS keyword, e.g.:
 \"backaddress:t\"."
   :group 'org-export-koma-letter
-- 
1.8.5.3

>From 99cffa500dc86482bf217d725224cbbf19687711 Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Sat, 25 Jan 2014 14:15:03 +0100
Subject: [PATCH 2/2] Allow separate subject and title in ox-koma-letter

* ox-koma-letter.el (org-koma-letter-use-title): New variable.
(org-koma-letter-prefer-subject): New variable.
(org-koma-letter-template): Allow separate subject and title.
---
 contrib/lisp/ox-koma-letter.el | 37 -
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index b1f37b8..d5ee1de 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -335,6 +335,14 @@ This option can also be set with the OPTIONS keyword, e.g.:
   :group 'org-export-koma-letter
   :type 'boolean)
 
+(defcustom org-koma-letter-use-title t
+  "Non-nil means use a title in the letter if present.
+
+See also `org-koma-letter-prefer-subject' for the handling of
+title versus subject."
+  :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'."
@@ -348,6 +356,14 @@ A headline is only used if #+OPENING is not set.  See also
   :group 'org-export-koma-letter
   :type 'boolean)
 
+(defcustom org-koma-letter-prefer-subject nil
+  "Non-nil means title should be interpret as subject if subject is missing.
+
+This may be useful for older documents where the SUBJECT keyword
+was not present."
+:group 'org-export-koma-letter
+:type 'boolean)
+
 (defconst org-koma-letter-special-tags-in-letter '(to from)
   "Header tags related to the letter itself.")
 
@@ -377,6 +393,7 @@ A headline is only used if #+OPENING is not set.  See also
 (:opening "OPENING" nil org-koma-letter-opening)
 (:closing "CLOSING" nil org-koma-letter-closing)
 (:signature "SIGNATURE" nil org-koma-letter-signature newline)
+(:subject "SUBJECT" nil nil space)
 (:special-headings nil "special-headings"
 		   org-koma-letter-prefer-special-headings)
 (:special-tags nil nil (append
@@ -393,6 +410,8 @@ A headline is only used if #+OPENING is not set.  See also
 (:with-phone nil "phone" org-koma-letter-use-phone)
 (:with-place nil "place" org-koma-letter-use-place)
 (:with-subject nil "subject" org-koma-letter-subject-format)
+(:with-title nil "title" org-koma-letter-use-title)
+(:with-title-as-subject nil 

Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-01-18 Thread Nicolas Goaziou
Rasmus  writes:

> Nicolas Goaziou  writes:
>
>>> I finally had the time to fix these old patches.  Sorry about the
>>> wait.
>>
>> You should update Org first. I modified large parts of ox-koma-letter.el
>> recently so your patches will probably not apply. Also, some parts are
>> not necessary anymore.
>
> I did. . .  And I formatted the patch against origin/master.  I'll
> look into it.  Thanks.

After a cursory look, it seems that patches 1 and 2 are not necessary
anymore. I didn't tackle down subject vs title issue, so patch 3 is
needed. Though, I think it needs some changes to be applied.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-01-18 Thread Rasmus
Nicolas Goaziou  writes:

>> I finally had the time to fix these old patches.  Sorry about the
>> wait.
>
> You should update Org first. I modified large parts of ox-koma-letter.el
> recently so your patches will probably not apply. Also, some parts are
> not necessary anymore.

I did. . .  And I formatted the patch against origin/master.  I'll
look into it.  Thanks.

–Rasmus

-- 
Hooray!




Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-01-18 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> I finally had the time to fix these old patches.  Sorry about the
> wait.

You should update Org first. I modified large parts of ox-koma-letter.el
recently so your patches will probably not apply. Also, some parts are
not necessary anymore.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2014-01-18 Thread Rasmus
Alan,

I finally had the time to fix these old patches.  Sorry about the
wait.

Alan Schmitt  writes:

> Hello,
>> Attached are a couple of changes to ox-koma-letter following a recent
>> bug report by James.
>>
>> 1. Minor fixes around.  The way subject-format was handled before was
>>ugly.  Updated some docstrings etc.
>
> I'm afraid I'm not competent to talk about the subject handling (the
> elisp is beyond my level). I'm fine with the docstring update, with one
> nitpick: "e.g." should always be present as a parenthetical sentence:
> "..., e.g, ...".

Fixed.

>> 2. better test of whether values have changed in the buffer.  I think
>>Alan added this first, but the previous implementation.  I think
>>it's more robust now, and it hopefully addresses James' problems
>>(please test).  Basically and x-aux variable is added for all
>>variables x in :option-alist with a default value "unset".  The
>>value can then be tested.
>
> Isn't "unset" a bit dangerous? Can we detect when we set something to
> "unset" (I don't know if it's a valid option for anything)? (By the way,
> the previous value of "nil", except for foldmarks, was much worse.) How
> about using "ox-koma-unset"?


Fixed.

>> 3. When studying the KOMA manual to answer James' second question I
>>came across the komavar title which is currently not supported.  I
>>have added support for a separate SUBJECT keyword.  The heuristic
>>is something like this (i) if title and subject are be truthful to
>>the name no matter what, (ii) if only title or subject is said let
>>title be subject if org-koma-letter-title-is-subject-maybe is t
>>otherwise be truthful to name.
>
> This sounds good. Once again, I'm not sure I'm competent enough to
> criticize the elisp code.

> [snip]


>> In 3. I would personally like to set
>> org-koma-letter-title-is-subject-maybe to nil by defaults, but this
>> would break backwards comparability for title keywords.
>
> I don't mind breaking backward compatibility at this point, if we make
> clear how to get back the previous output.

TITLE is now title and SUBJECT is now subject by default.

These new patches should apply against the master branch. 

–Rasmus

-- 
I almost cut my hair, it happened just the other day
>From c4adcc44f08f4e92efba1b7aabb45807cffc5f1c Mon Sep 17 00:00:00 2001
From: Rasmus Pank Roulund 
Date: Sun, 24 Nov 2013 17:57:37 +0100
Subject: [PATCH 1/3] Minor fixes for ox-koma-script.el

* ox-koma-letter.el (org-koma-letter-headline) (org-koma-letter-email)
(org-koma-letter-prefer-special-headings) (org-koma-letter-use-backaddress)
(org-koma-letter-headline-is-opening-maybe): Correct docstring.
(org-koma-letter-template): Insert subject before document start.
(org-koma-letter-headline): Fix spelling.
(org-koma-letter-template): Better subject handling.
---
 contrib/lisp/ox-koma-letter.el | 50 +++---
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 240de29..3a0fa53 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -111,11 +111,15 @@
 ;;   \[EXTRA]"))
 ;;
 ;; Then, in your Org document, be sure to require the proper class
-;; with :
+;; with:
 ;;
 ;;#+LATEX_CLASS: my-letter
 ;;
 ;; Or by setting `org-koma-letter-default-class'.
+;; You may possibly have to load (LaTeX) Babel as well e.g. by adding
+;; it to `org-latex-packages-alist',
+;;
+;;(add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil))
 
 ;;; Code:
 
@@ -148,7 +152,7 @@ string."
 		(const :tag "Do not export author" nil)))
 
 (defcustom org-koma-letter-email 'org-koma-letter-email
-  "The sender's email address.
+  "Sender's email address.
 
 This variable defaults to the value `org-koma-letter-email' which
 returns `user-mail-address'.  Alternatively a string, nil or a
@@ -189,7 +193,11 @@ t the value opening will be implicit set as the headline title."
   :type 'string)
 
 (defcustom org-koma-letter-prefer-special-headings nil
-  "If TO and/or FROM is specified using both a heading and a keyword the heading value will be preferred if the variable is t."
+  "Prefer special headings in letters.
+
+If TO and/or FROM is specified using both a heading and a keyword
+the heading value will be preferred if this variable is non-nil.
+"
   :group 'org-export-koma-letter
   :type 'boolean)
 
@@ -211,7 +219,6 @@ At this time the following values are allowed:
  - titled: add title/description to subject.
  - underlined: set subject underlined.
  - untitled: do not add title/description to subject.
- - No-export: do no insert a subject even if present.
 
 Please refer to the KOMA-script manual (Table 4.16. in the
 English manual of 2012-07-22)."
@@ -233,7 +240,7 @@ English manual of 2012-07-22)."
 
 
 (defcustom org-koma-letter-use-backaddress nil
-  "Print return address in small line above to address."
+  "Print return address above the address."
  

Re: [O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2013-11-25 Thread Michael Strey
Hi Rasmus,

ras...@gmx.us writes:

[...]

> 3. When studying the KOMA manual to answer James' second question I
>came across the komavar title which is currently not supported.  I
>have added support for a separate SUBJECT keyword.  The heuristic
>is something like this (i) if title and subject are be truthful to
>the name no matter what, (ii) if only title or subject is said let
>title be subject if org-koma-letter-title-is-subject-maybe is t
>otherwise be truthful to name.

Thank you for implementing this feature.  I already missed it.

[...]

> In 3. I would personally like to set
> org-koma-letter-title-is-subject-maybe to nil by defaults, but this
> would break backwards comparability for title keywords.

I would like to encourage you to do so, even if it breaks backward
compatibility.  Since Koma Letter supports Title and Subject, Title
should be title and Subject should be subject by default.  Everything
else could drive users crazy.

I've been using Koma Letter for many years for various purposes.  Title
without subject makes sense, for instance, when writing press releases
and certificates.

Best regards
-- 
Michael Strey
http://www.strey.biz



[O] [PATCH][ox-koma-letter] changed-in-buffer, subject, minor fixes

2013-11-24 Thread Rasmus
Hi all,

Attached are a couple of changes to ox-koma-letter following a recent
bug report by James.

1. Minor fixes around.  The way subject-format was handled before was
   ugly.  Updated some docstrings etc.

2. better test of whether values have changed in the buffer.  I think
   Alan added this first, but the previous implementation.  I think
   it's more robust now, and it hopefully addresses James' problems
   (please test).  Basically and x-aux variable is added for all
   variables x in :option-alist with a default value "unset".  The
   value can then be tested.

   I'm still concerned about this whole in-buffer voodoo.  Not only do
   we test :email twice (sorry for keep bringing this up), but
   e.g. backaddress can only be set in buffer now:
   
  (when with-backaddress-set
(format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" 
"false")))

   Perhaps this is OK, but one might have to rely on LCO files rather
   than lisp to change defaults (which I don't like).

3. When studying the KOMA manual to answer James' second question I
   came across the komavar title which is currently not supported.  I
   have added support for a separate SUBJECT keyword.  The heuristic
   is something like this (i) if title and subject are be truthful to
   the name no matter what, (ii) if only title or subject is said let
   title be subject if org-koma-letter-title-is-subject-maybe is t
   otherwise be truthful to name.
 
I have of course tested the patches here, but I would appreciate
feedback before they are applied.  There's also a number of TODOs in
the code that I would appreciate feedback on.

In 3. I would personally like to set
org-koma-letter-title-is-subject-maybe to nil by defaults, but this
would break backwards comparability for title keywords.

–Rasmus

PS: We should add a banner to the Worg tutorial that not all info is
up-to-date and that people one should as a minimum supplement it with
reading the commentary section of the file (I'm not sure whether
people do this).

-- 
Enough with the bla bla!
>From f6767ff0900fa65096ca4591b71a60516c4e71c6 Mon Sep 17 00:00:00 2001
From: Rasmus 
Date: Sun, 24 Nov 2013 17:57:37 +0100
Subject: [PATCH 1/3] Minor fixes for ox-koma-script.el

* ox-koma-letter.el (org-koma-letter-headline): Correct docstring.
(org-koma-letter-template): Insert subject before document start.
(org-koma-letter-headline): Fix spelling.
(org-koma-letter-template): Better subject handling.
---
 contrib/lisp/ox-koma-letter.el | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 240de29..e4d6f7a 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -111,11 +111,15 @@
 ;;   \[EXTRA]"))
 ;;
 ;; Then, in your Org document, be sure to require the proper class
-;; with :
+;; with:
 ;;
 ;;#+LATEX_CLASS: my-letter
 ;;
 ;; Or by setting `org-koma-letter-default-class'.
+;; You may possibly have to load (LaTeX) Babel as well e.g. by adding
+;; it to `org-latex-packages-alist',
+;;
+;;(add-to-list 'org-latex-packages-alist '("AUTO" "babel" nil))

 ;;; Code:

@@ -211,7 +215,6 @@ At this time the following values are allowed:
  - titled: add title/description to subject.
  - underlined: set subject underlined.
  - untitled: do not add title/description to subject.
- - No-export: do no insert a subject even if present.

 Please refer to the KOMA-script manual (Table 4.16. in the
 English manual of 2012-07-22)."
@@ -516,7 +519,7 @@ appropriate place."
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
   ;; FIXME: instead of setq'ing org-koma-letter-special-contents and
-  ;; callying varioues stuff it might be nice to put a big let* around the templace
+  ;; callying varioues stuff it might be nice to put a big let* around the template
   ;; as in org-groff...
   (concat
;; Time-stamp.
@@ -585,7 +588,7 @@ holding export options."
(let ((with-backaddress (plist-get info :with-backaddress))
 	 (with-backaddress-set (plist-get info :with-backaddress-changed-in-buffer-p))
 	 (with-foldmarks (plist-get info :with-foldmarks))
-	 (with-foldmarks-set
+	 (with-foldmarks-set
 	  (not (string-equal (plist-get info :with-foldmarks-changed-in-buffer-p)
 			 "foldmarks-not-set")))
 	 (with-phone (plist-get info :with-phone))
@@ -601,28 +604,25 @@ holding export options."
 	(format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false")))
   (when with-email-set
 	(format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false")
-   ;; Document start
-   "\\begin{document}\n\n"
;; Subject
(let* ((with-subject (plist-get info :with-subject))
-	  (subject-format (cond ((member with-subject '("true" "t" t)) nil)
-((stringp with-subject) (list with-subject))
-((symbolp with-subject)
- (list (symbol-name with-subject)))
-(t with-subje